source: FOIAVistA/trunk/r/PCE_PATIENT_CARE_ENCOUNTER-AUTN-EFDP-PX-VSIT--PXRM/PXCEPAT.m@ 1420

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

initial load of FOIAVistA 6/30/08 version

File size: 5.5 KB
Line 
1PXCEPAT ;ISL/dee,ISA/KWP - Creates the List Manager display of visit for a patient ; 6/3/03 10:47am ; Compiled January 5, 2007 14:12:43
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**1,5,14,30,70,147,160,161,183,188**;Aug 12, 1996;Build 3
3 Q
4 ;
5NEWPAT2 ;Entry point of changing patient from Update Encounter
6 N PXCENEWP
7 D PATIENT(.PXCENEWP)
8 Q:PXCENEWP'>0
9 D PATKILL
10 S PXCEPAT=+PXCENEWP
11NEWPAT1 ;Entry point for initial selection of patient
12 D PATINFO(.PXCEPAT) Q:$D(DIRUT)
13 I $P(PXCEVIEW,"^",1)'="P" D
14 . S $P(PXCEVIEW,"^",1)="P"
15 . D SETDATES^PXCE
16 S SDAMTYP="P"
17 I PXCEVIEW["A" K PXCEHLOC
18 Q
19 ;
20NEWPAT ; -- init variables and list array
21 N PXCENEWP
22 D PATIENT(.PXCENEWP)
23 I PXCENEWP'>0,("~H~P~"'[("~"_$P(PXCEVIEW,"^")_"~")) S VALMQUIT=1 Q
24 I PXCENEWP'>0 Q
25 D PATKILL
26 S PXCEPAT=+PXCENEWP
27 D NEWPAT1 Q:$D(DIRUT)
28 D MAKELIST^PXCENEW
29 Q
30 ;
31MAKELIST ;
32 N PXCEDATE,PXCELOC,PXCESTAT,PXCEDT,PXCEIEN,PXCEVSIT,PXCEPRIM
33 D CHGCAP^VALM("LOCATION","Clinic")
34 K VALMHDR S VALMBCK="R"
35 S PXCEDT=PXCE9END
36 D CLEAN^VALM10
37 K ^TMP("PXCEIDX",$J)
38 S VALMBG=1
39 S VALMCNT=0
40 F S PXCEDT=$O(^AUPNVSIT("AA",PXCEPAT,PXCEDT)) Q:PXCEDT'>0!(PXCEDT>PXCE9BEG) D
41 . S PXCEIEN=""
42 . F S PXCEIEN=$O(^AUPNVSIT("AA",PXCEPAT,PXCEDT,PXCEIEN)) Q:PXCEIEN'>0 D
43 .. S PXCEVSIT=^AUPNVSIT(PXCEIEN,0)
44 .. I $D(PXCEHLOC),$P(PXCEVSIT,"^",22)'=PXCEHLOC Q
45 .. S PXCEPRIM=$P($G(^AUPNVSIT(PXCEIEN,150)),"^",3)
46 .. ;+do not show encounter if the encounter type is S,C or null
47 .. Q:"SC"[PXCEPRIM
48 .. I PXCEKEYS'["S",PXCEKEYS'["V","A"=PXCEPRIM Q ;+let supervisor and viewer see ancillary encounters
49 .. I PXCEKEYS'["V",$$DISPOSIT^PXUTL1(PXCEPAT,+PXCEVSIT,PXCEIEN) Q ;+let viewer see disposition
50 .. S VALMCNT=VALMCNT+1
51 .. S Y=$P(PXCEVSIT,"^",1)
52 .. S PXCEDATE=$$DATE^PXCEDATE($P(PXCEVSIT,"^",1))
53 .. S PXCEDATE=$E(PXCEDATE,1,18)_$J("",(19-$L(PXCEDATE)))
54 .. I $P(PXCEVSIT,"^",7)="E" D
55 ... S PXCELOC=" Historical Encounter at "
56 ... I $P(PXCEVSIT,"^",6)]"" D
57 .... N PXCEDELF
58 .... S PXCESTAT=$E($$EXTERNAL^DILFD(9000010,.06,"",$P(PXCEVSIT,"^",6),"PXCEDILF"),1,30)
59 ... E S PXCESTAT=$E($P($G(^AUPNVSIT(PXCEIEN,21)),"^"),1,30)
60 .. E D
61 ... S PXCELOC=$S($P(PXCEVSIT,"^",22)>0:$P(^SC($P(PXCEVSIT,"^",22),0),"^"),$P(PXCEVSIT,"^",7)="E":" Historical",1:"")
62 ... S PXCELOC=$E(PXCELOC,1,26)_$J("",(28-$L(PXCELOC)))
63 ... S PXCESTAT=$P($$STATUS^SDPCE(PXCEIEN),"^",2)
64 .. S ^TMP("PXCE",$J,VALMCNT,0)=$J(VALMCNT,4)_" "_PXCEDATE_PXCELOC_PXCESTAT
65 .. S ^TMP("PXCEIDX",$J,VALMCNT)=PXCEIEN
66 S ^TMP("PXCEIDX",$J,0)=VALMCNT
67 I VALMCNT'>0 D
68 . S ^TMP("PXCE",$J,1,0)=" "
69 . S ^TMP("PXCE",$J,2,0)=" No encounter found that satisfy the above criteria."
70 . S VALMCNT=2
71 Q
72 ;
73SDSALONE ;Get the patient for standalone from the appointment/hospital
74 ;location screen
75 Q:$G(PXCEPAT)>0
76 D PATIENT(.PXCEPAT)
77 I PXCEPAT>0 D PATINFO(.PXCEPAT) S PXCEJPAT=1
78 Q
79 ;
80SDKALONE ;Kill the patient info if it was created above
81 Q:'$D(PXCEJPAT)
82 D PATKILL
83 K PXCEJPAT
84 Q
85 ;
86JUSTDFN ;Just set DFN for other packages.
87 Q
88 Q:$G(DFN)>0
89 N X,Y,DIC,DA
90 S DIC=2,DIC(0)="AEMQ"
91 D ^DIC
92 I +Y>0 S DFN=+Y,PXCEJDFN=1
93 Q
94 ;
95JUSTDFNK ;Kill DFN if it was set above
96 I $G(PXCEJDFN) K DFN,PXCEJDFN
97 I $G(PXCEPAT)>0 S DFN=PXCEPAT
98 Q
99 ;
100PATIENT(PXCEDATA) ; Select a patient
101 N X,Y,DIC,DA,DFN
102 D FULL^VALM1
103 S DIC=2,DIC(0)="AEMQ" D ^DIC
104 S PXCEDATA=+Y
105PAT1 S %=1 I Y>0 W !," ...OK" D YN^DICN I %=0 W " Answer With 'Yes' or 'No'" G PAT1
106 I %'=1!$D(DIRUT) S (Y,PXCEDATA)=-1
107 I +Y'>0 D Q
108 . I $G(DFN)'>0 S VALMSG=$C(7)_"Patient has not been selected." W !!,$G(VALMSG) H 1
109 I +Y>0 S DFN=+Y D 2^VADPT I +VADM(6) N DIR D I $D(DIRUT) S PXCEDATA=-1
110 . S DIR(0)="E",DIR("A")="Enter RETURN to continue or '^' to exit"
111 . S DIR("A",1)="WARNING "_VADM(7) D ^DIR
112 Q
113 ;
114PATINFO(PXCEDATA) ;
115 Q:$G(PXCEDATA)'>0
116 S (DFN,SDFN,ORVP)=PXCEDATA
117 D:$G(PXCECAT)="SIT"!($G(PXCECAT)="HIST")!($G(PXCECAT)="AEP")!$G(FSEL) DTHINFO
118 I $D(DIRUT),$G(FSEL) D PATKILL Q
119 ;D 2^VADPT I +VADM(6) D K DIR I $D(DIRUT) D:$G(PXCECAT)'="SIT"&($G(PXCECAT)'="HIST")&($G(PXCECAT)'="AEP") PATKILL Q
120 ;. S DIR(0)="E",DIR("A")="Enter RETURN to continue or '^' to Quit"
121 ;. S DIR("A",2)="WARNING "_VADM(7),DIR("A",1)=" ",DIR("A",3)=" " D ^DIR
122 N Y
123 S Y=PXCEDATA
124 ;Set IHS patient variables
125 D START^AUPNPAT
126 D PATNAME(.PXCEDATA)
127 N VAERR,VAROOT,PXCEVA,PXCEINDX
128 S VAROOT="PXCEVA"
129 D ELIG^VADPT
130 S PXCEDATA("ELIG")=$P($G(PXCEVA(1)),"^",1,99)
131 S PXCEINDX=""
132 F S PXCEINDX=$O(PXCEVA(1,PXCEINDX)) Q:'PXCEINDX S PXCEDATA("ELIG",PXCEINDX)=$P(PXCEVA(1,PXCEINDX),"^",1,99)
133 Q
134 ;
135DTHINFO ;DEATH WARNING
136 D 2^VADPT N DIR I +VADM(6) D
137 . S DIR(0)="E",DIR("A")="Enter RETURN to continue or '^' to Quit"
138 . S DIR("A",2)="WARNING "_VADM(7),DIR("A",1)=" ",DIR("A",3)=" " D ^DIR
139 Q
140PATNAME(PXCEDATA) ;
141 S PXCEDATA("NAME")=$P($G(^DPT(+PXCEDATA,0)),"^",1)
142 N VAPTYP,VA,VAERR,DFN
143 S DFN=+PXCEDATA
144 D PID^VADPT6
145 I 'VAERR S PXCEDATA("SSN")=VA("PID"),PXCEDATA("SSN_BRIEF")=VA("BID")
146 E S (PXCEDATA("SSN"),PXCEDATA("SSN_BRIEF"))=""
147 Q
148 ;
149PATKILL ;
150 K PXCEPAT,DFN,SDFN,ORVP,VADM,VAEL,VALMSG
151 ; Kill IHS patient variables
152 D KILL^AUPNPAT
153 Q
154 ;
155APPOINT(DFN,DATETIME,HOSLOC) ;See if there is an appointment.
156 ;Input:
157 ; DFN ien of the patient
158 ; DATETIME the date and time of the appointment
159 ; HOSLOC optional, is the Hospital Location (#44)
160 ;Returns the clinic ien or -1 if no appointement.
161 ;
162 N VASD,HL,INDEX,VAERR
163 K ^UTILITY("VASD",$J)
164 S VASD("T")=DATETIME
165 S VASD("F")=DATETIME-.00000001
166 S VASD("W")=129 ;1)Active/Kept 2)Inpatient appts. only 9)No action taken
167 S:$G(HOSLOC) VASD("C",HOSLOC)=""
168 D SDA^VADPT
169 I VAERR S HL=-1 G QAPPOINT
170 S INDEX=$O(^UTILITY("VASD",$J,0))
171 I INDEX>0 S HL=$P(^UTILITY("VASD",$J,INDEX,"I"),"^",2)
172 E S HL=-1
173QAPPOINT K ^UTILITY("VASD",$J)
174 Q HL
175 ;
Note: See TracBrowser for help on using the repository browser.