source: WorldVistAEHR/trunk/r/PCE_PATIENT_CARE_ENCOUNTER-AUTN-EFDP-PX-VSIT--PXRM/PXAIVST.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: 3.6 KB
Line 
1PXAIVST ;ISL/JVS,KWP,ESW - GET A VISIT FROM ENCOUNTER NODE ;11/20/02 4:38pm
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**5,9,15,74,111,96,130,124,164**;Aug 12, 1996
3 ;
4 ;
5 Q
6VST ;--CREAT A VISIT
7 ;
8SET ;--SET AND NEW VARIABLES
9 N AFTER0,AFTER21,AFTER800,AFTER150,BEFOR0,BEFOR21,BEFOR800,BEFOR150
10 N AFTER811,BEFOR811,BEFOR812
11 N PXAA,PXAB,SUB,PIECE,STOP
12 N AFTER8A,AFTER812
13 ;
14 S SUB="" F S SUB=$O(@PXADATA@("ENCOUNTER",1,SUB)) Q:SUB="" D
15 .S PXAA(SUB)=@PXADATA@("ENCOUNTER",1,SUB)
16 ;
17 S (AFTER812,BEFOR812)=""
18 ;
19 S PXAK=1
20 S PXAERR(8)=1
21 S PXAERR(7)="ENCOUNTER"
22 ;
23VAL ;--VALIDATE ENOUGH DATA
24 I $D(@PXADATA@("ENCOUNTER")) D VAL^PXAIVSTV Q:$G(STOP)
25 I $G(PXAVISIT) S (PATIENT,PXAA("PATIENT"))=$P(^AUPNVSIT(PXAVISIT,0),"^",5) S PXAA("ENC D/T")=$P(^AUPNVSIT(PXAVISIT,0),"^",1) S PXAA("HOS LOC")=$P(^AUPNVSIT(PXAVISIT,0),"^",22)
26 ;
27SETVARA ;--SET VISIT VARIABLES
28 S $P(AFTER0,"^",1)=$G(PXAA("ENC D/T"))
29 ;PX*1*96 - Set TYPE (Piece #3) according to following;
30 ; 1. If OUTSIDE LOCATION then TYPE is "O"
31 ; 2. If no OUTSIDE LOCATION but INSTITUTION then TYPE is "V"
32 ; 3. Else set to value of DUZ("AG")
33 ;Set TYPE
34 I $L($G(PXAA("OUTSIDE LOCATION"))) S $P(AFTER0,U,3)="O"
35 E I $L($G(PXAA("INSTITUTION"))) S $P(AFTER0,U,3)="V"
36 E S $P(AFTER0,U,3)=$G(DUZ("AG"))
37 S $P(AFTER0,"^",5)=$G(PXAA("PATIENT"))
38 S $P(AFTER0,"^",6)=$G(PXAA("INSTITUTION"))
39 S $P(AFTER0,"^",7)=$G(PXAA("SERVICE CATEGORY"))
40 S $P(AFTER0,"^",8)="" ;$G(PXAA("DSS ID"))
41 S $P(AFTER0,"^",12)=$G(PXAA("PARENT"))
42 S $P(AFTER0,"^",18)=$G(PXAA("CHECKOUT D/T"))
43 S $P(AFTER0,"^",21)=$G(PXAA("ELIGIBILITY"))
44 S $P(AFTER0,"^",26)=$S($G(PXACCNT)>0:$G(PXACCNT),1:"") ;PX*1.0*164
45 S $P(PXELAP,"^",1)=$G(PXAA("ELIGIBILITY"))
46 S $P(PXELAP,"^",3)=$G(PXAA("APPT"))
47 S $P(AFTER0,"^",22)=$G(PXAA("HOS LOC"))
48 S $P(AFTER800,"^",1)=$G(PXAA("SC"))
49 S $P(AFTER800,"^",2)=$G(PXAA("AO"))
50 S $P(AFTER800,"^",3)=$G(PXAA("IR"))
51 S $P(AFTER800,"^",4)=$G(PXAA("EC"))
52 S $P(AFTER800,"^",5)=$G(PXAA("MST"))
53 ;PX*1*111 - Add HNC
54 S $P(AFTER800,"^",6)=$G(PXAA("HNC"))
55 S $P(AFTER800,"^",7)=$G(PXAA("CV"))
56 ;--VALIDATE SERVICE CONNECTEDNESS
57 ;
58 S AFTER8A=AFTER800 D VALSCC^PXAIVSTV
59 S AFTER800=AFTER8A
60 ;
61 S $P(AFTER21,"^",1)=$G(PXAA("OUTSIDE LOCATION")) ;PX/96
62 S $P(AFTER150,"^",3)=$G(PXAA("ENCOUNTER TYPE"))
63 S $P(AFTER811,"^",1)=$G(PXAA("COMMENT"))
64 S $P(AFTER812,"^",3)=$G(PXASOURC)
65SETPXKA ;--SET PXK ARRAY AFTER
66 S ^TMP("PXK",$J,"VST",1,0,"AFTER")=AFTER0
67 S ^TMP("PXK",$J,"VST",1,21,"AFTER")=AFTER21
68 S ^TMP("PXK",$J,"VST",1,150,"AFTER")=AFTER150
69 S ^TMP("PXK",$J,"VST",1,800,"AFTER")=AFTER800
70 S ^TMP("PXK",$J,"VST",1,811,"AFTER")=AFTER811
71 S ^TMP("PXK",$J,"VST",1,812,"AFTER")=AFTER812
72SETVARB ;--SET VARIABLES BEFORE
73 I $G(PXAVISIT) D
74 .F PIECE=0,21,150,800,811,812 S ^TMP("PXK",$J,"VST",1,PIECE,"BEFORE")=$G(^AUPNVSIT(PXAVISIT,PIECE))
75 .I '$D(@PXADATA@("ENCOUNTER")) D
76 ..F PIECE=0,21,150,800,811,812 S ^TMP("PXK",$J,"VST",1,PIECE,"AFTER")=$G(^AUPNVSIT(PXAVISIT,PIECE))
77 E D
78 .S (BEFOR0,BEFOR21,BEFOR150,BEFOR800,BEFOR811)=""
79 .;
80SETPXKB .;--SET PXK ARRAY BEFORE
81 .S ^TMP("PXK",$J,"VST",1,0,"BEFORE")=BEFOR0
82 .S ^TMP("PXK",$J,"VST",1,21,"BEFORE")=BEFOR21
83 .S ^TMP("PXK",$J,"VST",1,150,"BEFORE")=BEFOR150
84 .S ^TMP("PXK",$J,"VST",1,800,"BEFORE")=BEFOR800
85 .S ^TMP("PXK",$J,"VST",1,811,"BEFORE")=BEFOR811
86 .S ^TMP("PXK",$J,"VST",1,812,"BEFORE")=BEFOR812
87MISC ;--MISCELLANEOUS NODE
88 S ^TMP("PXK",$J,"VST",1,"IEN")=$G(PXAVISIT)
89 ;
90CALL ;--CALL
91 S PXALOOK=$$LOOKVSIT^PXUTLVST($P(AFTER0,U,5),$P(AFTER0,U),$P(AFTER0,U,22),$P(AFTER0,"^",8),$P(AFTER0,U,6)) I $G(PXALOOK)>0 S PXAVISIT=PXALOOK ;PX/96 - included INSTITUTION - $P(AFTER0,U,6)
92 D EN1^PXKMAIN
93 I '$G(PXAVISIT) S PXAVISIT=$G(^TMP("PXK",$J,"VST",1,"IEN"))
94 Q
Note: See TracBrowser for help on using the repository browser.