[613] | 1 | ECMUTL1 ;ALB/ESD - Utilities for Multiple Dates/Mult Procs ;20 AUG 1997 13:56
|
---|
| 2 | ;;2.0; EVENT CAPTURE ;**5,10,15,13,17,23,41,42,50,54**;8 May 96
|
---|
| 3 | ;
|
---|
| 4 | ;
|
---|
| 5 | ASKPAT(ECPAT) ; Ask patient
|
---|
| 6 | ;
|
---|
| 7 | ; Input: ECPAT = patient DFN and name (passed by reference)
|
---|
| 8 | ;
|
---|
| 9 | ; Output: 1 = successful
|
---|
| 10 | ; -1 = unsuccessful (timed out or uparrowed)
|
---|
| 11 | ; -2 = unsuccessful (returned out)
|
---|
| 12 | ;
|
---|
| 13 | N DIC,DUOUT,DTOUT,Y,YY,ECDUP,ECI,ECUP
|
---|
| 14 | SEL ;
|
---|
| 15 | S (ECDUP,ECI)=0
|
---|
| 16 | S DIC="^DPT(",DIC(0)="QEAMZ"
|
---|
| 17 | S DIC("A")="Select Patient: "
|
---|
| 18 | D ^DIC
|
---|
| 19 | I Y=-1!($D(DUOUT))!($D(DTOUT)) G ASKPATQ
|
---|
| 20 | ;
|
---|
| 21 | ;- Create ECPLST local array to track duplicate names
|
---|
| 22 | I $O(^TMP("ECPLST",$J,0)) D
|
---|
| 23 | . F S ECI=$O(^TMP("ECPLST",$J,ECI)) Q:'ECI D
|
---|
| 24 | .. I +$G(^TMP("ECPLST",$J,ECI))=+Y D
|
---|
| 25 | ... S ECDUP=1
|
---|
| 26 | ... W !!,"Patient already selected. Please select another patient.",!
|
---|
| 27 | I ECDUP G SEL
|
---|
| 28 | I 'ECDUP D I $G(ECUP)="^" G SEL
|
---|
| 29 | . S ECPAT=+Y_"^"_$P(Y,"^",2)
|
---|
| 30 | . S YY=Y,DFN=+Y,ECUP="" D 2^VADPT S Y=YY I +VADM(6) D I ECUP="^" Q
|
---|
| 31 | .. ;NOIS MWV-0603-21781: line below changed by VMP.
|
---|
| 32 | .. W !!,"WARNING "_"[PATIENT DIED ON "_$P(VADM(6),U,2)_"] ",!!
|
---|
| 33 | .. R "Press Return to Continue or ^ to Deselect: ",ECUP:DTIME
|
---|
| 34 | . S ^TMP("ECPLST",$J,($S('$O(^TMP("ECPLST",$J,0)):1,1:$O(^TMP("ECPLST",$J,""),-1)+1)))=+Y_"^"_$P(Y,"^",2)
|
---|
| 35 | ASKPATQ Q $S((Y=-1)&($D(DUOUT)!$D(DTOUT)):-1,(Y=-1)&('$D(DUOUT))&('$D(DTOUT)):-2,1:1)
|
---|
| 36 | ;
|
---|
| 37 | ;
|
---|
| 38 | ASKORD() ; Ask ordering section
|
---|
| 39 | ;
|
---|
| 40 | ; Input: None
|
---|
| 41 | ;
|
---|
| 42 | ; Output: Ordering Section ien if successful
|
---|
| 43 | ; 0 if not successful
|
---|
| 44 | ;
|
---|
| 45 | N DIR,DIRUT,Y,ECORD
|
---|
| 46 | S ECORD=0
|
---|
| 47 | S DIR(0)="721,11",DIR("A")="Ordering Section"
|
---|
| 48 | D ^DIR
|
---|
| 49 | I Y=""!($D(DIRUT)) G ASKORDQ
|
---|
| 50 | S ECORD=+Y
|
---|
| 51 | ASKORDQ Q +ECORD
|
---|
| 52 | ;
|
---|
| 53 | ;
|
---|
| 54 | PCEDAT(ECUNIT,ECSCR,ECPCE) ;get needed PCE data
|
---|
| 55 | ;
|
---|
| 56 | ; input
|
---|
| 57 | ; ECUNIT = ien of DSS unit in file #724 (required)
|
---|
| 58 | ; ECSCR = ien of event code screen in file #720.3 (required);
|
---|
| 59 | ; but may be null value
|
---|
| 60 | ; ECPCE = array, passed by reference (required)
|
---|
| 61 | ;
|
---|
| 62 | ; output
|
---|
| 63 | ; ECPCE("CLIN") = associated clinic ien in file #44^clinic name
|
---|
| 64 | ; ECPCE("DX") = ien in file #80^icd code
|
---|
| 65 | ; ECPCE("DXS",) = array of multiple secondary diagnosis, where
|
---|
| 66 | ; = ecpce("dxs",n)=v n=dx code and v=dx ien
|
---|
| 67 | ; ECPCE("AO") = agent orange indicator
|
---|
| 68 | ; ECPCE("IR") = ionizing radiation indicator
|
---|
| 69 | ; ECPCE("ENV") = environmental contaminants indicator
|
---|
| 70 | ; ECPCE("SC") = service connected indicator (Y/N)
|
---|
| 71 | ; ECPCE("MST") = military sexual trauma indicator (Y/N)
|
---|
| 72 | ; ECPCE("HNC") = head/neck cancer indicator (Y/N)
|
---|
| 73 | ; ECPCE("CV") = combat veteran indicator (Y/N
|
---|
| 74 | ;
|
---|
| 75 | ; returns
|
---|
| 76 | ; ECOUT = if normal user input, then "0"
|
---|
| 77 | ; if user times-out, then "1"
|
---|
| 78 | ; if user up-arrows out, then "2"
|
---|
| 79 | ;
|
---|
| 80 | N SEND,ECOUT,EC4,EC4N,ECPCL,ECPCID,ECPCRD
|
---|
| 81 | S ECOUT=0
|
---|
| 82 | S ECSCR=+$G(ECSCR)
|
---|
| 83 | S SEND=$P(^ECD(+ECUNIT,0),"^",14)
|
---|
| 84 | I SEND="" S SEND="N"
|
---|
| 85 | S ECPCE("CLIN")="",ECPCE("DX")="",ECPCE("AO")="",ECPCE("IR")=""
|
---|
| 86 | S ECPCE("ENV")="",ECPCE("SC")="",ECPCE("MST")="",ECPCE("HNC")=""
|
---|
| 87 | S ECPCE("CV")=""
|
---|
| 88 | K ECPCE("DXS")
|
---|
| 89 | I "AO"[SEND D
|
---|
| 90 | .;- Don't write message if Send to PCE = "O" and patient is an inpatient
|
---|
| 91 | .I SEND="A"!(SEND="O"&(ECPCE("I/O")="O")) D
|
---|
| 92 | ..W !!,?5,"Please Note: The following prompt(s) cannot be by-passed with"
|
---|
| 93 | ..W !,?5,"<cr>, since the data is sent to PCE for workload reporting."
|
---|
| 94 | ..W !,?5,"If data cannot be provided, respond with ""^"". This will"
|
---|
| 95 | ..W !,?5,"remove the current patient from the selected patient list.",!
|
---|
| 96 | .D CLINIC I $G(ECOUT) D MSGCLN Q
|
---|
| 97 | .D ASKDX I $G(ECOUT) D MSGDX Q
|
---|
| 98 | .D VISIT I $G(ECOUT) D CLMSG Q
|
---|
| 99 | I ECSCR,(ECPCE("CLIN")=""),('$G(ECOUT)) D
|
---|
| 100 | .Q:'$D(^ECJ(ECSCR))
|
---|
| 101 | .I ECUNIT'=$P($P(^ECJ(ECSCR,0),"^",1),"-",2) Q
|
---|
| 102 | .S EC4=$P($G(^ECJ(ECSCR,"PRO")),"^",4) I +EC4 D
|
---|
| 103 | ..S EC4N=$P($G(^SC(+EC4,0)),"^",1)
|
---|
| 104 | ..D CLIN(EC4,.ECPCL)
|
---|
| 105 | ..S:ECPCL ECPCE("CLIN")=EC4_"^"_EC4N
|
---|
| 106 | ..S:'ECPCL ECPCE("CLIN")=""
|
---|
| 107 | Q ECOUT
|
---|
| 108 | ;
|
---|
| 109 | ASKDX ;ask dx
|
---|
| 110 | N ECDX,ECDXN,DTOUT,DUOUT,DIRUT,DIR,Y,EC4,ECDXS
|
---|
| 111 | S (ECDX,ECDXN)="",EC4=$P(ECPCE("CLIN"),U)
|
---|
| 112 | D PDX^ECUTL2 I ECOUT Q
|
---|
| 113 | S ECPCE("DX")=ECDX_"^"_ECDXN
|
---|
| 114 | D SDX^ECUTL2 I ECOUT Q
|
---|
| 115 | M ECPCE("DXS")=ECDXS
|
---|
| 116 | Q
|
---|
| 117 | ;
|
---|
| 118 | CLINIC ;get associated clinic
|
---|
| 119 | N ECDATA,EC4,EC4N,ECID,ECPCL,DTOUT,DUOUT,DIRUT,DIR,Y
|
---|
| 120 | Q:SEND="O"&(ECPCE("I/O")'="O")
|
---|
| 121 | F D Q:$G(ECOUT) Q:$G(ECPCL)
|
---|
| 122 | .K DA,DIR,DIRUT,DTOUT,DUOUT
|
---|
| 123 | .S (EC4,ECPCL)=0,EC4N=""
|
---|
| 124 | .S DIR(0)="721,26",DIR("A")="Associated Clinic",DIR("?")="An active clinic is required. Enter an active clinic or an ^ to exit"
|
---|
| 125 | .D ^DIR
|
---|
| 126 | .S:$D(DTOUT) ECOUT=1 S:$D(DUOUT) ECOUT=2
|
---|
| 127 | .Q:$G(ECOUT)
|
---|
| 128 | .I 'Y W !!?5,"You must enter an active clinic now.",! Q
|
---|
| 129 | .I Y S EC4=+Y,ECDATA=$G(^SC(+EC4,0)),ECID=$P(ECDATA,"^",7),EC4N=$P(ECDATA,"^",1)
|
---|
| 130 | .I $G(EC4) D CLIN(EC4,.ECPCL) I 'ECPCL D
|
---|
| 131 | ..W !!,?5,"The clinic you selected is inactive."
|
---|
| 132 | ..W !,?5,"Workload data cannot be sent to PCE for Event"
|
---|
| 133 | ..W !,?5,"Capture procedures without an active clinic."
|
---|
| 134 | .I 'ECPCL W !!?5,"You must enter an active clinic now.",!
|
---|
| 135 | Q:'$G(ECPCL)
|
---|
| 136 | S ECPCE("CLIN")=EC4_"^"_EC4N
|
---|
| 137 | Q
|
---|
| 138 | ;
|
---|
| 139 | ;
|
---|
| 140 | VISIT ;ask visit info
|
---|
| 141 | N ECFLG,ECCLFLDS,ECCLVAR,ECX,ECAO,ECIR,ECMST,ECMST,ECSC,ECZEC,ECHNC,ECCV
|
---|
| 142 | N ECMDT,ECY,ECMD,ECDT
|
---|
| 143 | Q:ECPCE("I/O")="I"
|
---|
| 144 | S (ECAO,ECIR,ECSC,ECZEC,ECX,ECMST,ECHNC,ECCV)="",ECY=0
|
---|
| 145 | F S ECY=$O(^TMP("ECMPIDX",$J,ECY)) Q:'ECY S ECMD=^(ECY) I $P(ECMD,U,2) D
|
---|
| 146 | .S ECMDT($P(ECMD,U,2))=""
|
---|
| 147 | S ECDT=$O(ECMDT(0)) ;use earliest date to evaluate classifications
|
---|
| 148 | ;
|
---|
| 149 | ;- Ask classification questions applicable to patient and file in #721
|
---|
| 150 | I $$ASKCLASS^ECUTL1(+$G(ECPAT),.ECCLFLDS,.ECOUT,SEND,ECPCE("I/O")),($O(ECCLFLDS(""))]"") D SETCLASS^ECUTL1(.ECCLFLDS)
|
---|
| 151 | Q:+$G(ECOUT)
|
---|
| 152 | ;
|
---|
| 153 | ;- Store classification variables into ECPCE array
|
---|
| 154 | F ECCLVAR="ECAO","ECIR","ECZEC","ECSC","ECMST","ECHNC","ECCV" I @($G(ECCLVAR))]"" S ECPCE($S($E(ECCLVAR,3,$L(ECCLVAR))'="ZEC":$E(ECCLVAR,3,$L(ECCLVAR)),1:"ENV"))=@ECCLVAR
|
---|
| 155 | Q
|
---|
| 156 | ;
|
---|
| 157 | ;
|
---|
| 158 | CLIN(EC4,ECPCL) ;check for active associated clinic
|
---|
| 159 | N ECPCID,ECPCRD
|
---|
| 160 | D CLIN^ECPCEU
|
---|
| 161 | Q
|
---|
| 162 | ;
|
---|
| 163 | ;
|
---|
| 164 | MSGDX ;if ecout & essential data missing, display msg
|
---|
| 165 | Q:SEND="N" Q:SEND="O"&(ECPCE("I/O")'="O")
|
---|
| 166 | I ECPCE("DX")="" D Q
|
---|
| 167 | .W !!,?5,"Please note that data cannot be sent to PCE"
|
---|
| 168 | .W !,?5,"for workload reporting without an ICD-9 code.",!
|
---|
| 169 | .D MSG1
|
---|
| 170 | Q
|
---|
| 171 | ;
|
---|
| 172 | MSGCLN ;if ecout & essential data missing, display msg
|
---|
| 173 | Q:SEND="N" Q:SEND="O"&(ECPCE("I/O")'="O")
|
---|
| 174 | I ECPCE("CLIN")="" D Q
|
---|
| 175 | .W !!,?5,"Please note that data cannot be sent to PCE for workload"
|
---|
| 176 | .W !,?5,"reporting without an active associated clinic.",!
|
---|
| 177 | .D MSG1
|
---|
| 178 | Q
|
---|
| 179 | ;
|
---|
| 180 | CLMSG ; Display classification questions error message
|
---|
| 181 | Q:SEND="N" Q:ECPCE("I/O")'="O"
|
---|
| 182 | W !!,?5,"Please note that data cannot be sent to PCE for workload reporting"
|
---|
| 183 | W !,?5,"unless the classification questions are answered.",!
|
---|
| 184 | D MSG1
|
---|
| 185 | Q
|
---|
| 186 | ;
|
---|
| 187 | ;
|
---|
| 188 | MSG1 ;Error message display
|
---|
| 189 | N DIR,Y
|
---|
| 190 | S DIR(0)="E",DIR("A")="Press RETURN to continue"
|
---|
| 191 | D ^DIR
|
---|
| 192 | W !
|
---|
| 193 | Q
|
---|
| 194 | ;
|
---|
| 195 | ;
|
---|
| 196 | INOUT(ECPTIEN,ECARRY) ; Determine inpatient/outpatient status
|
---|
| 197 | ;
|
---|
| 198 | N ECOUT
|
---|
| 199 | S ECOUT=0
|
---|
| 200 | S ECARRY=$G(ECARRY)
|
---|
| 201 | S ECPTIEN=+$G(ECPTIEN)
|
---|
| 202 | ;
|
---|
| 203 | ; - If ECARRY not defined, use ^TMP("ECMPIDX",$J)
|
---|
| 204 | S:(ECARRY="") ECARRY="^TMP(""ECMPIDX"",$J)"
|
---|
| 205 | ;
|
---|
| 206 | S ECPCE("I/O")=$$INOUTPT^ECUTL0(ECPTIEN,+$P(@ECARRY@(+$O(@ECARRY@(""),-1)),"^",2))
|
---|
| 207 | I ECPCE("I/O")="" D INOUTERR^ECUTL0
|
---|
| 208 | Q $S(+$G(ECOUT)=0:1,1:0)
|
---|
| 209 | ;
|
---|
| 210 | ;
|
---|
| 211 | ASKELIG(ECDSS,ECIO,ECPTIEN) ; Determine patient eligibility
|
---|
| 212 | ;
|
---|
| 213 | ; Input:
|
---|
| 214 | ; ECDSS - DSS Unit IEN
|
---|
| 215 | ; ECIO - Inpatient or Outpatient
|
---|
| 216 | ; ECPTIEN - DFN of Patient file (#2)
|
---|
| 217 | ;
|
---|
| 218 | ; Output:
|
---|
| 219 | ; ECPCE("ELIG") - containing patient eligibility
|
---|
| 220 | ;
|
---|
| 221 | N VAEL
|
---|
| 222 | S ECDSS=+$G(ECDSS)
|
---|
| 223 | S ECIO=$G(ECIO)
|
---|
| 224 | S ECPTIEN=+$G(ECPTIEN)
|
---|
| 225 | ;
|
---|
| 226 | ;- Get elig if Send to PCE="A" or Send to PCE="O" and outpatient
|
---|
| 227 | I $$CHKDSS^ECUTL0(+$G(ECDSS),ECIO) D
|
---|
| 228 | . ;
|
---|
| 229 | . ;- If dual elig, ask user to select otherwise use primary elig
|
---|
| 230 | . I $$MULTELG^ECUTL0(+$G(ECPTIEN)) S ECPCE("ELIG")=+$$ELGLST^ECUTL0
|
---|
| 231 | . E S ECPCE("ELIG")=+$G(VAEL(1))
|
---|
| 232 | Q
|
---|
| 233 | ;
|
---|
| 234 | REMOVE(ECPAT) ; Remove patient from selected patient list because required data missing
|
---|
| 235 | N DFN,ECI
|
---|
| 236 | S DFN=+ECPAT,ECI=0
|
---|
| 237 | F S ECI=$O(^TMP("ECPLST",$J,ECI)) Q:'ECI D
|
---|
| 238 | .I +$G(^TMP("ECPLST",$J,ECI))=DFN D
|
---|
| 239 | ..K ^TMP("ECPLST",$J,ECI),^TMP("ECMPTIDX",$J,ECI),^TMP("ECPAT",$J,DFN)
|
---|
| 240 | ..W !?5,"Patient deselected because required data missing.",!
|
---|
| 241 | ..D MSG1
|
---|
| 242 | Q
|
---|