source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWPCE2.m@ 1042

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

revised back to 6/30/08 version

File size: 7.3 KB
Line 
1ORWPCE2 ; ISL/JM - wrap calls to PCE ;9/25/2001
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,85,109,116,173,195**;Dec 17, 1997
3GETSET(ORWLST,ORWFILE,ORWFIELD,ORWNULL) ;gets set of codes
4 ; ORWLST(n)=code^text for code
5 N ORWPCE,ORWPCEL,ORWPCEC,ORWPCELO,ORWPCEHI,ORWPCECD,ORWPCET
6 S ORWPCELO="abcdefghijklmnopqrstuvwxyz"
7 S ORWPCEHI="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
8 D FIELD^DID(ORWFILE,ORWFIELD,"","POINTER","ORWPCE","ORWPCE")
9 S ORWPCEL=$L(ORWPCE("POINTER"),";")-1
10 F ORWPCEC=1:1:ORWPCEL D
11 . S ORWPCECD=$P($P(ORWPCE("POINTER"),";",ORWPCEC),":",1)
12 . S ORWPCET=$P($P(ORWPCE("POINTER"),";",ORWPCEC),":",2)
13 . S ORWLST(ORWPCEC)=ORWPCECD_"^"_$E(ORWPCET)_$TR($E(ORWPCET,2,99),ORWPCEHI,ORWPCELO)
14 S:$G(ORWNULL) ORWLST(0)="@^(None selected)"
15 Q
16 ;
17IMMTYPE(ORWLST) ;get the list of active immunizations
18 N IEN,CNT,BINDEX S (IEN,CNT,BINDEX)=0
19 F S BINDEX=$O(^AUTTIMM("B",BINDEX)) Q:BINDEX']"" F S IEN=$O(^(BINDEX,IEN)) Q:'+IEN I $D(^AUTTIMM(IEN,0))#2,+$P(^(0),"^",7)=0 S CNT=CNT+1,ORWLST(CNT)=IEN_"^"_$P(^(0),"^")
20 Q
21 ;
22SKTYPE(ORWLST) ;get the list of active skin test
23 N IEN,CNT,BINDEX S (IEN,CNT,BINDEX)=0
24 F S BINDEX=$O(^AUTTSK("B",BINDEX)) Q:BINDEX']"" F S IEN=$O(^(BINDEX,IEN)) Q:'+IEN I $D(^AUTTSK(IEN,0))#2,+$P(^(0),"^",3)=0 S CNT=CNT+1,ORWLST(CNT)=IEN_"^"_$P(^(0),"^")
25 Q
26 ;
27EDTTYPE(ORWLST) ;get the list of active education topics
28 N IEN,CNT,BINDEX S (IEN,CNT,BINDEX)=0
29 F S BINDEX=$O(^AUTTEDT("B",BINDEX)) Q:BINDEX']"" F S IEN=$O(^(BINDEX,IEN)) Q:'+IEN I $D(^AUTTEDT(IEN,0))#2,+$P(^(0),"^",3)=0 S CNT=CNT+1,ORWLST(CNT)=IEN_"^"_$P(^(0),"^")
30 Q
31 ;
32HFTYPE(ORWLST,ADDCATS) ;get the list of active health factors
33 N IEN,CNT,BINDEX,REC
34 S (IEN,CNT,BINDEX)=0,ADDCATS=+$G(ADDCATS)
35 F S BINDEX=$O(^AUTTHF("B",BINDEX)) Q:BINDEX']"" D
36 .F S IEN=$O(^AUTTHF("B",BINDEX,IEN)) Q:'+IEN D
37 ..S REC=$G(^AUTTHF(IEN,0))
38 ..I +$P(REC,U,11) S REC=""
39 ..I 'ADDCATS,$P(REC,U,10)="C" S REC=""
40 ..I REC'="" D
41 ...S CNT=CNT+1,ORWLST(CNT)=IEN_U_$P(REC,U)
42 ...I ADDCATS S ORWLST(CNT)=ORWLST(CNT)_U_$P(REC,U,10)_U_$P(REC,U,3)
43 Q
44 ;
45EXAMTYPE(ORWLST) ;get the list of active exams
46 N IEN,CNT,BINDEX S (IEN,CNT,BINDEX)=0
47 F S BINDEX=$O(^AUTTEXAM("B",BINDEX)) Q:BINDEX']"" F S IEN=$O(^(BINDEX,IEN)) Q:'+IEN I $D(^AUTTEXAM(IEN,0))#2,+$P(^(0),"^",4)=0 S CNT=CNT+1,ORWLST(CNT)=IEN_"^"_$P(^(0),"^")
48 Q
49 ;
50TRTTYPE(ORWLST) ;get the list of active treatments
51 N IEN,CNT,BINDEX S (IEN,CNT,BINDEX)=0
52 F S BINDEX=$O(^AUTTTRT("B",BINDEX)) Q:BINDEX']"" F S IEN=$O(^(BINDEX,IEN)) Q:'+IEN I $D(^AUTTTRT(IEN,0))#2,+$P(^(0),"^",4)=0 S CNT=CNT+1,ORWLST(CNT)=IEN_"^"_$P(^(0),"^")
53 Q
54 ;
55ACTIVPRV(ORRETURN,ORWPROV,ORWDT) ;get if provider is active or not
56 S ORRETURN=$$ACTIVPRV^PXAPI(ORWPROV,ORWDT)
57 Q
58GETVISIT(VISIT,IEN,DFN,VSITSTR) ;Get the visit IEN
59 I +$G(IEN)<1 D I 1
60 .S VISIT=$$GETENC^PXAPI(DFN,$P(VSITSTR,";",2),$P(VSITSTR,";"))
61 E S VISIT=$P(^TIU(8925,IEN,0),U,3)
62 Q
63GAFOK(ORY) ; Returns true if all supporting MH GAF Code exists
64 S ORY=0
65 I $T(GAFHX^YSGAFAPI)'="",$T(ENT^YSGAFAP1)'="" S ORY=1
66 Q
67MHCLINIC(ORY,ORIEN) ; See if this is a mental health clinic
68 I $T(MHCLIN^SDUTL2)="" S ORY=1
69 E S ORY=$$MHCLIN^SDUTL2(ORIEN)
70 Q
71LOADGAF(ORY,ORINPUT) ; Retrieve GAF scores
72 D GAFHX^YSGAFAPI(.ORY,.ORINPUT)
73 Q
74SAVEGAF(ORY,ORINPUT) ; Save new GAF score
75 N ORDATA
76 D ENT^YSGAFAP1(.ORDATA,.ORINPUT)
77 S ORY=($G(ORDATA(1))="[DATA]")
78 Q
79FORCE(ORY,USER,LOC) ; Retrieve FORCE GUI PCE Entry for a given User/Location
80 N SRV,ORTMP,ORERR
81 S USER=$G(USER,DUZ)
82 S SRV=$P($G(^VA(200,USER,5)),U)
83 D GETLST^XPAR(.ORTMP,"USR^LOC.`"_$G(LOC)_"^SRV.`"_+$G(SRV)_"^DIV^SYS^PKG","ORWPCE FORCE PCE ENTRY","Q",.ORERR)
84 S ORY=+$P($G(ORTMP(1)),U,2)
85 Q
86HASCPT(ORY,ORLIST) ; Returns true if there are any mapped CPT Codes
87 N IEN,IDX,FOUND
88 S IDX=0
89 F S IDX=$O(ORLIST(IDX)) Q:'+IDX D
90 . S FOUND=0
91 . S IEN=$$FIND1^DIC(811.1,"","QX",ORLIST(IDX))
92 . I +IEN S FOUND=+$$GET1^DIQ(811.1,IEN,.05,"I")
93 . S ORY(IDX)=ORLIST(IDX)_"="_FOUND
94 Q
95ASKPCE(ORY,USER,LOC) ; Returns ORWPCE ASK ENCOUNTER UPDATE parameter value
96 N SRV,ORTMP,ORERR
97 S USER=$G(USER,DUZ)
98 S SRV=$P($G(^VA(200,USER,5)),U)
99 D GETLST^XPAR(.ORTMP,"USR^LOC.`"_$G(LOC)_"^SRV.`"_+$G(SRV)_"^DIV^SYS^PKG","ORWPCE ASK ENCOUNTER UPDATE","Q",.ORERR)
100 S ORY=+$P($G(ORTMP(1)),U,2)
101 Q
102GAFURL(URL) ;Returns the MH GAF Web Page URL
103 S URL=""
104 I $T(GAFURL^YTAPI5)'="" D
105 .N ORY
106 .D GAFURL^YTAPI5(.ORY)
107 .I $G(ORY(1))="[DATA]" S URL=$G(ORY(2))
108 Q
109MHTESTOK(ORY) ; Returns True if all supporting MH Test APIs exist
110 D GAFOK(.ORY)
111 I +ORY,+$G(DUZ),$T(SAVEIT^YTAPI1)'="",$T(PREVIEW^YTAPI4)'="",$T(SHOWALL^YTAPI3)'="",$T(LISTONE^YTAPI)'="",$T(MHS^PXRMRPCC)'="",$T(MHR^PXRMRPCC)'="",$T(MH^PXRMRPCC)'="" D
112 . N SRV
113 . S SRV=$P($G(^VA(200,DUZ,5)),U)
114 . S ORY=$$GET^XPAR(DUZ_";VA(200,^SRV.`"_+$G(SRV)_"^DIV^SYS","PXRM MENTAL HEALTH ACTIVE",1,"Q")
115 . I +ORY S ORY=1
116 Q
117MHATHRZD(ORY,TEST,USER) ;Indicates that user can score test
118 N ORYS,ORANS
119 I $T(PRIVL^YTAPI5)="" S ORY=1 Q
120 S ORY=0
121 S ORYS("CODE")=TEST
122 S ORYS("STAFF")=USER
123 D PRIVL^YTAPI5(.ORANS,.ORYS)
124 I $G(ORANS(1))="[DATA]" S ORY=+$P($G(ORANS(2)),U,1)
125 Q
126ANYTIME(ORY) ;Returns status of the ORWPCE ANYTIME ENCOUNTERS parameter
127 N SRV
128 S SRV=$P($G(^VA(200,DUZ,5)),U)
129 S ORY=$$GET^XPAR(DUZ_";VA(200,^SRV.`"_+$G(SRV)_"^DIV^SYS","ORWPCE ANYTIME ENCOUNTERS",1,"Q")
130 I +ORY S ORY=1
131 Q
132AUTOVSIT(ORY,LOC) ; Returns TRUE if automatic selection of Visit Type
133 N SRV
134 S SRV=$P($G(^VA(200,DUZ,5)),U)
135 S ORY=$$GET^XPAR(DUZ_";VA(200,^LOC.`"_$G(LOC)_"^SRV.`"_+$G(SRV)_"^DIV^SYS","ORWPCE DISABLE AUTO VISIT TYPE",1,"Q")
136 I +ORY S ORY=1
137 S ORY='ORY
138 Q
139DOCHKOUT(ORY,LOC) ; Returns TRUE if automatic selection of Visit Type
140 N SRV
141 S SRV=$P($G(^VA(200,DUZ,5)),U)
142 S ORY=$$GET^XPAR(DUZ_";VA(200,^LOC.`"_$G(LOC)_"^SRV.`"_+$G(SRV)_"^DIV^SYS","ORWPCE DISABLE AUTO CHECKOUT",1,"Q")
143 I +ORY S ORY=1
144 S ORY='ORY
145 Q
146CHKOUT(LOC) ; Returns TRUE if automatic selection of Visit Type
147 N ORY
148 D DOCHKOUT(.ORY,LOC)
149 Q ORY
150EXCLUDED(ORY,LOC,TYPE) ; Returns list of excluded PCE data elements
151 N SRV,PARAM
152 S PARAM=$S(TYPE=1:"IMMUNIZATIONS",TYPE=2:"SKIN TESTS",TYPE=3:"PATIENT ED",TYPE=4:"HEALTH FACTORS",TYPE=5:"EXAMS",1:"")
153 Q:PARAM=""
154 S SRV=$P($G(^VA(200,DUZ,5)),U)
155 S PARAM="ORWPCE EXCLUDE "_PARAM
156 D GETLST^XPAR(.ORY,"USR^LOC.`"_$G(LOC)_"^SRV.`"_+$G(SRV)_"^DIV^SYS^PKG",PARAM,"Q",.ORERR)
157 Q
158ISCLINIC(ORY,ORLOC) ; Returns TRUE if location is a clinic
159 N ORTYP
160 S ORY=0
161 S ORTYP=$$GET1^DIQ(44,+ORLOC,2,"I")
162 I (ORTYP="C")!(ORTYP="M") S ORY=1
163 Q
164HNCOK(ORY) ; Returns true if Head and/or Neck Cancer is enabled
165 S ORY=0
166 I $$PATCH^XPDUTL("DG*5.3*397"),$$PATCH^XPDUTL("SD*5.3*244"),$$PATCH^XPDUTL("PX*1.0*111"),$$PATCH^XPDUTL("IVM*2.0*46") S ORY=1
167 Q
168 ;
169CODACTIV(ORY,ORCODE,ORAPP,ORDATE) ; Is code active on the given date?
170 ; Remote procedure: ORWPCE ACTIVE CODE
171 ; ORCODE = ICD or CPT code to be checked
172 ; ORAPP = "ICD" or "CHP"
173 ; ORDATE = Date to be checked (defaults to current date)
174 S:'+$G(ORDATE) ORDATE=DT
175 S ORY=1
176 I ORAPP="ICD" D
177 . S ORY=+$$STATCHK^ICDAPIU(ORCODE,ORDATE)
178 E I ORAPP="CHP" D
179 . S ORY=+$$STATCHK^ICPTAPIU(ORCODE,ORDATE)
180 Q
181ICDACTIV(ORCODE,ORDATE) ; Check for active ICD code
182 D CODACTIV(.ORY,ORCODE,"ICD",$G(ORDATE))
183 Q +ORY
184CPTACTIV(ORCODE,ORDATE) ; Check for active CPT code
185 D CODACTIV(.ORY,ORCODE,"CHP",$G(ORDATE))
186 Q +ORY
187CXNOSHOW(ORY,ORDOCIEN) ; Should workload requirement be skipped for this note's visit?
188 ; RETURN VALUE: 0=SKIP ALL GUI WORKLOAD REQUIREMENTS
189 ; 1=CONTINUE WITH OTHER GUI WORKLOAD LOGIC
190 N ORTIU
191 D DOCPARM^TIUSRVP1(.ORTIU,ORDOCIEN) ; DBIA #4331
192 S ORY=+$$CHKWKL^TIUPXAP2(ORDOCIEN,ORTIU(0)) ; DBIA #4332
193 Q
Note: See TracBrowser for help on using the repository browser.