source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGP.m@ 814

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

initial load of WorldVistAEHR

File size: 2.4 KB
RevLine 
[613]1PSGP ;BIR/CML3-PATIENT LOOK-UP ;15 Apr 98 / 9:05 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**10,53,111**;16 DEC 97
3 ;
4 ; Reference to ^PS(55 is supported by DBIA 2191.
5 ; Reference to ^SDAMA203 is supported by DBIA 4133.
6 ;
7ENDPT ; get any patient
8 N HIT
9 K DIC,PSGP,Y W !!,"Select "_$S($D(PSGDICA):PSGDICA_" ",1:"")_"PATIENT: " R X:DTIME S:X["^" PSJSTOP=1 I "^"[X S (Y,PSGP)=-1 G DONE
10 D EN^PSJDPT
11 I Y'>0 G ENDPT
12 K DIC
13 ;
14CHK ;
15 S (DFN,PSGP)=+Y,VA200=1 D INP^VADPT
16 I VAIN(4) S PSJPCAF=1_"^"_VAIN(1),PSJPWD=+VAIN(4),PSJPWDN=$P(VAIN(4),"^",2),PSJPTS=+VAIN(3),PSJPTSP=+VAIN(2),PSJPRB=VAIN(5),PSJPAD=+VAIN(7),PSJPDX=VAIN(9),PSJPTD=$P($G(^PS(55,PSGP,5.1)),"^",4),PSJPDD="" G CNV
17 S PSJPCAF="",VAIP("D")="L" D IN5^VADPT I 'VAIP(13,1) W $C(7),!!?3,"PATIENT HAS NEVER BEEN ADMITTED." D COP I 'HIT G ENDPT
18 S PSJPAD=VAIP(13,1),PSGID=+VAIP(3),X=+VAIP(4)=12!(+VAIP(4)=38),PSGOD=$$ENDTC^PSGMI(PSGID) W $C(7),!!?3,"PATIENT IS FOUND TO BE D",$P("ISCHARG^ECEAS","^",X+1),"ED AS OF ",PSGOD,"." D COP I 'HIT G:'$D(PSGRETF) ENDPT
19 S PSJPAD=VAIP(13,1),PSJPWD=+VAIP(5),PSJPWDN=$P(VAIP(5),"^",2),PSJPRB=$P(VAIP(6),"^",2),PSJPTSP=+VAIP(7),PSJPTS=+VAIP(8),PSJPDX=VAIP(9),PSJPTD="",PSJPDD=PSGID_"^"_PSGOD S:X PSJPDD=PSJPDD_"^1"
20 ;
21CNV ;
22 D DEM^VADPT,PID^VADPT,HTWT^PSJAC(DFN)
23 S PSGP(0)=VADM(1),PSJPSSN=VADM(2),PSJPDOB=+VADM(3),PSJPAGE=VADM(4),PSJPSEX=$S(VADM(5)]"":VADM(5),1:"?^____"),PSJPPID=VA("PID"),PSJPBID=VA("BID")
24 F X="PSJPAD","PSJPDOB","PSJPTD" I +@X S $P(@X,"^",2)=$$ENDTC^PSGMI(+@X)
25 ;
26WP ; ward parameters
27 S PSJSYSW0="",PSJSYSW=0 I PSJPWD S PSJSYSW=+$O(^PS(59.6,"B",PSJPWD,0)) I PSJSYSW S PSJSYSW0=$G(^PS(59.6,PSJSYSW,0))
28 ;S PSJSYSL="",X=$P(PSJSYSU,";",3)>1,PSJSYSL=$P(PSJSYSW0,"^",X*4+12)
29 S PSJSYSL="",X=$P(PSJSYSU,";",3)>1,PSJSYSL=$S(X=0:$P(PSJSYSW0,"^",12),1:$P(PSJSYSW0,"^",16))
30 I PSJSYSL D
31 .S:X X='$P(PSJSYSP0,"^",10) S IOP=$S($P(PSJSYSP0,"^",13)]"":$P(PSJSYSP0,"^",13),$P(PSJSYSW0,"^",19+X)]"":$P(PSJSYSW0,"^",19+X),1:"") I IOP]"" D
32 ..S IOP="`"_IOP K %ZIS S %ZIS="NQ" D ^%ZIS S:'POP $P(PSJSYSL,"^",2,3)=ION_"^"_IO D ^%ZISC
33 ;
34DONE ;
35 K DA,DIC,NB,ND,NS,PSGID,PSGOD,VA200,VADM,VAIN,VAIP,VAMT,X,Y(0),Y(0,0) Q
36 ;
37COP ;check for appointments in clinics that allowed inpatient orders
38 S HIT=0 Q:'$$PATCH^XPDUTL("SD*5.3*285")
39 N SQ,A,VAIP,X,PSJF
40 D IN5^VADPT
41 D NOW^%DTC S (PSJF,VASD("F"))=$P(%,".")-1
42 D SDA^VADPT
43 S SQ=0 F S SQ=$O(^UTILITY("VASD",$J,SQ)) Q:'SQ S A=^(SQ,"I") I $$SDIMO^SDAMA203($P(A,"^",2),DFN)>0 S HIT=1 Q
44 I $O(^PS(55,DFN,5,"AUN",PSJF))!($O(^PS(55,DFN,"IV","AIN",PSJF))) S HIT=1
45 Q
Note: See TracBrowser for help on using the repository browser.