source: WorldVistAEHR/trunk/r/BAR_CODE_MED_ADMIN-ALPB-PSB/PSBVDLPA.m@ 1087

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1PSBVDLPA ;BIRMINGHAM/EFC-BCMA UNIT DOSE VIRTUAL DUE LIST FUNCTIONS ;Mar 2004
2 ;;3.0;BAR CODE MED ADMIN;**5,16,13,38,32**;Mar 2004;Build 32
3 ;Per VHA Directive 2004-038 (or future revisions regarding same), this routine should not be modified.
4 ;
5 ; called by PSBVDLUD to find patches not removed
6 ;
7 ; Reference/IA
8 ; $$GET^XPAR/2263
9 ; $$FMADD^XLFDT/10103
10 ;
11EN ;
12 S PSBGNODE="^PSB(53.79,"_"""APATCH"""_","_DFN_")"
13 F S PSBGNODE=$Q(@PSBGNODE) Q:PSBGNODE']"" Q:($QS(PSBGNODE,2)'="APATCH")!($QS(PSBGNODE,3)'=DFN) D
14 .S PSBIEN=$QS(PSBGNODE,5)
15 .I '$D(^PSB(53.79,PSBIEN,.5,1)) Q
16 .I $P(^PSB(53.79,PSBIEN,.5,1,0),U,4)'="PATCH" Q
17 .I "G"'[$P(^PSB(53.79,PSBIEN,0),U,9)!($D(PSBONVDL(PSBIEN))) Q
18 .S PSBPBK=+($$GET^XPAR("DIV","PSB VDL PATCH DAYS"))
19 .S PSBZON=$P(^PSB(53.79,PSBIEN,.1),"^")
20 .D CLEAN^PSBVT
21 .D PSJ1^PSBVT(DFN,PSBZON)
22 .I PSBPBK'=0 D NOW^%DTC I ($$FMADD^XLFDT($P(PSBOSP,"."),(PSBPBK))<X) Q
23 .S $P(PSBREC,U,1)=DFN ; dfn
24 .S $P(PSBREC,U,2)=PSBONX ; order numer
25 .S $P(PSBREC,U,3)=PSBON ; order ien
26 .S $P(PSBREC,U,4)="U" ; order type U unit dose
27 .S $P(PSBREC,U,5)=PSBSCHT
28 .S $P(PSBREC,U,6)=PSBSCH
29 .S $P(PSBREC,U,7)=$S(PSBHSM:"HSM",PSBSM:"SM",1:"")
30 .S $P(PSBREC,U,8)=PSBOITX
31 .S $P(PSBREC,U,9)=PSBDOSE
32 .S $P(PSBREC,U,10)=PSBMR
33 .S:$D(PSBHSTAX(PSBOIT)) $P(PSBREC,U,11)=$O(PSBHSTAX(PSBOIT,""),-1),$P(PSBREC,U,20)=$O(PSBHSTAX(PSBOIT,$P(PSBREC,U,11),""),-1)
34 .D:'$D(PSBHSTAX(PSBOIT))
35 ..N PSBX,PSBY,PSBDONE S PSBDONE=0,PSBX="" F S PSBX=$O(^PSB(53.79,"AOIP",DFN,PSBOIT,PSBX),-1) Q:PSBX="" D:'PSBDONE
36 ...S PSBY="" F S PSBY=$O(^PSB(53.79,"AOIP",DFN,PSBOIT,PSBX,PSBY),-1) Q:PSBY="" D:'PSBDONE
37 ....S:$P(^PSB(53.79,PSBY,0),U,9)'="N" $P(PSBREC,U,20)=$P(^PSB(53.79,PSBY,0),U,9) S:($P(PSBREC,U,20)'="N")&($P(PSBREC,U,20)]"") $P(PSBREC,U,11)=PSBX,PSBDONE=1
38 .S $P(PSBREC,U,12)=PSBIEN
39 .S $P(PSBREC,U,13)="G"
40 .S $P(PSBREC,U,14)=$P(^PSB(53.79,PSBIEN,.1),U,3)
41 .I $P(PSBREC,U,14)="" S $P(PSBREC,U,14)=PSBNOW\1
42 .S $P(PSBREC,U,15)=PSBOIT
43 .D:($G(PSBTAB)="CVRSHT")!($G(PSBTAB)="UDTAB")
44 ..S $P(PSBREC,U,16)=$S($G(PSBX)="":0,1:PSBNJECT) ;Set injectable med route flag
45 ..I $P(PSBREC,U,9)?1.4N1"-"1.4N.E S $P(PSBREC,U,17)=1
46 ..E S $P(PSBREC,U,17)=0
47 ..S $P(PSBREC,U,19)=$S(PSBVNI]"":PSBVNI,PSBVNI']"":"***")
48 ..S $P(PSBREC,U,23)=""
49 ..S $P(PSBREC,U,26)=PSBOSP
50 ..S $P(PSBREC,U,27)=$$LASTG^PSBCSUTL($P(PSBREC,U),$P(PSBREC,U,15))
51 ..S $P(PSBREC,U,28)=0
52 ..I ($G(PSBTAB)="CVRSHT") S $P(PSBREC,U,28)=1
53 ..I ($G(PSBTAB)="UDTAB") I PSBSCHT'="O" S:(PSBOSTS="E")!(PSBOSTS["D") $P(PSBREC,U,28)=1
54 ..; Place into Coversheet activity ARRAY
55 ..S PSBDIDX="" I $D(^PSB(53.79,"AORD",DFN,PSBONX)) D
56 ...S PSBXDTI="",PSBXDTI=$O(^PSB(53.79,"AORD",DFN,PSBONX,PSBXDTI),-1)
57 ...Q:'$D(^PSB(53.79,"AORD",DFN,PSBONX,PSBXDTI,PSBIEN))
58 ...S PSBADMX(PSBONX,PSBXDTI,PSBIEN)="",PSBDIDX=1
59 ..I ('PSBDIDX)&$D(^PSB(53.79,"AORDX",DFN,PSBONX)) D
60 ...S PSBXXDTI="",PSBXXDTI=$O(^PSB(53.79,"AORDX",DFN,PSBONX,PSBXXDTI),-1)
61 ...Q:'$D(^PSB(53.79,"AORDX",DFN,PSBONX,PSBXXDTI,PSBIEN))
62 ...S PSBADMX(PSBONX,PSBXXDTI,PSBIEN)=""
63 .S $P(PSBREC,U,18)="PATCH"
64 .S $P(PSBREC,U,21)=PSBOST
65 .S $P(PSBREC,U,22)=PSBOSTS
66 .S PSBDDS="" F Y=0:0 S Y=$O(PSBDDA(Y)) Q:'Y S:$P(PSBDDA(Y),U,4)="" $P(PSBDDA(Y),U,4)=1 S PSBDDS=PSBDDS_U_$P(PSBDDA(Y),U,1,4),$P(PSBDDS,U,1)=PSBDDS+1
67 .S PSBQRR=1
68 .D ADD^PSBVDLU1(PSBREC,PSBOTXT,$P(PSBREC,U,14),PSBDDS,"","",$S($G(PSBTAB)="CVRSHT":"CVRSHT",1:"UDTAB"))
69 K PSBPBK,PSBONVDL
70 Q
Note: See TracBrowser for help on using the repository browser.