| 1 | SPNFEDT0 ;HISC/DAD/WAA-FIM EDIT ;7/30/96  14:23
 | 
|---|
| 2 |  ;;2.0;Spinal Cord Dysfunction;**10,12,19**;01/02/1997
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 | REPT(SPNFDFN) ; This is to select the type of data to enter for a patient.
 | 
|---|
| 5 |  ; If none of the reports are selected then SPNFEXIT is set to 1
 | 
|---|
| 6 |  ; and the program exits.
 | 
|---|
| 7 |  ; Returns SPNFFIM as a value of 1 to 4 indicating the type
 | 
|---|
| 8 |  ; of report to be entered/edited
 | 
|---|
| 9 |  ; Input:
 | 
|---|
| 10 |  ;      SPNFDFN = Patient DFN
 | 
|---|
| 11 |  ;
 | 
|---|
| 12 |  ; Output:
 | 
|---|
| 13 |  ;      SPNFEXIT = 1 User exited
 | 
|---|
| 14 |  ;                 0 User passed
 | 
|---|
| 15 |  S SPNFEXIT=0
 | 
|---|
| 16 |  I $D(IOF) W @IOF
 | 
|---|
| 17 |  K DIRUT
 | 
|---|
| 18 |  N SPNFMS
 | 
|---|
| 19 |  S SPNFMS=0
 | 
|---|
| 20 |  I $G(^SPNL(154,SPNFDFN,0))'="" D
 | 
|---|
| 21 |  . S SPNFMS=$$EN2^SPNLUTL1(SPNFDFN,"MULTIPLE SCLEROSIS")
 | 
|---|
| 22 |  . Q
 | 
|---|
| 23 |  D  Q:SPNFEXIT!(SPNFFIM<1)
 | 
|---|
| 24 |  . I $D(IOF) W @IOF
 | 
|---|
| 25 |  . I $D(SPNFDFN)=0 I $D(SPNDFN) S SPNFDFN=SPNDFN
 | 
|---|
| 26 |  . S SPNFFIM=0
 | 
|---|
| 27 |  . K DIR S DIR(0)="SOM^1:Self Report of Function;2:FIM;3:ASIA;4:CHART;5:FAM;6:DIENER;7:DUSOI"
 | 
|---|
| 28 |  . I SPNFMS S DIR(0)=DIR(0)_";8:Multiple Sclerosis"
 | 
|---|
| 29 |  . S DIR("A")="Select the Record Type for this outcome"
 | 
|---|
| 30 |  . S DIR("?",1)="   Enter 1 to enter/edit a Self Report of Function score."
 | 
|---|
| 31 |  . S DIR("?",2)="   Enter 2 to enter/edit a FIM score."
 | 
|---|
| 32 |  . S DIR("?",3)="   Enter 3 to enter/edit an ASIA score."
 | 
|---|
| 33 |  . S DIR("?",4)="   Enter 4 to enter/edit a CHART score."
 | 
|---|
| 34 |  . S DIR("?",5)="   Enter 5 to enter/edit a FAM score."
 | 
|---|
| 35 |  . S DIR("?",6)="   Enter 6 to enter/edit a DIENER score."
 | 
|---|
| 36 |  . S DIR("?",7)="   Enter 7 to enter/edit a DUSOI score."
 | 
|---|
| 37 |  . S:SPNFMS DIR("?",8)="   Enter 8 to enter/edit a Multiple Sclerosis score."
 | 
|---|
| 38 |  . S DIR("?")="   Choose either 1,2,3,4,5,6,7 " S:SPNFMS DIR("?")=DIR("?")_"or 8."
 | 
|---|
| 39 |  . W ! D ^DIR K DIR S SPNFFIM=+Y
 | 
|---|
| 40 |  . I $D(DIRUT) S SPNFEXIT=1 Q
 | 
|---|
| 41 |  . I $D(DIRUT) S:$D(DTOUT)!($D(DUOUT)) SPNFEXIT=1 Q
 | 
|---|
| 42 |  . Q:SPNFFIM<1
 | 
|---|
| 43 |  . ;I SPNSEL="A" D ADD
 | 
|---|
| 44 |  . S SPNFTYPE=SPNFFIM
 | 
|---|
| 45 |  . Q
 | 
|---|
| 46 |  ;I $D(IOF) W @IOF  ;commented out 8/1/02
 | 
|---|
| 47 |  Q
 | 
|---|
| 48 | ADD ; *** Add a record to the Outcomes file (#154.1)
 | 
|---|
| 49 |  ;K DIR S DIR("A")="Enter a New Record Date : ",DIR(0)="DAO^:NOW"
 | 
|---|
| 50 |  ;D DATES^SPNLKUPC  ;Date range set up of dir(0) set above as saftey
 | 
|---|
| 51 |  ;D ^DIR
 | 
|---|
| 52 |  ;I '+Y K DIR,Y S SPNFEXIT=1 Q
 | 
|---|
| 53 |  ;S SPNDATE=Y
 | 
|---|
| 54 |  ;K DD,DIC,DINUM,DO
 | 
|---|
| 55 |  ;S SPNFD0=-1
 | 
|---|
| 56 |  ;S DIC="^SPNL(154.1,",DIC(0)="L"
 | 
|---|
| 57 |  ;S DLAYGO=154.1,X=SPNFDFN
 | 
|---|
| 58 |  ;D FILE^DICN W ! S SPNFD0=+Y
 | 
|---|
| 59 |  ;K DA,DIE,DR
 | 
|---|
| 60 |  ;I $G(SPNSCOR)="" S SPNSCOR=""
 | 
|---|
| 61 |  ;S DIE="^SPNL(154.1,",DA=SPNFD0
 | 
|---|
| 62 |  ;S DR=".02///^S X="_SPNFTYPE_";.04///"_SPNDATE_";.021///"_SPNSCOR_";.023///"_$$EN^SPNMAIN(DUZ)_";1001///"_SPNCDT
 | 
|---|
| 63 |  ;D ^DIE
 | 
|---|
| 64 |  Q
 | 
|---|
| 65 |  ;
 | 
|---|
| 66 | EDIT ; *** Edit a record in the Outcomes file (#154.1)
 | 
|---|
| 67 |  I $G(SPNFD0)="" S SPNFEXIT=1 Q
 | 
|---|
| 68 |  I $P($G(^SPNL(154.1,+SPNFD0,0)),U)'>0 Q
 | 
|---|
| 69 |  L +^SPNL(154.1,SPNFD0):0 I '$T D  Q
 | 
|---|
| 70 |  . W !!?5,"Another user is editing this record."
 | 
|---|
| 71 |  . W !?5,"Please try again later.",$C(7)
 | 
|---|
| 72 |  . Q
 | 
|---|
| 73 |  K DA,DDSFILE,DDSPAGE,DDSPARAM,DR,DTOUT
 | 
|---|
| 74 |  S DDSFILE="^SPNL(154.1,",DA=SPNFD0
 | 
|---|
| 75 |  S DR="["_$P($P($T(SCREEN+SPNFTYPE),";;",2),U)_"]"
 | 
|---|
| 76 |  S DDSPARM="C" D ^DDS
 | 
|---|
| 77 |  ;if its a new record and the user did not save the screen delete stub
 | 
|---|
| 78 |  I $G(SPNNEW)="YES" I $G(DDSCHANG)="" D
 | 
|---|
| 79 |  .S DIK="^SPNL(154.1,",DA=SPNFD0
 | 
|---|
| 80 |  .D ^DIK
 | 
|---|
| 81 |  .S SPNEXIT=1
 | 
|---|
| 82 |  .Q
 | 
|---|
| 83 |  K DDSPARM,CNT,SPNLTRIG,DR
 | 
|---|
| 84 |  L -^SPNL(154.1,SPNFD0)
 | 
|---|
| 85 |  I $P($G(^SPNL(154.1,SPNFD0,0)),U,4)'>0 D
 | 
|---|
| 86 |  . S DIK="^SPNL(154.1,",DA=SPNFD0
 | 
|---|
| 87 |  . D ^DIK
 | 
|---|
| 88 |  . Q
 | 
|---|
| 89 |  I $D(DTOUT) Q
 | 
|---|
| 90 |  I $D(DIMSG) W !!,"The screen-based entry process has failed!!",! Q
 | 
|---|
| 91 |  I SPNFTYPE<3,$D(^SPNL(154.1,SPNFD0,0))#2 D SCORE^SPNFEDT2(SPNFD0)
 | 
|---|
| 92 |  ;to close episodes
 | 
|---|
| 93 |  I SPNEXIT'=1 I $G(SPNCLOSE)'="" I SPNCLOSE=1 D CLOSE^SPNCTCLS S SPNXMIT=1
 | 
|---|
| 94 |  ;sets up care end date on closing outcome record just added
 | 
|---|
| 95 |  I SPNEXIT'=1 I $G(SPNCLOSE)'="" I SPNCLOSE=1 I $P($G(^SPNL(154.1,SPNFD0,8)),U,2)="" S $P(^SPNL(154.1,SPNFD0,8),U,2)=SPNDATE
 | 
|---|
| 96 | HL7 ;
 | 
|---|
| 97 |  ;this tag is to call the hl7 interface
 | 
|---|
| 98 |  ;      spnxmit is set in spnctcls
 | 
|---|
| 99 |  ;       spnxmit=0 just transmit the one record in the group
 | 
|---|
| 100 |  ;       spnxmit=1 transmit all in the group (the group was closed)
 | 
|---|
| 101 |  ;
 | 
|---|
| 102 |  I $G(SPNXMIT)="" S SPNXMIT=0
 | 
|---|
| 103 |  I $G(DDSCHANG)=1 I $G(^SPNL(154.1,SPNFD0,0))]"" D
 | 
|---|
| 104 |  .D CHK^SPNHL71(SPNFD0)
 | 
|---|
| 105 |  .D EXIT^SPNHL7
 | 
|---|
| 106 |  .Q
 | 
|---|
| 107 |  I SPNXMIT=1 D
 | 
|---|
| 108 |  .S SPNA=0 F  S SPNA=$O(^TMP($J,SPNA)) Q:SPNA=""  S SPNB=0 S SPNB=$O(^TMP($J,SPNA,SPNB)) Q:SPNB=""  S SPNC=0 S SPNC=$O(^TMP($J,SPNA,SPNB,SPNC)) Q:SPNC=""  D
 | 
|---|
| 109 |  ..S SPNFD0=$P($G(^TMP($J,SPNA,SPNB,SPNC)),U,1)
 | 
|---|
| 110 |  ..D CHK^SPNHL71(SPNFD0)
 | 
|---|
| 111 |  ..D EXIT^SPNHL7
 | 
|---|
| 112 |  I SPNCT<3 D ^SPNOGRDA  ;display template grid routines INPAT AND OUTPT ONLY
 | 
|---|
| 113 |  Q
 | 
|---|
| 114 |  ;
 | 
|---|
| 115 | SCREEN ; This is a list of what type goes to what Screenman screens.
 | 
|---|
| 116 |  ;;SPNLP FUN MES^1 - Self Report of Function
 | 
|---|
| 117 |  ;;SPNLP FIM FM1^2 - FIM
 | 
|---|
| 118 |  ;;SPNLP ASIA MES^3 - ASIA
 | 
|---|
| 119 |  ;;SPNLP CHART FM1^4 - CHART
 | 
|---|
| 120 |  ;;SPNLP FAM FM1^5 - FAM
 | 
|---|
| 121 |  ;;SPNLP DIENER FM1^6 - DIENER
 | 
|---|
| 122 |  ;;SPNLP DUSOI FM1^7 - DUSOI
 | 
|---|
| 123 |  ;;SPNLP MS FM1^8 - Multiple Sclerosis
 | 
|---|
| 124 |  Q
 | 
|---|