source: FOIAVistA/trunk/r/BAR_CODE_MED_ADMIN-ALPB-PSB/PSBVDLTB.m@ 1572

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

initial load of FOIAVistA 6/30/08 version

File size: 3.1 KB
Line 
1PSBVDLTB ;BIRMINGHAM/EFC-BCMA VIRTUAL DUE LIST FUNCTIONS (CONT) ;Mar 2004
2 ;;3.0;BAR CODE MED ADMIN;**3,4,16**;Mar 2004
3 ;
4 ; Reference/IA
5 ; EN^PSJBCMA/2828
6 ; IN5^VADPT/10061
7 ; DEM^VADPT/10061
8 ; INP^VADPT/10061
9 ; $$FMADD^XLFDT/10103
10 ; $$GET^XPAR/2263
11 ;
12 ;
13RPC(RESULTS,DFN,PSBTAB,PSBDT) ;
14 K RESULTS,^TMP("PSB",$J),^TMP("PSJ",$J)
15 N PSBCNT
16 S PSBTRFL=0
17 S RESULTS=$NAME(^TMP("PSB",$J,PSBTAB))
18 ;
19 Q:$$DISCHRGD(DFN)
20 ;
21 S PSBNOW=+$G(PSBDT)
22 I 'PSBNOW D NOW^%DTC S PSBNOW=+$E(%,1,10),PSBDT=$P(%,".",1)
23 ; use fileman function to determine window
24 S PSBWBEG=$$FMADD^XLFDT(PSBNOW,"",-12)
25 S PSBWEND=$$FMADD^XLFDT(PSBNOW,"",12)
26 ;
27 ; Create variable for valid order start date/time against admin window
28 S PSBWADM=$$GET^XPAR("DIV","PSB ADMIN BEFORE")
29 D NOW^%DTC S PSBWADM=$$FMADD^XLFDT(%,"","",+PSBWADM)
30 ;
31 ; use last movement for API
32 S VAIP("D")="LAST" D IN5^VADPT S PSBTRDT=+VAIP(3),PSBTRTYP=$P(VAIP(2),U,2),PSBMVTYP=$P(VAIP(4),U,2) K VAIP
33 ;
34 ;Get patient transfer notification timeframe to determine pop-up box
35 S PSBPTTR=$$GET^XPAR("DIV","PSB PATIENT TRANSFER") I PSBPTTR="" S PSBPTTR=72
36 D NOW^%DTC S PSBNTDT=$$FMADD^XLFDT(%,"",-PSBPTTR) I PSBNTDT'>PSBTRDT S PSBTRFL=1
37 ;determine order type and load to table
38 ;
39 ; Setup the ^TMP("PSJ",$J global for use below
40 ; Passing PSBDT as 3rd parameter turns off the V.1.0 One-Time lookback
41 D EN^PSJBCMA(DFN,PSBNOW,PSBDT)
42 ;initialize tabs
43 D TABINIT
44 ;
45 ;The following calls must be made in the order below since the ^TMP global is reused
46 D EN^PSBVDLUD(DFN,PSBDT),EN^PSBVDLPB(DFN,PSBDT),EN^PSBVDLIV(DFN,PSBDT)
47 S $P(PSBATAB,U,1)=$S($D(^TMP("PSB",$J,"UDTAB",2))>0:1,1:0)
48 S $P(PSBATAB,U,2)=$S($D(^TMP("PSB",$J,"PBTAB",2))>0:1,1:0)
49 S $P(PSBATAB,U,3)=$S($D(^TMP("PSB",$J,"IVTAB",2))>0:1,1:0)
50 S:PSBTAB="UDTAB" PSBCNT=$O(^TMP("PSB",$J,"UDTAB",""),-1)
51 S:PSBTAB="IVTAB" PSBCNT=$O(^TMP("PSB",$J,"IVTAB",""),-1)
52 S:PSBTAB="PBTAB" PSBCNT=$O(^TMP("PSB",$J,"PBTAB",""),-1)
53 I PSBTAB="NO TAB" D
54 .S ^TMP("PSB",$J,PSBTAB,0)=1
55 .S ^TMP("PSB",$J,PSBTAB,1)=PSBATAB
56 E D
57 .I $G(PSBCNT)>0 S ^TMP("PSB",$J,PSBTAB,0)=PSBCNT
58 .I $G(PSBCNT)>1 S ^TMP("PSB",$J,PSBTAB,1)=PSBATAB_U_$S(PSBTRFL:PSBTRTYP_U_PSBMVTYP,1:"")
59 .I $G(PSBCNT)'>1 S ^TMP("PSB",$J,PSBTAB,1)=PSBATAB_U_^TMP("PSB",$J,PSBTAB,1)
60 F X="UDTAB","PBTAB","IVTAB" I X'=PSBTAB K ^TMP("PSB",$J,X)
61 D CLEAN^PSBVT K ^TMP("PSJ",$J),PSBATAB,PSBWADM,PSBWBEG,PSBWEND,PSBNOW,PSBTRDT,PSBPTTR,PSBTRFL,PSBNTDT,PSBTRTYP,PSBMVTYP
62 Q
63 ;
64TABINIT ;
65 F PSBX="UDTAB","PBTAB","IVTAB" D
66 .K ^TMP("PSB",$J,PSBX)
67 .S ^TMP("PSB",$J,PSBX,0)=1
68 .S ^TMP("PSB",$J,PSBX,1)="-1^No Administration(s) due at this time." Q
69 Q
70 ;
71DISCHRGD(DFN) ; Patient Discharged OR Deceased?
72 ;
73 S DISCHRGD=0
74 D DEM^VADPT I VADM(6)]"" S DISCHRGD=1 K VADM D Q DISCHRGD
75 .F PSBX="UDTAB","PBTAB","IVTAB","NO TAB" D
76 ..K ^TMP("PSB",$J,PSBX)
77 ..S ^TMP("PSB",$J,PSBX,0)=1,^TMP("PSB",$J,PSBX,1)="0^0^0^-1^A ""DATE OF DEATH"" has been logged for this patient."
78 D INP^VADPT I VAIN(1)']"" S DISCHRGD=1 K VAIN D Q DISCHRGD
79 .F PSBX="UDTAB","PBTAB","IVTAB","NO TAB" D
80 ..K ^TMP("PSB",$J,PSBX)
81 ..S ^TMP("PSB",$J,PSBX,0)=1,^TMP("PSB",$J,PSBX,1)="0^0^0^-1^The selected patient has been DISCHARGED."
82 Q DISCHRGD
83 ;
Note: See TracBrowser for help on using the repository browser.