source: WorldVistAEHR/trunk/r/PCE_PATIENT_CARE_ENCOUNTER-AUTN-EFDP-PX-VSIT--PXRM/PXCECCLS.m@ 1608

Last change on this file since 1608 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.9 KB
Line 
1PXCECCLS ;WASH/BDB - UPDATE ENCOUNTER SC/EI FROM DX SC/EI ;5/18/05 1:31pm
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**124,174**;Feb 12, 2004
3 Q
4 ;
5VST(PXVIEN) ;
6 ; VISITIEN Pointer to the Visit (#9000010)
7 ; Loop over the diagnoses SC/EI, auto-populate the encounter level
8 ; SC/EI based on the following rule:
9 ;
10 ; If the SC/EI for at least one ICD-9 is "Yes"the Encounter Level
11 ; SC/EI will automatically be set to "Yes" regardless if the
12 ; Encounter Level SC (or EI) was previously populated ("Yes", "No" or Null).
13 ; Note: This presumes that a single ICD-9 with SC/EI determination of "Yes"
14 ; makes the Encounter SC/EI determination "Yes"
15 ;
16 ; If the SC/EI for all ICD-9s are "No" the Encounter Level SC/EI will
17 ; automatically be set to "No" regardless if the Encounter Level SC/EI
18 ; was previously populated ("Yes", "No" or Null).
19 ; Note: This presumes that an Encounter SC/EI can not be "Yes" if all
20 ; ICD-9s have an SC/EI determination of "No".
21 ;
22 ; If at least one ICD-9 is missing SC/EI determination and none of the
23 ; other ICD-9s SC/EI determination is "Yes" do not change the SC/EI
24 ; determination of the Encounter level.
25 ; Note: This presumes that if one or more ICD-9s do not have an SC/EI
26 ; determination then no inference can be made upon the Encounter Level SC
27 ; determination. In addition if another package populates SC/EI
28 ; directly do not overwrite that value in the case of incomplete
29 ; data. In other words do not set the Encounter Level to Null.
30 ;
31 ; VARIABLE LIST TO AUTO POPULATE THE ENCOUNTER LEVEL SC/EI
32 ; For each SC/EI in the PXSCEINW string:
33 ; =1 SC/EI Classification determined by the DX's is found to be "Yes"
34 ; =0 SC/EI Classification determined by the DX's is found to be "NO"
35 ; =-1 SC/EI can not be determined by the DX's
36 ; ="" Do not ask the SC/EI questions
37 ;
38 ; Edit flag for SC: SCEF, AO: AOEF, IR: IREF, EC:ECEF, MST: MSTEF, HNC: HNCEF
39 ; , CV: CVEF - Used in Visit File Filing - See ^VSITFLD
40 ; example below
41 ; VIST("SCEF")=1 SC/EI Classification determined by the DX's - do not ask SC/EI
42 ; VIST("SCEF")=0 SC/EI Classification undetermined by the DX's - ask SC/EI
43 ; etc.
44 ;
45 N PX0,PXDFN,PXDT,PXCL,PXPOV,VSIT,PXDFN,PXSCEINW,PXSCEI,PXPOV800
46 S PXSCEINW="^^^^^^"
47 ; Set encounter data in ^TMP
48 D ENCEVENT^PXKENC(PXVIEN)
49 ; Get classifications
50 S PXDFN=$P($G(^TMP("PXKENC",$J,PXVIEN,"VST",PXVIEN,0)),U,5)
51 Q:'PXDFN
52 ;Loop over DX's
53 S PXPOV="" F S PXPOV=$O(^TMP("PXKENC",$J,PXVIEN,"POV",PXPOV)) Q:'PXPOV D
54 .S PXPOV800=$G(^(PXPOV,800))
55 .I '($P(PXSCEINW,U,1)="1") S:$P(PXPOV800,U,1)="1" $P(PXSCEINW,U,1)="1" I '($P(PXSCEINW,U,1)<0) S:$P(PXPOV800,U,1)="" $P(PXSCEINW,U,1)="-1" S:$P(PXPOV800,U,1)="0" $P(PXSCEINW,U,1)="0"
56 .I '($P(PXSCEINW,U,2)="1") S:$P(PXPOV800,U,2)="1" $P(PXSCEINW,U,2)="1" I '($P(PXSCEINW,U,2)<0) S:$P(PXPOV800,U,2)="" $P(PXSCEINW,U,2)="-1" S:$P(PXPOV800,U,2)="0" $P(PXSCEINW,U,2)="0"
57 .I '($P(PXSCEINW,U,3)="1") S:$P(PXPOV800,U,3)="1" $P(PXSCEINW,U,3)="1" I '($P(PXSCEINW,U,3)<0) S:$P(PXPOV800,U,3)="" $P(PXSCEINW,U,3)="-1" S:$P(PXPOV800,U,3)="0" $P(PXSCEINW,U,3)="0"
58 .I '($P(PXSCEINW,U,4)="1") S:$P(PXPOV800,U,4)="1" $P(PXSCEINW,U,4)="1" I '($P(PXSCEINW,U,4)<0) S:$P(PXPOV800,U,4)="" $P(PXSCEINW,U,4)="-1" S:$P(PXPOV800,U,4)="0" $P(PXSCEINW,U,4)="0"
59 .I '($P(PXSCEINW,U,5)="1") S:$P(PXPOV800,U,5)="1" $P(PXSCEINW,U,5)="1" I '($P(PXSCEINW,U,5)<0) S:$P(PXPOV800,U,5)="" $P(PXSCEINW,U,5)="-1" S:$P(PXPOV800,U,5)="0" $P(PXSCEINW,U,5)="0"
60 .I '($P(PXSCEINW,U,6)="1") S:$P(PXPOV800,U,6)="1" $P(PXSCEINW,U,6)="1" I '($P(PXSCEINW,U,6)<0) S:$P(PXPOV800,U,6)="" $P(PXSCEINW,U,6)="-1" S:$P(PXPOV800,U,6)="0" $P(PXSCEINW,U,6)="0"
61 .I '($P(PXSCEINW,U,7)="1") S:$P(PXPOV800,U,7)="1" $P(PXSCEINW,U,7)="1" I '($P(PXSCEINW,U,7)<0) S:$P(PXPOV800,U,7)="" $P(PXSCEINW,U,7)="-1" S:$P(PXPOV800,U,7)="0" $P(PXSCEINW,U,7)="0"
62 S VSIT("IEN")=PXVIEN
63 S VSIT("SCEF")=0,VSIT("AOEF")=0,VSIT("IREF")=0,VSIT("ECEF")=0,VSIT("MSTEF")=0,VSIT("HNCEF")=0,VSIT("CVEF")=0
64 S:$P(PXSCEINW,U,1)="0"!($P(PXSCEINW,U,1)="1") VSIT("SC")=$P(PXSCEINW,U,1),VSIT("SCEF")=1
65 S:$P(PXSCEINW,U,2)="0"!($P(PXSCEINW,U,2)="1") VSIT("AO")=$P(PXSCEINW,U,2),VSIT("AOEF")=1 S:$G(VSIT("SC"))=1 VSIT("AO")="@"
66 S:$P(PXSCEINW,U,3)="0"!($P(PXSCEINW,U,3)="1") VSIT("IR")=$P(PXSCEINW,U,3),VSIT("IREF")=1 S:$G(VSIT("SC"))=1 VSIT("IR")="@"
67 S:$P(PXSCEINW,U,4)="0"!($P(PXSCEINW,U,4)="1") VSIT("EC")=$P(PXSCEINW,U,4),VSIT("ECEF")=1 S:$G(VSIT("SC"))=1 VSIT("EC")="@"
68 S:$P(PXSCEINW,U,5)="0"!($P(PXSCEINW,U,5)="1") VSIT("MST")=$P(PXSCEINW,U,5),VSIT("MSTEF")=1
69 S:$P(PXSCEINW,U,6)="0"!($P(PXSCEINW,U,6)="1") VSIT("HNC")=$P(PXSCEINW,U,6),VSIT("HNCEF")=1
70 S:$P(PXSCEINW,U,7)="0"!($P(PXSCEINW,U,7)="1") VSIT("CV")=$P(PXSCEINW,U,7),VSIT("CVEF")=1
71 D UPD^VSIT
72 K ^TMP("PXKENC",$J)
73 Q
Note: See TracBrowser for help on using the repository browser.