source: WorldVistAEHR/trunk/r/BAR_CODE_MED_ADMIN-ALPB-PSB/PSBOPE.m@ 1438

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1PSBOPE ;BIRMINGHAM/EFC-PRN EFFECTIVENESS WORKSHEET ;Mar 2004
2 ;;3.0;BAR CODE MED ADMIN;**5,23,32**;Mar 2004;Build 32
3 ;Per VHA Directive 2004-038 (or future revisions regarding same), this routine should not be modified.
4 ;
5 ; Reference/IA
6 ; ^DPT/10035
7 ; EN^PSJBCMA/2828
8 ;
9EN ; Called from DQ^PSBO
10 N PSBSTRT,PSBSTOP,DFN
11 K ^TMP("PSB",$J)
12 S PSBSTRT=$P(PSBRPT(.1),U,6)+$P(PSBRPT(.1),U,7)
13 S PSBSTOP=$P(PSBRPT(.1),U,8)+$P(PSBRPT(.1),U,9)
14 F DFN=0:0 S DFN=$O(^TMP("PSBO",$J,DFN)) Q:'DFN D EN1
15 D PRINT
16 K ^TMP("PSJ",$J),^TMP("PSB",$J)
17 Q
18 ;
19EN1 ; Expects DFN,PSBSTRT,PSBSTOP from EN
20 N PSBGBL,PSBHDR,PSBX,PSBADMIN,PSBDFN,PSBDT,PSBMED,PSBORD,PSBOSTRT,PSBSCHED
21 K ^TMP("PSJ",$J)
22 S PSBDT=PSBSTRT-.0000001
23 F S PSBDT=$O(^PSB(53.79,"AADT",DFN,PSBDT)) Q:'PSBDT!(PSBDT>PSBSTOP) D
24 .S PSBIEN=0
25 .F S PSBIEN=$O(^PSB(53.79,"AADT",DFN,PSBDT,PSBIEN)) Q:'PSBIEN D
26 ..Q:$P($G(^PSB(53.79,PSBIEN,.1)),U,2)'="P" ; Not a PRN Administration
27 ..Q:$P($G(^PSB(53.79,PSBIEN,.2)),U,2)]"" ; Effectiveness entered
28 ..Q:($P($G(^PSB(53.79,PSBIEN,0)),U,9)'="G")&($P($G(^PSB(53.79,PSBIEN,0)),U,9)'="RM") ;Allow only entries with at status of "GIVEN" and "REMOVED"
29 ..Q:$P($G(^PSB(53.79,PSBIEN,0)),U,6)<PSBDT
30 ..Q:$P($G(^PSB(53.79,PSBIEN,0)),U,6)>PSBSTOP
31 ..S ^TMP("PSB",$J,DFN,PSBIEN)=""
32 Q
33PRINT ; Print meds stored in ^TMP("PSB",$J,DFN,....
34 N PSBHDR,PSBDT,PSBMED,DFN
35 ;
36 ; Print by Patient
37 ;
38 D:$P(PSBRPT(.1),U,1)="P"
39 .S PSBHDR(1)="PRN EFFECTIVENESS LIST for "_$$FMTE^XLFDT(PSBSTRT)_" to "_$$FMTE^XLFDT(PSBSTOP)
40 .S DFN=$P(PSBRPT(.1),U,2)
41 .W $$PTHDR()
42 .I '$O(^TMP("PSB",$J,DFN,0)) W !,"No PRN Medications Found",$$PTFTR^PSBOHDR() Q
43 .W ! ; Line Break Between Admin Times
44 .S PSBIEN=""
45 .F S PSBIEN=$O(^TMP("PSB",$J,DFN,PSBIEN)) Q:PSBIEN="" D
46 ..S PSBIENS=PSBIEN_","
47 ..I $Y>(IOSL-5) W $$PTFTR^PSBOHDR(),$$PTHDR()
48 ..W !,$$GET1^DIQ(53.79,PSBIENS,.06),?30,$$GET1^DIQ(53.79,PSBIENS,.08),?72,$$GET1^DIQ(53.79,PSBIENS,"ACTION BY")
49 ..W !,?5,"PRN Reason: ",$$GET1^DIQ(53.79,PSBIENS,.21)
50 .W $$PTFTR^PSBOHDR()
51 .Q
52 ;
53 ; Print by Ward
54 ;
55 D:$P(PSBRPT(.1),U,1)="W"
56 .S PSBHDR(1)="PRN EFFECTIVENESS LIST from "_$$FMTE^XLFDT(PSBSTRT)_" thru "_$$FMTE^XLFDT(PSBSTOP)
57 .S PSBWARD=$P(PSBRPT(.1),U,3)
58 .W $$WRDHDR()
59 .I '$O(^TMP("PSB",$J,0)) W !,"No PRN Medications Found" Q
60 .S PSBSORT=$P(PSBRPT(.1),U,5)
61 .F DFN=0:0 S DFN=$O(^TMP("PSB",$J,DFN)) Q:'DFN D
62 ..S PSBINDX=$S(PSBSORT="P":$P(^DPT(DFN,0),U),1:$G(^DPT(DFN,.1))_" "_$G(^DPT(DFN,.101))) ;PSB*3*23
63 ..S:PSBINDX="" PSBINDX=$P(^DPT(DFN,0),U)
64 ..S ^TMP("PSB",$J,"B",PSBINDX,DFN)=""
65 .S PSBINDX=""
66 .F S PSBINDX=$O(^TMP("PSB",$J,"B",PSBINDX)) Q:PSBINDX="" D
67 ..F DFN=0:0 S DFN=$O(^TMP("PSB",$J,"B",PSBINDX,DFN)) Q:'DFN D
68 ...W ! ; Line Break Between Pt's
69 ...W:$P(PSBRPT(.1),U,5)="P" !,$$GET1^DIQ(2,DFN_",",.01),?32,$$GET1^DIQ(2,DFN_",",.1)," ",$$GET1^DIQ(2,DFN_",",.101)
70 ...W:$P(PSBRPT(.1),U,5)="B" !,$$GET1^DIQ(2,DFN_",",.1)," ",$$GET1^DIQ(2,DFN_",",.101),?20,$$GET1^DIQ(2,DFN_",",.01)
71 ...W ! ; Line Break Between Admin Times
72 ...S PSBIEN=""
73 ...F S PSBIEN=$O(^TMP("PSB",$J,DFN,PSBIEN)) Q:PSBIEN="" D
74 ....I $Y>(IOSL-5) W $$WRDHDR()
75 ....W !?5,$$GET1^DIQ(53.79,PSBIEN_",",.06),?35,$$GET1^DIQ(53.79,PSBIEN_",",.08),?77,$$GET1^DIQ(53.79,PSBIEN_",","ACTION BY")
76 ....W !?10,"PRN Reason: ",$$GET1^DIQ(53.79,PSBIEN_",",.21)
77 Q
78 ;
79WRDHDR() ; Ward Header
80 D WARD^PSBOHDR(PSBWRD,.PSBHDR)
81 W:$P(PSBRPT(.1),U,5)="B" !,"Ward Rm-Bed",?20,"Patient"
82 W:$P(PSBRPT(.1),U,5)="P" !,"Patient",?32,"Ward Rm-Bed"
83 W !?5,"Administration Date/Time",?35,"Medication",?77,"Administered By"
84 W !,$TR($J("",IOM)," ","-")
85 Q ""
86 ;
87PTHDR() ; Patient Header
88 D PT^PSBOHDR(DFN,.PSBHDR)
89 W !,"Administration Date/Time",?30,"Medication",?72,"Administered By"
90 W !,$TR($J("",IOM)," ","-")
91 Q ""
92 ;
Note: See TracBrowser for help on using the repository browser.