PXCECCLS ;WASH/BDB,PKR - UPDATE ENCOUNTER SC/EI FROM DX SC/EI ;03/06/2023
;;1.0;PCE PATIENT CARE ENCOUNTER;**124,174,168,211,234**;Feb 12, 2004;Build 6
Q
;
VST(PXVIEN) ;
; PXVIEN Pointer to the Visit (#9000010)
;
;Loop over the V POV Service Connected and Environmental Indicator
;(SC/EI) fields and auto-populate the encounter level SC/EI based
;on the following rules:
;
;If the SC/EI for at least one ICD diagnosis is "Yes", the
;Encounter Level SC/EI will automatically be set to "Yes"
;regardless if the Encounter Level SC (or EI) was previously
;populated ("Yes", "No" or Null). Note: This presumes that a
;single ICD diagnosis with SC/EI determination of "Yes" makes the
;Encounter SC/EI determination "Yes".
;
;If the SC/EI for all ICD diagnosis are "No" the Encounter Level
;SC/EI will automatically be set to "No" regardless if the
;Encounter Level SC/EI was previously populated ("Yes", "No" or
;Null). Note: This presumes that an Encounter SC/EI cannot be
;"Yes" if all ICD diagnosis have an SC/EI determination of "No".
;
;If at least one ICD diagnosis is missing SC/EI determination and
;none of the other ICD diagnosis SC/EI determination is "Yes" do
;not change the SC/EI determination of the Encounter level. Note:
;This presumes that if one or more ICD diagnosis do not have an
;SC/EI determination then no inference can be made upon the
;Encounter Level SC determination. In addition if another package
;populates SC/EI directly do not overwrite that value in the case
;of incomplete data. In other words do not set the Encounter Level
;to Null.
;
;VARIABLE LIST TO AUTO POPULATE THE ENCOUNTER LEVEL SC/EI
;For each SC/EI in the PXSCEINW string:
; = 1 SC/EI Classification determined by the DX's is found to be "Yes"
; = 0 SC/EI Classification determined by the DX's is found to be "NO"
; =-1 SC/EI cannot be determined by the DX's =""
;
;Do not ask the SC/EI questions Edit flag for SC: SCEF, AO: AOEF,
;IR: IREF, EC:ECEF, MST: MSTEF , HNC: HNCEF , CV: CVEF,
;SHAD:SHADEF Used in Visit File Filing - See example below:
; VSIT("SCEF")=1 SC/EI
; Classification determined by the DX's - do not ask SC/EI
; VSIT("SCEF")=0
; SC/EI Classification undetermined by the DX's - ask SC/EI etc.
;
;====================
;If the Visit is missing the patient quit.
I $P($G(^AUPNVSIT(PXVIEN,0)),U,5)="" Q
N VSIT
S VSIT("IEN")=PXVIEN
S (VSIT("SCEF"),VSIT("AOEF"),VSIT("IREF"),VSIT("ECEF"))=0
S (VSIT("MSTEF"),VSIT("HNCEF"),VSIT("CVEF"),VSIT("SHADEF"))=0
I '$D(^AUPNVPOV("AD",PXVIEN)) D UPD^VSIT Q
;Initialize the SC/EI variables. The variables ending in A0 will be
;true if all if all the diagnosis entries are 0 for that variable.
N AO,CV,EC,HNC,IR,MST,SC,SHAD,VSITA0
N AOA0,CVA0,ECA0,HNCA0,IRA0,MSTA0,SCA0,SHADA0
N PXPOV,PXPOV800
S (AO,CV,EC,HNC,IR,MST,SC,SHAD)=""
S (AOA0,CVA0,ECA0,HNCA0,IRA0,MSTA0,SCA0,SHADA0)=1
;Loop over all V POV entries for the Visit.
S PXPOV=0
F S PXPOV=+$O(^AUPNVPOV("AD",PXVIEN,PXPOV)) Q:PXPOV=0 D
. S PXPOV800=$G(^AUPNVPOV(PXPOV,800))
. I SC'=1 S SC=$P(PXPOV800,U,1) I SC'=0 S SCA0=0
. I AO'=1 S AO=$P(PXPOV800,U,2) I AO'=0 S AOA0=0
. I IR'=1 S IR=$P(PXPOV800,U,3) I IR'=0 S IRA0=0
. I EC'=1 S EC=$P(PXPOV800,U,4) I EC'=0 S ECA0=0
. I MST'=1 S MST=$P(PXPOV800,U,5) I MST'=0 S MSTA0=0
. I HNC'=1 S HNC=$P(PXPOV800,U,6) I HNC'=0 S HNCA0=0
. I CV'=1 S CV=$P(PXPOV800,U,7) I CV'=0 S CVA0=0
. I SHAD'=1 S SHAD=$P(PXPOV800,U,8) I SHAD'=0 S SHADA0=0
S (VSIT("SCEF"),VSIT("AOEF"),VSIT("IREF"),VSIT("ECEF"))=0
S (VSIT("MSTEF"),VSIT("HNCEF"),VSIT("CVEF"),VSIT("SHADEF"))=0
I (SC=1)!(SCA0=1) S VSIT("SC")=SC,VSIT("SCEF")=1
I (AO=1)!(AOA0=1) S VSIT("AO")=AO,VSIT("AOEF")=1
I (IR=1)!(IRA0=1) S VSIT("IR")=IR,VSIT("IREF")=1
I (EC=1)!(ECA0=1) S VSIT("EC")=EC,VSIT("ECEF")=1
I (MST=1)!(MSTA0=1) S VSIT("MST")=MST,VSIT("MSTEF")=1
I (HNC=1)!(HNCA0=1) S VSIT("HNC")=HNC,VSIT("HNCEF")=1
I (CV=1)!(CVA0=1) S VSIT("CV")=CV,VSIT("CVEF")=1
I (SHAD=1)!(SHADA0=1) S VSIT("SHAD")=SHAD,VSIT("SHADEF")=1
I $G(VSIT("SC"))=1 S (VSIT("AO"),VSIT("IR"),VSIT("EC"))="@"
D UPD^VSIT
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXCECCLS 4166 printed Oct 16, 2024@18:28:36 Page 2
PXCECCLS ;WASH/BDB,PKR - UPDATE ENCOUNTER SC/EI FROM DX SC/EI ;03/06/2023
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**124,174,168,211,234**;Feb 12, 2004;Build 6
+2 QUIT
+3 ;
VST(PXVIEN) ;
+1 ; PXVIEN Pointer to the Visit (#9000010)
+2 ;
+3 ;Loop over the V POV Service Connected and Environmental Indicator
+4 ;(SC/EI) fields and auto-populate the encounter level SC/EI based
+5 ;on the following rules:
+6 ;
+7 ;If the SC/EI for at least one ICD diagnosis is "Yes", the
+8 ;Encounter Level SC/EI will automatically be set to "Yes"
+9 ;regardless if the Encounter Level SC (or EI) was previously
+10 ;populated ("Yes", "No" or Null). Note: This presumes that a
+11 ;single ICD diagnosis with SC/EI determination of "Yes" makes the
+12 ;Encounter SC/EI determination "Yes".
+13 ;
+14 ;If the SC/EI for all ICD diagnosis are "No" the Encounter Level
+15 ;SC/EI will automatically be set to "No" regardless if the
+16 ;Encounter Level SC/EI was previously populated ("Yes", "No" or
+17 ;Null). Note: This presumes that an Encounter SC/EI cannot be
+18 ;"Yes" if all ICD diagnosis have an SC/EI determination of "No".
+19 ;
+20 ;If at least one ICD diagnosis is missing SC/EI determination and
+21 ;none of the other ICD diagnosis SC/EI determination is "Yes" do
+22 ;not change the SC/EI determination of the Encounter level. Note:
+23 ;This presumes that if one or more ICD diagnosis do not have an
+24 ;SC/EI determination then no inference can be made upon the
+25 ;Encounter Level SC determination. In addition if another package
+26 ;populates SC/EI directly do not overwrite that value in the case
+27 ;of incomplete data. In other words do not set the Encounter Level
+28 ;to Null.
+29 ;
+30 ;VARIABLE LIST TO AUTO POPULATE THE ENCOUNTER LEVEL SC/EI
+31 ;For each SC/EI in the PXSCEINW string:
+32 ; = 1 SC/EI Classification determined by the DX's is found to be "Yes"
+33 ; = 0 SC/EI Classification determined by the DX's is found to be "NO"
+34 ; =-1 SC/EI cannot be determined by the DX's =""
+35 ;
+36 ;Do not ask the SC/EI questions Edit flag for SC: SCEF, AO: AOEF,
+37 ;IR: IREF, EC:ECEF, MST: MSTEF , HNC: HNCEF , CV: CVEF,
+38 ;SHAD:SHADEF Used in Visit File Filing - See example below:
+39 ; VSIT("SCEF")=1 SC/EI
+40 ; Classification determined by the DX's - do not ask SC/EI
+41 ; VSIT("SCEF")=0
+42 ; SC/EI Classification undetermined by the DX's - ask SC/EI etc.
+43 ;
+44 ;====================
+45 ;If the Visit is missing the patient quit.
+46 IF $PIECE($GET(^AUPNVSIT(PXVIEN,0)),U,5)=""
QUIT
+47 NEW VSIT
+48 SET VSIT("IEN")=PXVIEN
+49 SET (VSIT("SCEF"),VSIT("AOEF"),VSIT("IREF"),VSIT("ECEF"))=0
+50 SET (VSIT("MSTEF"),VSIT("HNCEF"),VSIT("CVEF"),VSIT("SHADEF"))=0
+51 IF '$DATA(^AUPNVPOV("AD",PXVIEN))
DO UPD^VSIT
QUIT
+52 ;Initialize the SC/EI variables. The variables ending in A0 will be
+53 ;true if all if all the diagnosis entries are 0 for that variable.
+54 NEW AO,CV,EC,HNC,IR,MST,SC,SHAD,VSITA0
+55 NEW AOA0,CVA0,ECA0,HNCA0,IRA0,MSTA0,SCA0,SHADA0
+56 NEW PXPOV,PXPOV800
+57 SET (AO,CV,EC,HNC,IR,MST,SC,SHAD)=""
+58 SET (AOA0,CVA0,ECA0,HNCA0,IRA0,MSTA0,SCA0,SHADA0)=1
+59 ;Loop over all V POV entries for the Visit.
+60 SET PXPOV=0
+61 FOR
SET PXPOV=+$ORDER(^AUPNVPOV("AD",PXVIEN,PXPOV))
if PXPOV=0
QUIT
Begin DoDot:1
+62 SET PXPOV800=$GET(^AUPNVPOV(PXPOV,800))
+63 IF SC'=1
SET SC=$PIECE(PXPOV800,U,1)
IF SC'=0
SET SCA0=0
+64 IF AO'=1
SET AO=$PIECE(PXPOV800,U,2)
IF AO'=0
SET AOA0=0
+65 IF IR'=1
SET IR=$PIECE(PXPOV800,U,3)
IF IR'=0
SET IRA0=0
+66 IF EC'=1
SET EC=$PIECE(PXPOV800,U,4)
IF EC'=0
SET ECA0=0
+67 IF MST'=1
SET MST=$PIECE(PXPOV800,U,5)
IF MST'=0
SET MSTA0=0
+68 IF HNC'=1
SET HNC=$PIECE(PXPOV800,U,6)
IF HNC'=0
SET HNCA0=0
+69 IF CV'=1
SET CV=$PIECE(PXPOV800,U,7)
IF CV'=0
SET CVA0=0
+70 IF SHAD'=1
SET SHAD=$PIECE(PXPOV800,U,8)
IF SHAD'=0
SET SHADA0=0
End DoDot:1
+71 SET (VSIT("SCEF"),VSIT("AOEF"),VSIT("IREF"),VSIT("ECEF"))=0
+72 SET (VSIT("MSTEF"),VSIT("HNCEF"),VSIT("CVEF"),VSIT("SHADEF"))=0
+73 IF (SC=1)!(SCA0=1)
SET VSIT("SC")=SC
SET VSIT("SCEF")=1
+74 IF (AO=1)!(AOA0=1)
SET VSIT("AO")=AO
SET VSIT("AOEF")=1
+75 IF (IR=1)!(IRA0=1)
SET VSIT("IR")=IR
SET VSIT("IREF")=1
+76 IF (EC=1)!(ECA0=1)
SET VSIT("EC")=EC
SET VSIT("ECEF")=1
+77 IF (MST=1)!(MSTA0=1)
SET VSIT("MST")=MST
SET VSIT("MSTEF")=1
+78 IF (HNC=1)!(HNCA0=1)
SET VSIT("HNC")=HNC
SET VSIT("HNCEF")=1
+79 IF (CV=1)!(CVA0=1)
SET VSIT("CV")=CV
SET VSIT("CVEF")=1
+80 IF (SHAD=1)!(SHADA0=1)
SET VSIT("SHAD")=SHAD
SET VSIT("SHADEF")=1
+81 IF $GET(VSIT("SC"))=1
SET (VSIT("AO"),VSIT("IR"),VSIT("EC"))="@"
+82 DO UPD^VSIT
+83 QUIT
+84 ;