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

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

initial load of WorldVistAEHR

File size: 6.3 KB
Line 
1PXUTLSCC ;ISL/dee,ISA/KWP - Validates and corrects the Service Connected Conditions ;7/23/96
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**74,107,111,130**;Aug 12, 1996
3 Q
4 ;
5SCC(PXUPAT,PXUDT,PXUHLOC,PXUTLVST,PXUIN,PXUOUT,PXUERR) ;
6 ;+Input Parameters:
7 ;+ PXUPAT IEN of patient
8 ;+ PXUDT date and time of the encounter
9 ;+ PXUHLOC Hospital Location of the enocunter
10 ;+ PXUTLVST (optional) pointer to the visit that is being used
11 ;+ PXUIN service connected^agent orange^ionizing radiation
12 ;+ ^enviromental contaminants^military sexual trauma
13 ;+ ^head and/or neck cancer
14 ;+ where 1 ::= yes, 0 ::= no, null ::= n/a
15 ;+
16 ;+Output Parameters:
17 ;+ PXUOUT this is PXUIN corrected so that the invalid answers
18 ;+ are changed to null
19 ;+ PXUERR this is a six piece value one for each condition as follows:
20 ;+ 1 ::= should be yes or no, but it is null
21 ;+ 0 ::= no error
22 ;+ -1 ::= not valued value
23 ;+ -2 ::= value must be null
24 ;+ -3 ::= must be null because SC is yes
25 ;
26 N PXUITEM,PXUPSCC,PXUSC,PXUAO,PXUIR,PXUEC,PXUMST,PXUHNC
27 D SCCOND(PXUPAT,PXUDT,PXUHLOC,$G(PXUTLVST),.PXUPSCC) ;Set up array of the patients SCC
28 S PXUOUT=PXUIN
29 S PXUERR="0^0^0^0^0^0^0"
30 S PXUSC=$P(PXUIN,"^",1)
31 I '(PXUSC=1!(PXUSC=0)!(PXUSC="")) S $P(PXUERR,"^",1)=-1 S $P(PXUOUT,"^",1)=""
32 E I PXUSC="" D ;it is ok
33 . I $P(PXUPSCC("SC"),"^",1) S $P(PXUERR,"^",1)=1,$P(PXUOUT,"^",1)=$P(PXUPSCC("SC"),"^",2) ;should have had a value
34 E I PXUSC]"" D
35 . I '$P(PXUPSCC("SC"),"^",1) S $P(PXUERR,"^",1)=-2 S $P(PXUOUT,"^",1)="" ;it must be null
36 . E ;it is ok
37 S PXUSC=$P(PXUOUT,"^",1)
38 S PXUAO=$P(PXUIN,"^",2)
39 I '(PXUAO=1!(PXUAO=0)!(PXUAO="")) S $P(PXUERR,"^",2)=-1 S $P(PXUOUT,"^",2)=""
40 E I PXUAO="" D ;it is ok
41 . I $P(PXUPSCC("AO"),"^",1),'PXUSC S $P(PXUERR,"^",2)=1,$P(PXUOUT,"^",2)=$P(PXUPSCC("AO"),"^",2) ;should have had a value
42 E I PXUAO]"" D
43 . I '$P(PXUPSCC("AO"),"^",1) S $P(PXUERR,"^",2)=-2 S $P(PXUOUT,"^",2)="" ;it must be null
44 . E I PXUSC,PXUAO]"" S $P(PXUERR,"^",2)=-3 S $P(PXUOUT,"^",2)="" ;it is SC so it must be null
45 . ;E ;it is ok
46 S PXUIR=$P(PXUIN,"^",3)
47 I '(PXUIR=1!(PXUIR=0)!(PXUIR="")) S $P(PXUERR,"^",3)=-1 S $P(PXUOUT,"^",3)=""
48 E I PXUIR="" D ;it is ok
49 . I $P(PXUPSCC("IR"),"^",1),'PXUSC S $P(PXUERR,"^",3)=1,$P(PXUOUT,"^",3)=$P(PXUPSCC("IR"),"^",2) ;should have had a value
50 E I PXUIR]"" D
51 . I '$P(PXUPSCC("IR"),"^",1) S $P(PXUERR,"^",3)=-2 S $P(PXUOUT,"^",3)="" ;it must be null
52 . E I PXUSC,PXUIR]"" S $P(PXUERR,"^",3)=-3 S $P(PXUOUT,"^",3)="" ;it is SC so it must be null
53 . ;E ;it is ok
54 S PXUEC=$P(PXUIN,"^",4)
55 I '(PXUEC=1!(PXUEC=0)!(PXUEC="")) S $P(PXUERR,"^",4)=-1 S $P(PXUOUT,"^",4)=""
56 E I PXUEC="" D ;it is ok
57 . I $P(PXUPSCC("EC"),"^",1),'PXUSC S $P(PXUERR,"^",4)=1,$P(PXUOUT,"^",4)=$P(PXUPSCC("EC"),"^",2) ;should have had a value
58 E I PXUEC]"" D
59 . I '$P(PXUPSCC("EC"),"^",1) S $P(PXUERR,"^",4)=-2 S $P(PXUOUT,"^",4)="" ;it must be null
60 . E I PXUSC,PXUEC]"" S $P(PXUERR,"^",4)=-3 S $P(PXUOUT,"^",4)="" ;it is SC so it must be null
61 . ;E ;it is ok
62 S PXUMST=$P(PXUIN,"^",5) ;MST not dependent on SC question
63 I '(PXUMST=1!(PXUMST=0)!(PXUMST="")) S $P(PXUERR,"^",5)=-1 S $P(PXUOUT,"^",5)="" ;not valid data
64 E I PXUMST="" D ;it is ok
65 . I $P(PXUPSCC("MST"),"^",1) S $P(PXUERR,"^",5)=1,$P(PXUOUT,"^",5)=$P(PXUPSCC("MST"),"^",2) ;should have had a value
66 E I PXUMST]"" D
67 .I '$P(PXUPSCC("MST"),"^",1) S $P(PXUERR,"^",5)=-2 S $P(PXUOUT,"^",5)="" ;it must be null, not MST status
68 ;PX*1*111 - Add Head & Neck
69 S PXUHNC=$P(PXUIN,"^",6) ;HNC not dependent on SC question
70 I '(PXUHNC=1!(PXUHNC=0)!(PXUHNC="")) S $P(PXUERR,"^",6)=-1 S $P(PXUOUT,"^",6)="" ;not valid data
71 E I PXUHNC="" D ;it is ok
72 . I $P(PXUPSCC("HNC"),"^",1) S $P(PXUERR,"^",6)=1,$P(PXUOUT,"^",6)=$P(PXUPSCC("HNC"),"^",2) ;should have had a value
73 E I PXUHNC]"" D
74 .I '$P(PXUPSCC("HNC"),"^",1) S $P(PXUERR,"^",6)=-2 S $P(PXUOUT,"^",6)="" ;it must be null, not HNC status
75 S PXUCV=$P(PXUIN,"^",7) ;CV not dependent on SC question
76 I '(PXUCV=1!(PXUCV=0)!(PXUCV="")) S $P(PXUERR,"^",7)=-1 S $P(PXUOUT,"^",7)="" ;not valid data
77 E I PXUCV="" D ;it is ok
78 . I $P(PXUPSCC("CV"),"^",1) S $P(PXUERR,"^",7)=1,$P(PXUOUT,"^",7)=$P(PXUPSCC("CV"),"^",2) ;should have had a value
79 E I PXUCV]"" D
80 .I '$P(PXUPSCC("CV"),"^",1) S $P(PXUERR,"^",7)=-2 S $P(PXUOUT,"^",7)="" ;it must be null, not HNC status
81 Q
82 ;
83 ;
84SCCOND(DFN,APPDT,HLOC,VISIT,PXUDATA) ;Set up array of the patients
85 ; Service Connected Conditions
86 ;
87 ;Input Parameters:
88 ; DFN IEN of patient
89 ; APPDT date and time of the encounter
90 ; HLOC Hospital Location of the enocunter
91 ; VISIT (optional) The visit that is being used
92 ;
93 ;Output Parameters:
94 ; PXUDATA this is an array subscriped by "SC","AO","IR","EC","MST","HNC"
95 ; that contains to piece each
96 ; first: 1 if the condition can be answered
97 ; 0 if it should be null
98 ; second: the answer that Scheduling has if it has one
99 ; 1 ::= yes, 0 ::= no
100 ;
101 N CLASSIF,XX,OUTENC,CL,END,X0,MNE
102 S OUTENC=""
103 I VISIT>0 D
104 .S OUTENC=$O(^SCE("AVSIT",VISIT,0))
105 .I OUTENC>0,$P(^SCE(OUTENC,0),U,6) S OUTENC=$P(^SCE(OUTENC,0),U,6)
106 I 'VISIT D
107 .; Call if they have an appointment for this hospital location
108 .; and there is an Outpatient Encounter IEN;
109 .; returns the answer that scheduling has if any
110 .I $G(^DPT(DFN,"S",APPDT,0))]"" S XX=$G(^(0)) I +XX=HLOC D
111 ..S OUTENC=$P(XX,U,20)
112 .Q:OUTENC
113 .;
114 .; Find an Outpatient encouter matching DFN APPDT,HLOC if any.
115 .S OUTENC=$$EXAE^SDOE(DFN,APPDT,APPDT) D VEROUT
116 ;
117 ;Do Outpatient Encounter checks
118 I OUTENC D
119 .I '$D(^SCE(OUTENC,0)) S OUTENC="" Q
120 .S X0=^SCE(OUTENC,0),END=0 D ENCHK(OUTENC,X0)
121 .I END S OUTENC=""
122 I OUTENC>0 D CLOE^SDCO21(OUTENC,.CLASSIF)
123 ;
124 I '$G(OUTENC) D CL^SDCO21(DFN,APPDT,"",.CLASSIF)
125 S XX=0
126 F S XX=$O(^SD(409.41,XX)) Q:XX'>0 D
127 .S MNE=$P($G(^SD(409.41,XX,0)),U,7) I $D(MNE) D
128 ..S PXUDATA(MNE)=$D(CLASSIF(XX))_U_$P($G(CLASSIF(XX)),U,2)
129 Q
130ENCHK(ENCOWNTR,X0) ;Do outpatient encounter checks
131 N LOC,ORG,DFN
132 S DFN=$P(X0,U,2),LOC=$P(X0,U,4),ORG=$P(X0,U,8)
133 I $$REQ^SDM1A(+X0)'="CO" S END=1 Q ;Check MAS Check out date parameter
134 I ORG=1,'$$CLINIC^SDAMU(+LOC) S END=1 Q ;Screen for valid clinic
135 I "^1^2^"[("^"_ORG_"^"),$$INP^SDAM2(+DFN,+X0)="I" S END=1 Q ;Inpat chk
136 I $$EXOE^SDCOU2(ENCOWNTR) S END=1 Q ;Chk exempt Outpt classification
137 Q
138VEROUT ;verify a clinic
139 Q:'OUTENC
140 S CL=$$GETOE^SDOE(OUTENC) I $P(CL,U,4)'=HLOC S OUTENC=""
141 Q
142 ;
Note: See TracBrowser for help on using the repository browser.