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

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

initial load of WorldVistAEHR

File size: 6.6 KB
Line 
1PXBSTOR ;ISL/JVS - PASSING THE DATA TO THE V FILES ;3/21/05 1:35pm
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**73,88,149,124,164**;Aug 12, 1996
3 ;
4 ; VARIABLE LIST
5 ; PEICE 1 2 3 4 5 6 7 8 9
6 ; REQ*=PROVDER^PRIMARY^CPT^QUANTITY^POV^PRIMARY^PRV IEN^CPT IEN^POV IEN
7 ; PEICE 10 11 12 13 14 15 16 17 18 19 20 21 22
8 ; REQ STOPCODE^STOPCODE IEN^DX1^DX2^DX3^DX4^DX5^DX6^DX7^DX8^DEPT CODE^^OrdPrv
9 ; (DX5 - DX10 for future use)
10 ; REQ(1,MODIFIER)*=""
11 ; REQ("IEN")=V CPT file IEN
12 ; REQI=Internal Values
13 ; REQE=External Values
14 ; PXBVST=Visit Ien
15 ; PRVIEN=Provider IEN in V Provider file
16 ; CPTIEN=CPT IEN in V CPT file
17 ; POVIEN=POV IEN in V POV file
18 ; patient is defined from the visit
19 ;
20EN0(PXBVST,PATIENT,REQI,REQ) ;--Main Entry point
21EN1 ;
22 Q:'$D(REQI)!$G(PXBVST)<1
23 K ^TMP("PXK",$J) ;--MUST BE MOVED TO AFTER THE EVENT
24 N PRVIEN,CPTIEN,POVIEN,PRVBEF,CPTBEF,POVBEF,PPRNARR,CPRNARR
25 N POVBEF12,PRVAFT,PRVAFT12,PRVBEF12,POVAFT12,POVAFT,POVI
26 N CPTAFT,CPTAFT1,CPTBEF1,CPTAFT12,CPTBEF12,POVBF800,POVAF800
27 N PRVBF812,CPTBF812,POVBF812,PRVAF812,CPTAF812,POVAF812,SEQ,CTR
28 ;
29SET ;--SET TEMP GLOBALS
30 S SEQ=$$SET^PXBSTOR1
31 D:$P(REQI,"^",1) PRV S SEQ=SEQ+1
32 D:$P(REQI,"^",3) CPT S SEQ=SEQ+1
33 D:$P(REQI,"^",5) POV S SEQ=SEQ+1
34 F CTR=12:1:19 D:$P(REQI,U,CTR) DX S SEQ=SEQ+1
35 S ^TMP("PXBSTOR",$J,"SEQ")=SEQ+1
36 Q
37PRV ;--PROVIDER PIECE 1 AND 2
38 S PRVAFT=PRVBEF,PRVAFT12=PRVBEF12,PRVAF812=PRVBF812
39 I $D(DELM),$P(DELM,"^",1)=1 S (PRVAFT,PRVAFT12)="" G PRV1
40 S $P(PRVAFT,"^",1)=$P(REQI,"^",1) ;--PROVIDER IEN
41 S $P(PRVAFT,"^",4)=$P(REQI,"^",2) ;--PRIMARY/SECONDARY
42 S $P(PRVAFT,"^",2)=PATIENT ;--PATIENT
43 S $P(PRVAFT,"^",3)=PXBVST ;--VISIT POINTER
44 I PRVBF812']"" D
45 .;-***POPULATE VERIFIED FIELD IN FUTURE
46 .S $P(PRVAF812,"^",2)=$G(PXBPKG)
47 .S $P(PRVAF812,"^",3)=$G(PXBSOURC)
48PRV1 S ^TMP("PXK",$J,"PRV",SEQ,0,"AFTER")=PRVAFT
49 S ^TMP("PXK",$J,"PRV",SEQ,0,"BEFORE")=PRVBEF
50 S ^TMP("PXK",$J,"PRV",SEQ,12,"AFTER")=PRVAFT12
51 S ^TMP("PXK",$J,"PRV",SEQ,12,"BEFORE")=PRVBEF12
52 S ^TMP("PXK",$J,"PRV",SEQ,812,"AFTER")=PRVAF812
53 S ^TMP("PXK",$J,"PRV",SEQ,812,"BEFORE")=PRVBF812
54 S ^TMP("PXK",$J,"PRV",SEQ,"IEN")=PRVIEN
55 Q
56 ;
57CPT ;--CPT PROCDEURE PIECE 3 AND 4
58 N PXMODIEN
59 S CPTAFT=CPTBEF,CPTAFT12=CPTBEF12,CPTAF812=CPTBF812
60 I $D(DELM),$P(DELM,"^",2)=1 S (CPTAFT,CPTAFT12)="" G CPT1
61 S $P(CPTAFT,"^",1)=$P(REQI,"^",3) ;--PROCEDURE IEN
62 S $P(CPTAFT,"^",2)=PATIENT ;--PATIENT
63 S $P(CPTAFT,"^",3)=PXBVST ;--VISIT POINTER
64 S $P(CPTAFT12,"^",4)=$P(REQI,"^",1) ;--PROVIDER POINTER
65 S $P(CPTAFT12,"^",2)=$P(REQI,"^",22) ;--ORDERING PROVIDER POINTER
66 S CPRNARR=$P($$CPT^ICPTCOD($P(REQI,"^",3),$G(IDATE)),U,3) ;--TEXT PROV NARR
67 S $P(CPTAFT,"^",4)=+$$PROVNARR^PXAPI($G(CPRNARR),9000010.18) ;--PROV NAR
68 S $P(CPTAFT,"^",16)=$P(REQI,"^",4) ;--QUANTITY
69 S $P(CPTAFT,"^",5)=$P(REQI,"^",12) ;DX1 (REQUIRED)
70 S $P(REQI,U,19)=$P(REQI,U,19) ;INSURE AT LEAST 19 PIECES IN REQI
71 S $P(CPTAFT,"^",9,15)=$P(REQI,"^",13,19) ;DX2 - DX4, DX5 - DX8
72 I $$SWSTAT^IBBAPI() D ;DEPARTMENT CODE
73 . I $P(CPTAFT,U,19)="",$G(^AUPNVSIT(PXBVST,0)),$P(^AUPNVSIT(PXBVST,0),"^",8) S $P(CPTAFT,U,19)=$P($G(^DIC(40.7,$P(^AUPNVSIT(PXBVST,0),"^",8),0)),"^",2)
74 I $P(REQI,"^",4)=0 S (CPTAFT,CPTAFT12)=""
75 I $P(REQI,"^",4)="@" S (CPTAFT,CPTAFT12)=""
76 ;--------------------
77 ;I $G(CPTIEN),$D(^AUPNVCPT(CPTIEN,12)),$P(REQI,"^",1)'=$P(^AUPNVCPT(CPTIEN,12),"^",4),'$D(DELM) S (CPTIEN,CPTBEF,CPTBEF12)=""
78 ;---------------
79 I CPTBF812']"" D
80 .;-***POPULATE VERIFIED FIELD IN FUTURE
81 .S $P(CPTAF812,"^",2)=$G(PXBPKG)
82 .S $P(CPTAF812,"^",3)=$G(PXBSOURC)
83 S PXMODIEN=""
84 F S PXMODIEN=$O(REQ(1,PXMODIEN)) Q:PXMODIEN="" D
85 .S CPTAFT1(PXMODIEN)=REQ(1,PXMODIEN)
86CPT1 ;
87 S ^TMP("PXK",$J,"CPT",SEQ,0,"AFTER")=CPTAFT
88 S ^TMP("PXK",$J,"CPT",SEQ,0,"BEFORE")=CPTBEF
89 S ^TMP("PXK",$J,"CPT",SEQ,12,"AFTER")=CPTAFT12
90 S ^TMP("PXK",$J,"CPT",SEQ,12,"BEFORE")=CPTBEF12
91 S ^TMP("PXK",$J,"CPT",SEQ,812,"AFTER")=CPTAF812
92 S ^TMP("PXK",$J,"CPT",SEQ,812,"BEFORE")=CPTBF812
93 S ^TMP("PXK",$J,"CPT",SEQ,"IEN")=CPTIEN
94 ;Set modifiers into ^TMP
95 S PXMODIEN=""
96 F S PXMODIEN=$O(CPTAFT1(PXMODIEN)) Q:PXMODIEN="" D
97 .S ^TMP("PXK",$J,"CPT",SEQ,1,PXMODIEN,"AFTER")=CPTAFT1(PXMODIEN)
98 S PXMODIEN=""
99 F S PXMODIEN=$O(CPTBEF1(PXMODIEN)) Q:PXMODIEN="" D
100 .S ^TMP("PXK",$J,"CPT",SEQ,1,PXMODIEN,"BEFORE")=CPTBEF1(PXMODIEN)
101 ;Set ^TMP file with V CPT IEN
102 I $G(REQ)]"" D
103 . S ^TMP("PXK",$J,"CPT",SEQ,"IEN")=REQ
104 Q
105 ;
106POV ;--POV PIECE 5 AND 6
107 S POVAFT=POVBEF,POVAFT12=POVBEF12,POVAF812=POVBF812,POVAF800=POVBF800
108 S POVAFT17=POVBEF17
109 I $D(DELM),$P(DELM,"^",3)=1 S (POVAFT,POVAFT12,POVAF800)="" G POV1
110 S $P(POVAFT,"^",1)=$P(REQI,"^",5) ;--POV IEN
111 S $P(POVAFT,"^",12)=$P(REQI,"^",6) ;--PRI/SECONDARY
112 S $P(POVAFT,U,17)=$P(REQI,U,7) ;--ORDERING/RESULTING
113 S $P(POVAFT,"^",2)=PATIENT ;--PATIENT
114 S $P(POVAFT,"^",3)=PXBVST ;--VISIT POINTER
115 S PPRNARR=$$DXNARR^PXUTL1($P(REQI,"^",5),$G(IDATE)) ;--TEXT PROV NARR
116 S $P(POVAFT,"^",4)=+$$PROVNARR^PXAPI($G(PPRNARR),9000010.07) ;--POI PROV NARR
117 I $P($G(REQI),"^",7) S $P(POVAFT12,"^",4)=$P(^AUPNVPRV($P(REQI,"^",7),0),"^",1) ;--PROVIDER
118 I $G(PXBRES) S $P(POVAFT,"^",16)=PXBRES ;-PROBLEM LIST ENTRY
119 I POVBF812']"" D
120 .;-**POPULATE VERIFIED FIELD IN FUTURE
121 .S $P(POVAF812,"^",2)=$G(PXBPKG)
122 .S $P(POVAF812,"^",3)=$G(PXBSOURC)
123 I $D(PXBREQ($P(REQI,U,5))) S POVAF800=$G(PXBREQ($P(REQI,U,5),"I"))
124POV1 S ^TMP("PXK",$J,"POV",SEQ,0,"AFTER")=POVAFT
125 S ^TMP("PXK",$J,"POV",SEQ,0,"BEFORE")=POVBEF
126 S ^TMP("PXK",$J,"POV",SEQ,12,"AFTER")=POVAFT12
127 S ^TMP("PXK",$J,"POV",SEQ,12,"BEFORE")=POVBEF12
128 S ^TMP("PXK",$J,"POV",SEQ,17,"AFTER")=POVAFT17
129 S ^TMP("PXK",$J,"POV",SEQ,17,"BEFORE")=POVBEF17
130 S ^TMP("PXK",$J,"POV",SEQ,812,"AFTER")=POVAF812
131 S ^TMP("PXK",$J,"POV",SEQ,812,"BEFORE")=POVBF812
132 S ^TMP("PXK",$J,"POV",SEQ,800,"AFTER")=POVAF800
133 S ^TMP("PXK",$J,"POV",SEQ,800,"BEFORE")=POVBF800
134 S ^TMP("PXK",$J,"POV",SEQ,"IEN")=POVIEN
135 Q
136 ;
137DX ;CPT DIAGNOSIS - PX124
138 N POVIEN,POVBF800,POVBF812,POVBEF12,POVBEF,POVBEF17
139 N IEN,ANS,POVAF800,POVAF812,POVAFT12,POVAFT,POVAFT17
140 S IEN=$P(REQI,U,CTR),ANS=$$XLATE^PXBGPOV(PXBVST,IEN),POVIEN=+ANS
141 I POVIEN D
142 .S POVBEF=$G(^AUPNVPOV(POVIEN,0)),POVBEF12=$G(^(12)),POVBF812=$G(^(812)),POVBF800=$G(^(800)),POVBEF17=$G(^(17))
143 E S (POVBF800,POVBF812,POVBEF12,POVBEF17,POVBEF)=""
144 S POVAFT=POVBEF,POVAFT12=POVBEF12,POVAF812=POVBF812,POVAF800=POVBF800
145 S POVAFT17=POVBEF17
146 S $P(POVAFT,U,1,3)=IEN_U_PATIENT_U_PXBVST
147 S PPRNARR=$$EXTTEXT^PXUTL1(IEN,1,80,10)
148 S $P(POVAFT,U,4)=+$$PROVNARR^PXAPI(PPRNARR,9000010.07)
149 S $P(POVAFT,U,12)=$S(IEN=$G(PXBDXPRI):"P",1:"S") ;PRI/SEC
150 I $P(REQI,U,7) S $P(POVAFT12,U,4)=$P($G(^AUPNVPRV($P(REQI,U,7),0)),U,1)
151 I POVBF812']"" S $P(POVAF812,U,2,3)=$G(PXBPKG)_U_$G(PXBSOURC)
152 S POVAF800=$G(PXBREQ(IEN,"I")) S:POVAF800="" POVAF800=$P(ANS,U,4,20)
153 D POV1
154 Q
Note: See TracBrowser for help on using the repository browser.