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

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

initial load of WorldVistAEHR

File size: 7.5 KB
RevLine 
[613]1PXAPI ;ISL/dee - PCE's APIs ;4/16/97
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**15,14,27,28,124,164**;Aug 12, 1996
3 Q
4 ;
5PROVNARR(PXPNAR,PXFILE,PXCLEX) ;Convert external Provider Narrative to internal.
6 ;Input:
7 ; PXPNAR Is the text of the provider narrative.
8 ; PXFILE Is the file that the returned pointer will be stored in.
9 ; If a new entry is created then this tells the context
10 ; that it was created under by the file using it.
11 ; PXCLEX Is and optional pointer to the Lexicon for this narrative.
12 ;
13 ;Returns:
14 ; Pointer to the provider narrative file ^ narrative
15 ; or pointer to the provider narrative file ^ narrative ^1
16 ; where 1 indicates that the entry has just been added
17 ; or -1 if was unsuccessful.
18 ;
19 N DIC,Y,DLAYGO,DD,DO,DA
20 S DIC="^AUTNPOV(",DIC(0)="L",DLAYGO=9999999.27
21 S (DA,Y)=0
22 S X=$E(PXPNAR,1,245)
23 Q:X="" -1
24 L +^AUTNPOV(0):60
25 E W !,"The Provider Narrative is LOCKED try again." Q -1
26 F S DA=$O(^AUTNPOV("B",$E(X,1,30),DA)) Q:DA'>0 I $P(^AUTNPOV(DA,0),"^")=X S Y=DA_"^"_X Q
27 I '(+Y) D
28 . K DA,Y
29 . D FILE^DICN
30 . I +Y>0,($G(PXCLEX)!$G(PXFILE)) S ^AUTNPOV(+Y,757)=$G(PXCLEX)_"^"_$G(PXFILE)
31 L -^AUTNPOV(0)
32 Q $S(+Y>0:Y,1:-1)
33 ;
34STOPCODE(PXASTOP,PXAPAT,PXADATE) ;This is the function call to return the quantity
35 ; of a particular Stop Code for a patient on one day.
36 ;Input
37 ; PXASTOP (required) pointer to #40.7
38 ; PXAPAT (required) pointer to #2
39 ; PXADATE (required) the date in Fileman format
40 ; (time is ignored if passed)
41 ;Returns
42 ; the count of how many of that stop code are stored for that one day
43 ;
44 N PXAVST,PXREVDAT,PXENDDAT,PXACOUNT
45 S PXASTOP=$G(PXASTOP)
46 S PXAPAT=+$G(PXAPAT)
47 S PXADATE=+$G(PXADATE)
48 S (PXACOUNT,PXAVST)=0
49 S PXREVDAT=9999999-$P(PXADATE,".")-.00000001
50 S PXENDDAT=PXREVDAT+.9
51 F S PXREVDAT=$O(^AUPNVSIT("AA",PXAPAT,PXREVDAT)) Q:'PXREVDAT!(PXREVDAT>PXENDDAT) D
52 . F S PXAVST=$O(^AUPNVSIT("AA",PXAPAT,PXREVDAT,PXAVST)) Q:'PXAVST D
53 .. I PXASTOP=$P(^AUPNVSIT(PXAVST,0),"^",8),"E"'=$P(^AUPNVSIT(PXAVST,0),"^",7) S PXACOUNT=PXACOUNT+1
54 Q PXACOUNT
55 ;
56CPT(PXACPT,PXAPAT,PXADATE,PXAHLOC) ;This is the function call to return the quantity
57 ; of a particular CPT for a patient on one day and for
58 ; one hospital location if passed.
59 ;Input
60 ; PXACPT (required) pointer to #81
61 ; PXAPAT (required) pointer to #2
62 ; PXADATE (required) the date in Fileman format
63 ; (time is ignored if passed)
64 ; PXAHLOC (optional) pointer to #44
65 ;Returns
66 ; the count of how many (and quantity) of that cpt code are stored for that one day
67 ;
68 ;
69 N PXAVST,PXAVCPT,PXREVDAT,PXENDDAT,PXACOUNT
70 S PXACPT=$G(PXACPT)
71 S PXAPAT=+$G(PXAPAT)
72 S PXADATE=+$G(PXADATE)
73 S PXAHLOC=+$G(PXAHLOC)
74 S (PXACOUNT,PXAVST)=0
75 S PXREVDAT=9999999-$P(PXADATE,".")-.00000001
76 S PXENDDAT=PXREVDAT+.9
77 F S PXREVDAT=$O(^AUPNVSIT("AA",PXAPAT,PXREVDAT)) Q:'PXREVDAT!(PXREVDAT>PXENDDAT) D
78 . F S PXAVST=$O(^AUPNVSIT("AA",PXAPAT,PXREVDAT,PXAVST)) Q:'PXAVST D
79 .. Q:"E"=$P(^AUPNVSIT(PXAVST,0),"^",7)
80 .. Q:"1"=$P(^AUPNVSIT(PXAVST,150),"^",2)
81 .. I PXAHLOC>0,PXAHLOC'=$P(^AUPNVSIT(PXAVST,0),"^",22) Q
82 .. S PXAVCPT=0
83 .. F S PXAVCPT=$O(^AUPNVCPT("AD",PXAVST,PXAVCPT)) Q:'PXAVCPT D
84 ... I PXACPT=$P(^AUPNVCPT(PXAVCPT,0),"^",1) S PXACOUNT=PXACOUNT+$P(^(0),"^",16)
85 Q PXACOUNT
86 ;
87INTV(WHAT,PACKAGE,SOURCE,VISIT,HL,DFN,APPT,LIMITDT,ALLHLOC) ;This api will prompt the user for Visit and related V-file data used to document an encounter.
88 ;See INTV^PXBAPI for parameters and return values.
89 ;
90 I '($D(VISIT)#2) S VISIT=""
91 I '($D(DFN)#2) S DFN=""
92 I '($D(HL)#2) S HL=""
93 ;
94 Q $$INTV^PXBAPI(WHAT,PACKAGE,SOURCE,.VISIT,.HL,.DFN,$G(APPT),$G(LIMITDT),$G(ALLHLOC))
95 ;
96DELVFILE(WHICH,VISIT,PACKAGE,SOURCE,ASK,ECHO,USER) ;Deletes the requested data related to the visit.
97 ;See DELVFILE^PXAPIDEL for parameters and return values.
98 ;
99 Q $$DELVFILE^PXAPIDEL(WHICH,VISIT,$G(PACKAGE),$G(SOURCE),$G(ASK),$G(ECHO),$G(USER))
100 ;
101DATA2PCE(DATA,PACKAGE,SOURCE,VISIT,USER,DISPLAY,ERROR,SCREEN,ARRAY,ACCOUNT) ;API to pass data for add/edit/delete to PCE
102 ;See DATA2PCE^PXAI for parameters and return values.
103 ;
104 I '($D(DATA)#2) Q -3
105 I '($D(PACKAGE)#2) Q -3
106 I '($D(SOURCE)#2) Q -3
107 I '($D(VISIT)#2) S VISIT=""
108 Q $$DATA2PCE^PXAI(DATA,PACKAGE,SOURCE,.VISIT,$G(USER),$G(DISPLAY),.ERROR,$G(SCREEN),.ARRAY,.ACCOUNT) ;PX*1.0*164 CHANGED $G(ERROR) TO .ERROR
109 ;
110SOURCE(SOURCE) ;Get IEN of data source in the PCE Data Source file
111 Q $$SOURCE^PXAPIUTL($G(SOURCE))
112 ;
113VISITLST(DFN,BEGINDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS) ;--GATHER VISITS
114 ;See VISITLST^PXBGVST for parameters and return values.
115 ;
116 I '($D(DFN)#2) Q "-2^NO PATIENT SELECTED"
117 Q $$VISITLST^PXBGVST(DFN,$G(BEGINDT),$G(ENDDT),$G(HLOC),$G(SCREEN),$G(APPOINT),$G(PROMPT),$G(COSTATUS))
118 ;
119ENCEDIT(WHAT,PACKAGE,SOURCE,DFN,BEGINDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS) ;--Ask for encounter the edit it of delete it
120 ;See ENCEDIT^PXAPIEED for parameters and return values.
121 ;
122 Q $$ENCEDIT^PXAPIEED($G(WHAT),$G(PACKAGE),$G(SOURCE),$G(DFN),$G(BEGINDT),$G(ENDDT),$G(HLOC),$G(SCREEN),$G(APPOINT),$G(PROMPT),$G(COSTATUS))
123 ;
124LOPENCED(WHAT,PACKAGE,SOURCE,DFN,BEGINDT,ENDDT,HLOC,SCREEN,APPOINT,PROMPT,COSTATUS) ;--Ask for encounter the edit it of delete it
125 ;See LOPENCED^PXAPIEED for parameters and return values.
126 ;
127 Q $$LOPENCED^PXAPIEED($G(WHAT),$G(PACKAGE),$G(SOURCE),$G(DFN),$G(BEGINDT),$G(ENDDT),$G(HLOC),$G(SCREEN),$G(APPOINT),$G(PROMPT),$G(COSTATUS))
128 ;
129GETENC(DFN,ENCDT,HLOC) ;--Get all of the encounter data
130 ;See GETENC^PXKENC for parameters and return values.
131 ;
132 Q $$GETENC^PXKENC($G(DFN),$G(ENCDT),$G(HLOC))
133 ;
134ENCEVENT(VISIT,DONTKILL) ;--Get all of the encounter data
135 ;See ENCEVENT^PXKENC for parameters and return values.
136 ;
137 D ENCEVENT^PXKENC($G(VISIT),$G(DONTKILL))
138 Q
139 ;
140VST2APPT(VISIT) ;Is this visit related to an appointment
141 ;See VST2APPT^PXUTL1 for parameters and return values.
142 ;
143 Q $$VST2APPT^PXUTL1($G(VISIT))
144 ;
145APPT2VST(DFN,ENCDT,HLOC) ;Get the visit for an Appointment
146 ;See APPT2VST^PXUTL1 for parameters and return values.
147 ;
148 Q $$APPT2VST^PXUTL1($G(DFN),$G(ENCDT),$G(HLOC))
149 ;
150SWITCHD() ;This returns the date that PCE starts collecting the data
151 ; instead Scheduling (switch over date).
152 Q $P($G(^PX(815,1,0)),"^",2)
153 ;
154SWITCHCK(DATE) ;Returns 1 if after the switch over date 0 otherwise.
155 N SWITCH
156 S SWITCH=$P($G(^PX(815,1,0)),"^",2)
157 Q:SWITCH<2960000 0
158 Q SWITCH'>DATE
159 ;
160DISPVSIT ;Called by Scheduling to create a visit for a disposition
161 ;Add to fix scheduling calling visit tracking wrong without the
162 ; dispositioning clinic. Hospital Location is required by Visit
163 ; Tracking to work correctly.
164 I $G(VSIT("LOC"))>0,'$D(^PX(815,1,"DHL","B",VSIT("LOC"))) S VSIT("LOC")=""
165 I $G(VSIT("LOC"))'>0,'$D(ZTQUEUED) D
166 . I $P(^PX(815,1,"DHL",0),"^",4)=1 S VSIT("LOC")=$O(^PX(815,1,"DHL","B",0))
167 . E D
168 .. ;ask for Hospital location from those that can disposition
169 .. N DIC,DA,X,Y
170DISPASK .. S DA(1)=1
171 .. S DIC="^PX(815,1,""DHL"","
172 .. S DIC("P")=$P(^DD(815,401,0),"^",2)
173 .. S DIC(0)="AEOQ"
174 .. D ^DIC
175 .. I Y>0 S VSIT("LOC")=$P(Y,"^",2)
176 .. ;E I '$D(DTOUT),'$D(DUOUT) W !!,$C(7),"Disposition Hospital Location is required." G DISPASK
177 .. E W !!,$C(7),"Disposition Hospital Location is required." G DISPASK
178 I $G(VSIT("LOC"))'>0 S VSIT("IEN")=-1
179 E D ^VSIT
180 Q
181 ;
182ACTIVPRV(PROVIDER,VISITDT) ;See if this is a good provider on the date of
183 ;VISITDT and returns 1 if it is 0 if it is not.
184 ;Can be used like S DIC("S")="I $$ACTIVPRV^PXAPIUTL(PRV,DATE)"
185 Q:+$$PRVCLASS^PXAPIUTL($G(PROVIDER),$G(VISITDT))>0 1
186 Q 0
187 ;
188PRVCLASS(PROVIDER,VISITDT) ;See if this is a good provider
189 ;See PRVCLASS^PXAPIUTL for parameters and return values.
190 Q $$PRVCLASS^PXAPIUTL($G(PROVIDER),$G(VISITDT))
191 ;
Note: See TracBrowser for help on using the repository browser.