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

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

initial load of WorldVistAEHR

File size: 4.8 KB
RevLine 
[613]1PXQGVST ;ISL/JVS - GATHER ENCOUNTERS ;8/29/96 10:32
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**4**;Aug 12, 1996
3 ;
4 ;
5 ;
6VISITLST(DFN,BEGINDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS) ;--GATHER VISITS
7 ;
8 ; DFN = Patient Identification entry number (required)
9 ; BEGINDT = Begining date of date range-INTERNAL FORMAT (optional)
10 ; ENDDT = Ending date of date range-INTERNAL FORMAT (optional)
11 ; HLOC = Hospital Location (pointer to file#44) (optional)
12 ; SCREEN = Code as related to field 15003 (required)
13 ;
14 ; ..'A'=ANCILLARY
15 ; ..'P'=PRIMARY
16 ; ..'O'=OCCASION OF SERIVCE
17 ; ..'S'=STOP CODES
18 ; ..'X'=All three above plus the 'NULL' Encounters (DEFAULT)
19 ;
20 ; ..'E'=Historical Encounters ('XE' for all historical visits)
21 ;
22 ; APPOINT
23 ; ..-1
24 ; ..0
25 ; ..1
26 ; OUTPUT:
27 ; >0 = VISIT IEN
28 ; =0 = User selected to add a visit
29 ; -1 = No visit selected
30 ; -2^"TEXT" = error of some kind^mesage about error
31 ;
32 ;
33 ;--Validate A PATIENT visit is sent in
34 I $G(DFN)<1 Q -2_"^"_"NO PATIENT"
35 I '$D(^AUPNPAT(DFN)) Q -2_"^"_"NO SUCH PATIENT"
36 ;
37 ;
38 N STOP
39 I $G(HLOC) D Q:$G(STOP) -2_"^"_"NO SUCH HOSPITAL LOCATION"
40 .I '$D(^SC(HLOC)) S STOP=1
41 ;
42 ;--NEW variables
43 N IEN,INDATEI,INDATEE,PXBC,PXBCC,VST,PXBI,SCRN,SCRN1,ENDDTT,BEGINDTT
44 N PXBHIGH,PXBCNT,PXBWIN,PXBSAVE,PXBDT,DEL,NOD0,NOD150,UID,STATUS
45 N HLOCE,HLOCI,VAL,VAR,GROUP2
46 S (PXBC,PXBCC)=0
47 ;--KILL variables
48 K ^TMP("PXBU",$J),^UTILITY("DIQ1",$J),^TMP("PXBKY",$J),^TMP("PXBSAM",$J),^TMP("PXBSKY",$J),GROUP
49 ;--CREATE tmp global
50 ;-SET UP SCREEN
51 I $D(SCREEN) D
52 .S PXBI="" F PXBI=1:1:$L(SCREEN) S SCRN($E(SCREEN,PXBI))=""
53 .I '$D(SCRN) S SCRN("X")=""
54 I $D(^AUPNVSIT("AA",DFN)) D
55 .I $G(ENDDT) S ENDDTT=9999999-$P(ENDDT,".",1) S:ENDDT["." ENDDTT=ENDDTT_((ENDDT#1)-(.0001)) S:ENDDT'["." ENDDTT=(ENDDTT)-(.0001) S ENDDT=ENDDTT
56 .I $G(BEGINDT) S BEGINDTT=9999999-$P(BEGINDT,".",1) S:BEGINDT["." BEGINDTT=BEGINDTT_(BEGINDT#1) S:BEGINDT'["." BEGINDTT=BEGINDTT_".999999" S BEGINDT=BEGINDTT
57 .I '$G(BEGINDT) S BEGINDT=999999999
58 .S PXBDT=$S($G(ENDDT):ENDDT,1:"")
59 .F S PXBDT=$O(^AUPNVSIT("AA",DFN,PXBDT)) Q:PXBDT>BEGINDT Q:PXBDT'>0 D
60 ..S IEN=0 F S IEN=$O(^AUPNVSIT("AA",DFN,PXBDT,IEN)) Q:IEN="" D
61 ...;
62 ...;-----SCREEN-------
63 ...;----BRING IN ALL NODES
64 ...S NOD0=$G(^AUPNVSIT(IEN,0)),NOD150=$G(^AUPNVSIT(IEN,150))
65 ...;--SCREEN BASED ON PARAMETER
66 ...S SCRN1=$P(NOD150,"^",3)
67 ...I SCRN1="",'$D(SCRN("X")) Q
68 ...I $D(SCRN("X")) G CON
69 ...I SCRN1="A",'$D(SCRN("A")) Q
70 ...I SCRN1="O",'$D(SCRN("O")) Q
71 ...I SCRN1="P",'$D(SCRN("P")) Q
72 ...I SCRN1="S",'$D(SCRN("S")) Q
73 ...I SCRN1="C",'$D(SCRN("C")) Q
74CON ...;--CONTINUE
75END ...;---END OF SCREENS-----
76 ...S PXBC=PXBC+1
77 ...S ^TMP("PXBU",$J,"VST",IEN)=""
78 K SCRN,SCRN1
79 ;
80 ;
81A ;--Set array with the VISITS from the visits
82 N DIQ,PRIME,PRIMI,PXBDT,VSTDTE,VSTDTI,GROUP,CATE,CATI,GROUP1
83 N APP,DISP,HIST
84 I $D(^TMP("PXBU",$J,"VST")) D
85 .S IEN=0 F S IEN=$O(^TMP("PXBU",$J,"VST",IEN)) Q:IEN'>0 D
86 ..S DIC=9000010,DR=".01;.07;.22;15003;15001",DA=IEN,DIQ(0)="EI" D EN^DIQ1
87 ..S VSTDTE=$G(^UTILITY("DIQ1",$J,9000010,DA,.01,"E"))
88 ..S VSTDTE=$P(VSTDTE,"@",1)_" "_$P($P(VSTDTE,"@",2),":",1,2)
89 ..S VSTDTI=$G(^UTILITY("DIQ1",$J,9000010,DA,.01,"I"))
90 ..S CATE=$G(^UTILITY("DIQ1",$J,9000010,DA,.07,"E"))
91 ..S CATI=$G(^UTILITY("DIQ1",$J,9000010,DA,.07,"I"))
92 ..S HLOCE=$G(^UTILITY("DIQ1",$J,9000010,DA,.22,"E"))
93 ..S HLOCI=$G(^UTILITY("DIQ1",$J,9000010,DA,.22,"I"))
94 ..S PRIME=$G(^UTILITY("DIQ1",$J,9000010,DA,15003,"E"))
95 ..S PRIMI=$G(^UTILITY("DIQ1",$J,9000010,DA,15003,"I"))
96 ..S UID=$G(^UTILITY("DIQ1",$J,9000010,DA,15001,"E"))
97 ..I $$VSTAPPT^PXUTL1(DFN,$P(^AUPNVSIT(IEN,0),"^",1),$P(^AUPNVSIT(IEN,0),"^",22),IEN) S APP="APP"
98 ..I $$DISPOSIT^PXUTL1(DFN,$P(^AUPNVSIT(IEN,0),"^",1),IEN) S DISP="DIS"
99 ..I $P(^AUPNVSIT(IEN,0),"^",7)="E" S HIST="HIS"
100 ..S STATUS=$P($$STATUS^SDPCE(IEN),"^",2)
101 ..S GROUP=VSTDTE_"^"_VSTDTI_"^"_HLOCE_"^"_HLOCI_"^"_PRIME_"^"_PRIMI_"^"_UID_"^"_STATUS
102 ..S GROUP1=IEN_"^"_VSTDTI_"^"_HLOCI_"^"_CATI_"^"_PRIMI_"^"_$G(APP)_"^"_$G(DISP)_"^"_$G(HIST)
103 ..S GROUP2=IEN_"^"_VSTDTI_"^"_HLOCI_"^"_$P($G(^AUPNVSIT(IEN,0)),"^",23)_"^"_$P($G(^AUPNVSIT(IEN,0)),"^",24)_"^"_$P($G(^AUPNVSIT(IEN,812)),"^",2)_"^"_$P($G(^AUPNVSIT(IEN,812)),"^",3)
104 ..K APP,DISP,HIST
105 ..S ^TMP("PXBVSTG",$J,VSTDTI,IEN)=$S($G(PXQINT):GROUP1,$G(PXQSOR):GROUP2,1:GROUP)
106 K DIC,DR,DA
107 ;
108 ;
109B ;--ADD Line Numbers
110 I $D(^TMP("PXBVSTG",$J)) D
111 .S PXBCC=PXBC+1,VST="" F S VST=$O(^TMP("PXBVSTG",$J,VST)) Q:VST="" D
112 ..S IEN=0 F S IEN=$O(^TMP("PXBVSTG",$J,VST,IEN)) Q:IEN="" S PXBCC=PXBCC-1 D
113 ...S ^TMP("PXBKY",$J,VST,PXBCC)=$G(^TMP("PXBVSTG",$J,VST,IEN))
114 ...S ^TMP("PXBSAM",$J,PXBCC)=$G(^TMP("PXBVSTG",$J,VST,IEN))
115 ...S ^TMP("PXBSKY",$J,PXBCC,IEN)=""
116 ;
117F ;--FINISH UP THE VARIABLES
118 K ^TMP("PXBU",$J),^UTILITY("DIQ1",$J)
119 S PXBCNT=+$G(PXBC)
120 D DISP^PXQGVST1
121 Q VAL
122 ;
Note: See TracBrowser for help on using the repository browser.