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

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

initial load of WorldVistAEHR

File size: 7.3 KB
Line 
1PXAIVSTV ;ISL/JVS,ISA/KWP - VALIDATE THE VISIT DATA ;4/23/04 11:54am
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**9,15,19,74,111,116,130,124**;Aug 12, 1996
3 ;
4 ;
5 Q
6VALSCC ;--VALIDATE SERVICE CONNECTIVENESS
7 N ERR,ERR1
8 D SCC^PXUTLSCC($G(PXAA("PATIENT")),$G(PXAA("ENC D/T")),$G(PXAA("HOS LOC")),$G(PXAVISIT),$G(AFTER800),.AFTER8A,.ERR)
9 ;PX*1*111 - Add HNC
10 I $P(ERR,"^",1)=0,$P(ERR,"^",2)=0,$P(ERR,"^",3)=0,$P(ERR,"^",4)=0,$P(ERR,"^",5)=0,$P(ERR,"^",6)=0,$P(ERR,"^",7)=0 Q
11 S PXADI("DIALOG")=8390001.003
12 S PXAERRF=1
13 S PXAERR("1W")=$S($P(AFTER800,"^",1)']"":"NULL",1:$P(AFTER800,"^",1))
14 S PXAERR("2W")=$S($P(AFTER800,"^",2)']"":"NULL",1:$P(AFTER800,"^",2))
15 S PXAERR("3W")=$S($P(AFTER800,"^",3)']"":"NULL",1:$P(AFTER800,"^",3))
16 S PXAERR("4W")=$S($P(AFTER800,"^",4)']"":"NULL",1:$P(AFTER800,"^",4))
17 S PXAERR("5W")=$S($P(AFTER800,"^",5)']"":"NULL",1:$P(AFTER800,"^",5))
18 ;PX*1*111 - Add HNC
19 S PXAERR("16W")=$S($P(AFTER800,"^",6)']"":"NULL",1:$P(AFTER800,"^",6))
20 S PXAERR("19W")=$S($P(AFTER800,"^",7)']"":"NULL",1:$P(AFTER800,"^",7))
21 S ERR1=$P(ERR,"^",1),PXAERR("6W")=$S(ERR1=1:"Should be a YES or NO!, not NULL",ERR1=0:"No error",ERR1=-1:"Not a valid value",ERR1=-2:"Value must be NULL",ERR1=-3:"Must be NULL because Service Connected is yes",1:"")
22 S ERR1=$P(ERR,"^",2),PXAERR("7W")=$S(ERR1=1:"Should be a YES or NO!, not NULL",ERR1=0:"No error",ERR1=-1:"Not a valid value",ERR1=-2:"Value must be NULL",ERR1=-3:"Must be NULL because Service Connected is yes",1:"")
23 S ERR1=$P(ERR,"^",3),PXAERR("8W")=$S(ERR1=1:"Should be a YES or NO!, not NULL",ERR1=0:"No error",ERR1=-1:"Not a valid value",ERR1=-2:"Value must be NULL",ERR1=-3:"Must be NULL because Service Connected is yes",1:"")
24 S ERR1=$P(ERR,"^",4),PXAERR("9W")=$S(ERR1=1:"Should be a YES or NO!, not NULL",ERR1=0:"No error",ERR1=-1:"Not a valid value",ERR1=-2:"Value must be NULL",ERR1=-3:"Must be NULL because Service Connected is yes",1:"")
25 S ERR1=$P(ERR,"^",5),PXAERR("10W")=$S(ERR1=1:"Should be a YES or NO!, not NULL",ERR1=0:"No error",ERR1=-1:"Not a valid value",ERR1=-2:"Value must be NULL",ERR1=-3:"Must be NULL because Service Connected is yes",1:"")
26 ;PX*1*111 - Add HNC
27 S ERR1=$P(ERR,"^",6),PXAERR("17W")=$S(ERR1=1:"Should be a YES or NO!, not NULL",ERR1=0:"No error",ERR1=-1:"Not a valid value",ERR1=-2:"Value must be NULL",ERR1=-3:"Must be NULL because Service Connected is yes",1:"")
28 S ERR1=$P(ERR,"^",7),PXAERR("20W")=$S(ERR1=1:"Should be a YES or NO!, not NULL",ERR1=0:"No error",ERR1=-1:"Not a valid value",ERR1=-2:"Value must be NULL",ERR1=-3:"Must be NULL because Service Connected is yes",1:"")
29 S PXAERR("11W")=$S($P(AFTER8A,"^",1)']"":"NULL",1:$P(AFTER8A,"^",1))
30 S PXAERR("12W")=$S($P(AFTER8A,"^",2)']"":"NULL",1:$P(AFTER8A,"^",2))
31 S PXAERR("13W")=$S($P(AFTER8A,"^",3)']"":"NULL",1:$P(AFTER8A,"^",3))
32 S PXAERR("14W")=$S($P(AFTER8A,"^",4)']"":"NULL",1:$P(AFTER8A,"^",4))
33 S PXAERR("15W")=$S($P(AFTER8A,"^",5)']"":"NULL",1:$P(AFTER8A,"^",5))
34 ;PX*1*111 - Add HNC
35 S PXAERR("18W")=$S($P(AFTER8A,"^",6)']"":"NULL",1:$P(AFTER8A,"^",6))
36 S PXAERR("21W")=$S($P(AFTER8A,"^",7)']"":"NULL",1:$P(AFTER8A,"^",7))
37 D ERR^PXAI K PXAERRF
38 Q
39 ;
40VAL ;--VALIDATE ENOUGH DATA
41 ;
42 ;---Is the visit sent TO US valid?
43 I $G(PXAVISIT) D Q:$D(STOP)
44 .I '$D(^AUPNVSIT(PXAVISIT,0)) D Q:$G(STOP)
45 ..S STOP=1
46 ..S PXAERRF=1
47 ..S PXADI("DIALOG")=8390001.001
48 ..S PXAERR(11)=$G(PXAVISIT)
49 ..S PXAERR(12)="The value that was sent to us is not a valid visit in the VISIT file # 9000010. The Patients name will be derived from the visit file and could cause the data to be given to the wrong patient if not correct."
50 ..S PXAERR(13)="If the correct VISIT isn't known, set the 'ENCOUNTER' array and we will look it up or create a correct one. Setting both at the same time will only add confusion as to what data is correct."
51 Q:$G(PXAVISIT)
52 ;
53 ;----Missing a date and time of visit
54 I $G(PXAA("ENC D/T"))']"" D Q:$G(STOP)
55 .S STOP=1 ;--USED TO STOP DO LOOP
56 .S PXAERRF=1 ;--FLAG INDICATES THERE IS AN ERR
57 .S PXADI("DIALOG")=8390001.001
58 .S PXAERR(9)="ENC D/T"
59 .S PXAERR(11)=$G(PXAA("ENC D/T"))
60 .S PXAERR(12)="You are missing the date and time of the visit in FileManager internal format."
61 ;
62 ;----Missing Time and not Historical Visit
63 I $L($G(PXAA("ENC D/T")),".")=1,$G(PXAA("SERVICE CATEGORY"))'="E" D
64 .S STOP=1 ;--USED TO STOP DO LOOP
65 .S PXAERRF=1 ;--FLAG INDICATES THERE IS AN ERR
66 .S PXADI("DIALOG")=8390001.001
67 .S PXAERR(9)="ENC D/T"
68 .S PXAERR(11)=$G(PXAA("ENC D/T"))
69 .S PXAERR(12)="You are missing the TIME of the visit in FileManager internal format. Unless this is an HISTORICAL encounter, you must have the time."
70 ;
71 ;
72 ;
73 ;----MISSING a pointer to PATIENT/IHS FILE # 9000001
74 I $G(PXAA("PATIENT"))']"" D Q:$G(STOP)
75 .S STOP=1
76 .S PXAERRF=1
77 .S PXADI("DIALOG")=8390001.001
78 .S PXAERR(9)="PATIENT"
79 .S PXAERR(11)=$G(PXAA("PATIENT"))
80 .S PXAERR(12)="Missing a pointer to the PATIENT/IHS file #9000001"
81 ;
82 ;
83 ;----Not a pointer to the PATIENT/IHS file #9000001
84 I '$D(^AUPNPAT($G(PXAA("PATIENT")),0)) D Q:$G(STOP)
85 .S STOP=1
86 .S PXAERRF=1
87 .S PXADI("DIALOG")=8390001.001
88 .S PXAERR(9)="PATIENT"
89 .S PXAERR(11)=$G(PXAA("PATIENT"))
90 .S PXAERR(12)="This value is not a pointer to file PATIENT/IHS file # 9000001"
91 ;
92 ;---Missing required information
93 I $G(PXAA("OUTSIDE LOCATION"))']"",$G(PXAA("HOS LOC"))']"",$G(PXAA("SERVICE CATEGORY"))'="E" D Q:$G(STOP)
94 .S STOP=1
95 .S PXAERRF=1
96 .S PXADI("DIALOG")=8390001.001
97 .S PXAERR(9)="HOS LOC or OUTSIDE LOC"
98 .S PXAERR(11)="BOTH ENTRIES ARE NULL AND SERVICE CATEGORY IS NOT ""E"""
99 .S PXAERR(12)="The HOSPITAL LOCATION (pointer to the HOSPITAL LOCATION file #44 ) needs to be sent in order to create a visit."
100 ;
101 ;---not a pointer to hospital location file
102 I $D(PXAA("HOS LOC")) D Q:$G(STOP)
103 .I '$D(^SC($G(PXAA("HOS LOC")),0)) D Q:$G(STOP)
104 ..S STOP=1
105 ..S PXAERRF=1
106 ..S PXADI("DIALOG")=8390001.001
107 ..S PXAERR(9)="HOS LOC"
108 ..S PXAERR(11)=$G(PXAA("HOS LOC"))
109 ..S PXAERR(12)="This HOSPITAL LOCATION is not a pointer to the HOSPITAL LOCATION file #44"
110 ;---hospital location is the dispositioning location
111 ;Allow a dispositioning location to be used
112 ;I $D(PXAA("HOS LOC")) D Q:$G(STOP) ;PX*1.0*116
113 ;.I $D(^PX(815,1,"DHL","B",$G(PXAA("HOS LOC")))) D Q:$G(STOP)
114 ;..S STOP=1
115 ;..S PXAERRF=1
116 ;..S PXADI("DIALOG")=8390001.001
117 ;..S PXAERR(9)="HOS LOC"
118 ;..S PXAERR(11)=$G(PXAA("HOS LOC"))
119 ;..S PXAERR(12)="This HOSPITAL LOCATION is a dispositioning location and connot be used. Refer to entries in file#815 PCE PARAMETERS"
120 ;--Not a service category
121 I '$D(PXAA("SERVICE CATEGORY")) D Q:$G(STOP)
122 .S STOP=1
123 .S PXAERRF=1
124 .S PXADI("DIALOG")=8390001.001
125 .S PXAERR(9)="SERVICE CATEGORY"
126 .S PXAERR(11)=$G(PXAA("SERVICE CATEGORY"))
127 .S PXAERR(12)="SERVICE CATEGORY is a required field"
128 Q
129 ;
130VPTR ;---Is the visit sent TO US valid?
131 I $G(PXAVISIT) D Q:$D(STOP)
132 .I '$D(^AUPNVSIT(PXAVISIT,0)) D Q:$G(STOP)
133 ..S STOP=1
134 ..S PXAK=1
135 ..S PXAERRF=1
136 ..S PXADI("DIALOG")=8390001.001
137 ..S PXAERR(7)="ENCOUNTER"
138 ..S PXAERR(9)="GENERAL NATURE"
139 ..S PXAERR(11)=$G(PXAVISIT)
140 ..S PXAERR(12)="The value that was sent to us is not a valid visit in the VISIT file # 9000010. The Patients name will be derived from the visit file and could cause the data to be given to the wrong patient if not correct."
141 ..S PXAERR(13)="If the correct VISIT isn't known, set the 'ENCOUNTER' array and we will look it up or create a correct one. Setting both at the same time will only add confusion as to what data is correct."
142 Q:$G(PXAVISIT)
143 Q
Note: See TracBrowser for help on using the repository browser.