- ALPBFRM1 ;OIFO-DALLAS MW,SED,KC -STANDARD PRINT FORMATTING UTIL;01/01/03
- ;;3.0;BAR CODE MED ADMIN;**8**;Mar 2004
- ;
- F132(DATA,DAYS,MLCNT,RESULTS,ALPPAT) ; format data into a 132-column
- ; output array...
- ; DATA = an array containing a specific order node for a selected
- ; patient in file 53.7
- ; DAYS = a number that represents the number of initial boxes
- ; (1 box = 1 day) to add to lines 4-10 (max=7 -- note that
- ; this is usually a 3-day MAR, but a 7-day MAR could be
- ; returned from this format utility)
- ; MLCNT = Number of Med-log entries to print with orders
- ; RESULTS = an array passed by reference into which the formatted
- ; entry is set up returns a formatted array in RESULTS
- ; (note: total line count is returned at RESULTS(0))
- I $D(DATA)="" Q
- ;
- N ALPBADM,ALPBDAYS,ALPBDRUG,ALPBIBOX,ALPBNBOX,ALPBPBOX,ALPBSTOP,ALPBTEXT,ALPBTIME,ALPBX,DATE,LINE,BOLDON,BOLDOFF,X,ALPBPRNG,ALPBFLG,ALPBPRN,ALPBMLC
- ; to use BOLD, comment out the next line and remove comments from
- ; the following five lines...
- S BOLDON="<<",BOLDOFF=">>"
- ;S X="IOINHI;IOINORM"
- ;D ENDR^%ZISS
- ;S BOLDON=$G(IOINHI)
- ;S BOLDOFF=$G(IOINORM)
- ;D KILL^%ZISS
- ;
- ;S MLCNT=$S(+$P($G(^ALPB(53.71,1,2)),U,4)>0:+$P(^ALPB(53.71,1,2),U,4),1:1)
- I $G(DAYS)="" S DAYS=3
- I DAYS>7 S DAYS=7
- S DATE=$$DT^XLFDT()
- D FDATES^ALPBUTL(DATE,DAYS,.ALPBDAYS)
- ; get administration timing (needed for formatting various lines)
- S ALPBX=$P($G(DATA(4)),"^",4)
- I ALPBX="" S ALPBADM=0
- I ALPBX'="" D
- .S ALPBADM=0
- .F I=1:1 Q:$P(ALPBX,"-",I)="" D
- ..S ALPBADM(I)=$P(ALPBX,"-",I)
- ..S ALPBADM=ALPBADM+1
- ; line 1...
- S RESULTS(1)=""
- S RESULTS(1)=$$PAD^ALPBUTL(RESULTS(1),66)_"Admin"
- ; line 2...
- S RESULTS(2)="Start"
- S RESULTS(2)=$$PAD^ALPBUTL(RESULTS(2),25)_"Stop"
- S RESULTS(2)=$$PAD^ALPBUTL(RESULTS(2),66)_"Times"
- S RESULTS(2)=$$PAD^ALPBUTL(RESULTS(2),74)_ALPBDAYS(0)
- I DAYS=3 S RESULTS(2)=RESULTS(2)_" Notes"
- ; line 3...
- S RESULTS(3)=$$REPEAT^XLFSTR("-",132)
- ; line 4...
- ; start and stop date/times...
- S RESULTS(4)=$S($P($G(DATA(1)),"^")'="":$$FMTE^XLFDT($P(DATA(1),"^")),1:"Not on file")
- S RESULTS(4)=$$PAD^ALPBUTL(RESULTS(4),25)_$S($P($G(DATA(1)),"^",2)'="":$$FMTE^XLFDT($P(DATA(1),"^",2)),1:"Not on file")
- ;
- ; end of fixed line format, continue...
- S LINE=4
- ; get drug(s)...
- I +$O(DATA(7,0)) D
- .S LINE=LINE+1
- .S RESULTS(LINE)=""
- .S ALPBX=0
- .F S ALPBX=$O(DATA(7,ALPBX)) Q:'ALPBX D
- ..S ALPBDRUG=$G(BOLDON)_$P(DATA(7,ALPBX,0),"^",2)_$G(BOLDOFF)
- ..;S RESULTS(LINE)=$G(RESULTS(LINE))_$P(DATA(7,ALPBX,0),"^",2)
- ..S RESULTS(LINE)=$G(RESULTS(LINE))_ALPBDRUG
- ..K ALPBDRUG
- ..I +$O(DATA(7,ALPBX)) S LINE=LINE+1
- ; any additives...
- I +$O(DATA(8,0)) D
- .S LINE=LINE+1
- .S RESULTS(LINE)=" Additive(s): "
- .S ALPBX=0
- .F S ALPBX=$O(DATA(8,ALPBX)) Q:'ALPBX D
- ..S ALPBDRUG=$P(DATA(8,ALPBX,0),"^",2)
- ..; if UNITS is not already contained in ADDITIVE NAME, add it...
- ..I $P(DATA(8,ALPBX,0),"^",3)'=""&(ALPBDRUG'[$P(DATA(8,ALPBX,0),"^",3)) S ALPBDRUG=ALPBDRUG_" "_$P(DATA(8,ALPBX,0),"^",3)
- ..S ALPBDRUG=$G(BOLDON)_ALPBDRUG_$G(BOLDOFF)
- ..S RESULTS(LINE)=RESULTS(LINE)_ALPBDRUG
- ..K ALPBDRUG
- ..I +$O(DATA(8,ALPBX)) D
- ...S LINE=LINE+1
- ...S RESULTS(LINE)=" "
- ...S RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),14)
- .K ALPBX
- ; any solutions...
- I +$O(DATA(9,0)) D
- .S LINE=LINE+1
- .S RESULTS(LINE)=" Solution(s): "
- .S ALPBX=0
- .F S ALPBX=$O(DATA(9,ALPBX)) Q:'ALPBX D
- ..S ALPBDRUG=$P(DATA(9,ALPBX,0),"^",2)
- ..; if UNITS is not already contained in SOLUTION NAME, add it...
- ..I $P(DATA(9,ALPBX,0),"^",3)'=""&(ALPBDRUG'[$P(DATA(9,ALPBX,0),"^",3)) S ALPBDRUG=ALPBDRUG_" "_$P(DATA(9,ALPBX,0),"^",3)
- ..S ALPBDRUG=$G(BOLDON)_ALPBDRUG_$G(BOLDOFF)
- ..S RESULTS(LINE)=RESULTS(LINE)_ALPBDRUG
- ..K ALPBDRUG
- ..I +$O(DATA(9,ALPBX)) D
- ...S LINE=LINE+1
- ...S RESULTS(LINE)=" "
- ...S RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),14)
- .K ALPBX
- ; give ($P(DATA(4),"^",1)=DOSAGE $P(DATA(4),"^",2)=ROUTE $P(DATA(4),"^",3)=SCHEDULE)...
- S LINE=LINE+1
- S RESULTS(LINE)=" Give: "_$P($G(DATA(4)),"^")_" "_$P($G(DATA(4)),"^",2)_" "_$P($G(DATA(4)),"^",3)
- ;Set PRN Flag
- S ALPBPRNG=0
- S:$P($G(DATA(4)),"^",3)["PRN" ALPBPRNG=1
- ;
- ; provider comments, special instructions, and other print info...
- I +$O(DATA(5,0)) D
- .K ALPBCMNT
- .M ALPBCMNT=DATA(5)
- .S ALPBCOL=60
- .D FTEXT^ALPBFRMU(ALPBCOL,.ALPBCMNT,.ALPBTEXT)
- .K ALPBCMNT
- .S ALPBX=0
- .F S ALPBX=$O(ALPBTEXT(ALPBX)) Q:'ALPBX D
- ..S ALPBLINE=ALPBTEXT(ALPBX,0)
- ..S LINE=LINE+1
- ..S RESULTS(LINE)=ALPBLINE
- .K ALPBCOL,ALPBLINE,ALPBTEXT,ALPBX
- ;S LINE=LINE+1,RESULTS(LINE)=""
- ;
- ; provider, pharmacist or entry person, and verifier...
- S LINE=LINE+1
- S RESULTS(LINE)=" Provider: "_$P($G(DATA(2)),"^")
- S LINE=LINE+1
- S RESULTS(LINE)="RPh/Entry by: "_$P($G(DATA(2)),"^",2)
- I $P($G(DATA(2)),"^",3)'="" D
- .S LINE=LINE+1
- .S RESULTS(LINE)=" Verified by: "_$P(DATA(2),"^",3)
- ; order number and type...
- S LINE=LINE+1
- S RESULTS(LINE)=" Order #: "_$P(DATA(0),"^")
- S RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),25)_"Type: "_$$OTYP^ALPBUTL($P($G(DATA(3)),"^"))
- ; order status...
- S LINE=LINE+1
- S RESULTS(LINE)=" Status: "_$P($P(DATA(0),"^",3),"~",2)
- ;
- ; med log data...
- S LINE=LINE+1
- S RESULTS(LINE)="BCMA MEDICATION LOG HISTORY"
- ;I $G(MLDATE)'="" S RESULTS(LINE)=RESULTS(LINE)_" (since "_$$FMTE^XLFDT(MLDATE)_")"
- I +$O(DATA(10,0))=0 D
- .S LINE=LINE+1
- .S RESULTS(LINE)=" No Medication Log entries are on file for this order."
- I +$O(DATA(10,0)) D
- .S LINE=LINE+1
- .S RESULTS(LINE)=" Log Date"
- .S RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),16)_"Message"
- .S RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),31)_"Log Entry Person"
- .I $O(DATA(10,"IMLOG",0))="" D
- ..S LINE=LINE+1
- ..S RESULTS(LINE)=" No entries since the above date are on file."
- .;S ALPBMDT=MLDATE
- .S ALPBMDT=0,ALPBMLC=1
- .F S ALPBMDT=$O(DATA(10,"IMLOG",ALPBMDT)) Q:'ALPBMDT!(ALPBMLC>MLCNT) D
- ..S ALPBX=0
- ..F S ALPBX=$O(DATA(10,"IMLOG",ALPBMDT,ALPBX)) Q:'ALPBX!(ALPBMLC>MLCNT) D
- ...S LINE=LINE+1,ALPBMLC=ALPBMLC+1
- ...S RESULTS(LINE)=" "_$$FDATE^ALPBUTL($P(DATA(10,ALPBX,0),"^",1))
- ...S RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),16)_$P(DATA(10,ALPBX,0),"^",3)
- ...S RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),31)_$S($P(DATA(10,ALPBX,0),"^",2)'="":$P(DATA(10,ALPBX,0),"^",2),1:"<not on file")
- ..K ALPBX
- .K ALPBMDT,ALPBMLC
- ;
- ; BCMA LAST ACTION
- I +$G(ALPPAT)>0 D
- .S ALPBX=0
- .F S ALPBX=$O(DATA(7,ALPBX)) Q:'ALPBX D
- ..S ALPDRUG=$P(DATA(7,ALPBX,0),"^",1),ALPBDNM=$P(DATA(7,ALPBX,0),"^",2)
- ..Q:+ALPDRUG'>0
- ..S ALPLACT=$$LACT^ALPBUTL3(ALPPAT,ALPDRUG)
- ..I ALPLACT'="" D
- ...S LINE=LINE+1,RESULTS(LINE)=$$REPEAT^XLFSTR("-",75)
- ...S LINE=LINE+1
- ...S RESULTS(LINE)="Last action for "_ALPBDNM_" "_" was "_$P(ALPLACT,"^",3)_" on "_$$FDATE^ALPBUTL($P(ALPLACT,"^",1))
- ...S RESULTS(LINE)=RESULTS(LINE)_" By "_$S($P(ALPLACT,"^",2)'="":$P(ALPLACT,"^",2),1:"<not on file>")
- K ALPLACT,ALPDRUG,ALPBX
- ;
- I LINE<11 F I=1:1 Q:LINE=11 D
- .S LINE=LINE+1
- .S RESULTS(LINE)=""
- ;
- ; now add admin times and initial boxes to lines 4-10 as required
- ; by number of administration times...
- S ALPBIBOX="______|"
- S ALPBNBOX="******|"
- I +$G(ALPBADM)=0 S ALPBADM=8
- ;S ALPBPRN=ALPBADM+4
- S ALPBSTOP=$P($G(DATA(1)),"^",2)
- F I=1:1:ALPBADM D
- .S ALPBPRN=I+3
- .S ALPBADMT=$G(ALPBADM(I))
- .I ALPBADMT="" S ALPBADMT=" "
- .I '$D(RESULTS(I+3)) D
- ..S RESULTS(I+3)=" "
- ..S LINE=LINE+1
- .S RESULTS(I+3)=$$PAD^ALPBUTL(RESULTS(I+3),65)_"| "
- .S RESULTS(I+3)=RESULTS(I+3)_$S($L(ALPBADMT)=2:ALPBADMT_"00",1:ALPBADMT)
- .S RESULTS(I+3)=$$PAD^ALPBUTL(RESULTS(I+3),74)_"|"
- .F J=1:1:DAYS D
- ..S ALPBDAY=ALPBDAYS(J)_"."_ALPBADMT
- ..S ALPBPBOX=ALPBIBOX
- ..I ALPBDAY=ALPBSTOP!(ALPBDAY>ALPBSTOP) S ALPBPBOX=ALPBNBOX
- ..S RESULTS(I+3)=RESULTS(I+3)_ALPBPBOX
- .K ALPBADMT,ALPBPBOX,ALPBDAY
- K ALPBIBOX,ALPBNBOX
- ; if PRN med, add line for documenting effectiveness...
- I +ALPBPRNG D
- .S ALPBFLG=0,ALPBPRN=ALPBPRN+1
- .S:'$D(RESULTS(ALPBPRN)) RESULTS(ALPBPRN)=" ",ALPBFLG=1
- .S RESULTS(ALPBPRN)=$$PAD^ALPBUTL(RESULTS(ALPBPRN),63)_" PRN Effectiveness:_____________"
- .S:ALPBFLG LINE=LINE+1
- S LINE=LINE+1
- S RESULTS(LINE)=$$REPEAT^XLFSTR("-",132)
- S RESULTS(0)=LINE
- Q
- ALPBFRM1 ;OIFO-DALLAS MW,SED,KC -STANDARD PRINT FORMATTING UTIL;01/01/03
- +1 ;;3.0;BAR CODE MED ADMIN;**8**;Mar 2004
- +2 ;
- F132(DATA,DAYS,MLCNT,RESULTS,ALPPAT) ; format data into a 132-column
- +1 ; output array...
- +2 ; DATA = an array containing a specific order node for a selected
- +3 ; patient in file 53.7
- +4 ; DAYS = a number that represents the number of initial boxes
- +5 ; (1 box = 1 day) to add to lines 4-10 (max=7 -- note that
- +6 ; this is usually a 3-day MAR, but a 7-day MAR could be
- +7 ; returned from this format utility)
- +8 ; MLCNT = Number of Med-log entries to print with orders
- +9 ; RESULTS = an array passed by reference into which the formatted
- +10 ; entry is set up returns a formatted array in RESULTS
- +11 ; (note: total line count is returned at RESULTS(0))
- +12 IF $DATA(DATA)=""
- QUIT
- +13 ;
- +14 NEW ALPBADM,ALPBDAYS,ALPBDRUG,ALPBIBOX,ALPBNBOX,ALPBPBOX,ALPBSTOP,ALPBTEXT,ALPBTIME,ALPBX,DATE,LINE,BOLDON,BOLDOFF,X,ALPBPRNG,ALPBFLG,ALPBPRN,ALPBMLC
- +15 ; to use BOLD, comment out the next line and remove comments from
- +16 ; the following five lines...
- +17 SET BOLDON="<<"
- SET BOLDOFF=">>"
- +18 ;S X="IOINHI;IOINORM"
- +19 ;D ENDR^%ZISS
- +20 ;S BOLDON=$G(IOINHI)
- +21 ;S BOLDOFF=$G(IOINORM)
- +22 ;D KILL^%ZISS
- +23 ;
- +24 ;S MLCNT=$S(+$P($G(^ALPB(53.71,1,2)),U,4)>0:+$P(^ALPB(53.71,1,2),U,4),1:1)
- +25 IF $GET(DAYS)=""
- SET DAYS=3
- +26 IF DAYS>7
- SET DAYS=7
- +27 SET DATE=$$DT^XLFDT()
- +28 DO FDATES^ALPBUTL(DATE,DAYS,.ALPBDAYS)
- +29 ; get administration timing (needed for formatting various lines)
- +30 SET ALPBX=$PIECE($GET(DATA(4)),"^",4)
- +31 IF ALPBX=""
- SET ALPBADM=0
- +32 IF ALPBX'=""
- Begin DoDot:1
- +33 SET ALPBADM=0
- +34 FOR I=1:1
- IF $PIECE(ALPBX,"-",I)=""
- QUIT
- Begin DoDot:2
- +35 SET ALPBADM(I)=$PIECE(ALPBX,"-",I)
- +36 SET ALPBADM=ALPBADM+1
- End DoDot:2
- End DoDot:1
- +37 ; line 1...
- +38 SET RESULTS(1)=""
- +39 SET RESULTS(1)=$$PAD^ALPBUTL(RESULTS(1),66)_"Admin"
- +40 ; line 2...
- +41 SET RESULTS(2)="Start"
- +42 SET RESULTS(2)=$$PAD^ALPBUTL(RESULTS(2),25)_"Stop"
- +43 SET RESULTS(2)=$$PAD^ALPBUTL(RESULTS(2),66)_"Times"
- +44 SET RESULTS(2)=$$PAD^ALPBUTL(RESULTS(2),74)_ALPBDAYS(0)
- +45 IF DAYS=3
- SET RESULTS(2)=RESULTS(2)_" Notes"
- +46 ; line 3...
- +47 SET RESULTS(3)=$$REPEAT^XLFSTR("-",132)
- +48 ; line 4...
- +49 ; start and stop date/times...
- +50 SET RESULTS(4)=$SELECT($PIECE($GET(DATA(1)),"^")'="":$$FMTE^XLFDT($PIECE(DATA(1),"^")),1:"Not on file")
- +51 SET RESULTS(4)=$$PAD^ALPBUTL(RESULTS(4),25)_$SELECT($PIECE($GET(DATA(1)),"^",2)'="":$$FMTE^XLFDT($PIECE(DATA(1),"^",2)),1:"Not on file")
- +52 ;
- +53 ; end of fixed line format, continue...
- +54 SET LINE=4
- +55 ; get drug(s)...
- +56 IF +$ORDER(DATA(7,0))
- Begin DoDot:1
- +57 SET LINE=LINE+1
- +58 SET RESULTS(LINE)=""
- +59 SET ALPBX=0
- +60 FOR
- SET ALPBX=$ORDER(DATA(7,ALPBX))
- IF 'ALPBX
- QUIT
- Begin DoDot:2
- +61 SET ALPBDRUG=$GET(BOLDON)_$PIECE(DATA(7,ALPBX,0),"^",2)_$GET(BOLDOFF)
- +62 ;S RESULTS(LINE)=$G(RESULTS(LINE))_$P(DATA(7,ALPBX,0),"^",2)
- +63 SET RESULTS(LINE)=$GET(RESULTS(LINE))_ALPBDRUG
- +64 KILL ALPBDRUG
- +65 IF +$ORDER(DATA(7,ALPBX))
- SET LINE=LINE+1
- End DoDot:2
- End DoDot:1
- +66 ; any additives...
- +67 IF +$ORDER(DATA(8,0))
- Begin DoDot:1
- +68 SET LINE=LINE+1
- +69 SET RESULTS(LINE)=" Additive(s): "
- +70 SET ALPBX=0
- +71 FOR
- SET ALPBX=$ORDER(DATA(8,ALPBX))
- IF 'ALPBX
- QUIT
- Begin DoDot:2
- +72 SET ALPBDRUG=$PIECE(DATA(8,ALPBX,0),"^",2)
- +73 ; if UNITS is not already contained in ADDITIVE NAME, add it...
- +74 IF $PIECE(DATA(8,ALPBX,0),"^",3)'=""&(ALPBDRUG'[$PIECE(DATA(8,ALPBX,0),"^",3))
- SET ALPBDRUG=ALPBDRUG_" "_$PIECE(DATA(8,ALPBX,0),"^",3)
- +75 SET ALPBDRUG=$GET(BOLDON)_ALPBDRUG_$GET(BOLDOFF)
- +76 SET RESULTS(LINE)=RESULTS(LINE)_ALPBDRUG
- +77 KILL ALPBDRUG
- +78 IF +$ORDER(DATA(8,ALPBX))
- Begin DoDot:3
- +79 SET LINE=LINE+1
- +80 SET RESULTS(LINE)=" "
- +81 SET RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),14)
- End DoDot:3
- End DoDot:2
- +82 KILL ALPBX
- End DoDot:1
- +83 ; any solutions...
- +84 IF +$ORDER(DATA(9,0))
- Begin DoDot:1
- +85 SET LINE=LINE+1
- +86 SET RESULTS(LINE)=" Solution(s): "
- +87 SET ALPBX=0
- +88 FOR
- SET ALPBX=$ORDER(DATA(9,ALPBX))
- IF 'ALPBX
- QUIT
- Begin DoDot:2
- +89 SET ALPBDRUG=$PIECE(DATA(9,ALPBX,0),"^",2)
- +90 ; if UNITS is not already contained in SOLUTION NAME, add it...
- +91 IF $PIECE(DATA(9,ALPBX,0),"^",3)'=""&(ALPBDRUG'[$PIECE(DATA(9,ALPBX,0),"^",3))
- SET ALPBDRUG=ALPBDRUG_" "_$PIECE(DATA(9,ALPBX,0),"^",3)
- +92 SET ALPBDRUG=$GET(BOLDON)_ALPBDRUG_$GET(BOLDOFF)
- +93 SET RESULTS(LINE)=RESULTS(LINE)_ALPBDRUG
- +94 KILL ALPBDRUG
- +95 IF +$ORDER(DATA(9,ALPBX))
- Begin DoDot:3
- +96 SET LINE=LINE+1
- +97 SET RESULTS(LINE)=" "
- +98 SET RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),14)
- End DoDot:3
- End DoDot:2
- +99 KILL ALPBX
- End DoDot:1
- +100 ; give ($P(DATA(4),"^",1)=DOSAGE $P(DATA(4),"^",2)=ROUTE $P(DATA(4),"^",3)=SCHEDULE)...
- +101 SET LINE=LINE+1
- +102 SET RESULTS(LINE)=" Give: "_$PIECE($GET(DATA(4)),"^")_" "_$PIECE($GET(DATA(4)),"^",2)_" "_$PIECE($GET(DATA(4)),"^",3)
- +103 ;Set PRN Flag
- +104 SET ALPBPRNG=0
- +105 IF $PIECE($GET(DATA(4)),"^",3)["PRN"
- SET ALPBPRNG=1
- +106 ;
- +107 ; provider comments, special instructions, and other print info...
- +108 IF +$ORDER(DATA(5,0))
- Begin DoDot:1
- +109 KILL ALPBCMNT
- +110 MERGE ALPBCMNT=DATA(5)
- +111 SET ALPBCOL=60
- +112 DO FTEXT^ALPBFRMU(ALPBCOL,.ALPBCMNT,.ALPBTEXT)
- +113 KILL ALPBCMNT
- +114 SET ALPBX=0
- +115 FOR
- SET ALPBX=$ORDER(ALPBTEXT(ALPBX))
- IF 'ALPBX
- QUIT
- Begin DoDot:2
- +116 SET ALPBLINE=ALPBTEXT(ALPBX,0)
- +117 SET LINE=LINE+1
- +118 SET RESULTS(LINE)=ALPBLINE
- End DoDot:2
- +119 KILL ALPBCOL,ALPBLINE,ALPBTEXT,ALPBX
- End DoDot:1
- +120 ;S LINE=LINE+1,RESULTS(LINE)=""
- +121 ;
- +122 ; provider, pharmacist or entry person, and verifier...
- +123 SET LINE=LINE+1
- +124 SET RESULTS(LINE)=" Provider: "_$PIECE($GET(DATA(2)),"^")
- +125 SET LINE=LINE+1
- +126 SET RESULTS(LINE)="RPh/Entry by: "_$PIECE($GET(DATA(2)),"^",2)
- +127 IF $PIECE($GET(DATA(2)),"^",3)'=""
- Begin DoDot:1
- +128 SET LINE=LINE+1
- +129 SET RESULTS(LINE)=" Verified by: "_$PIECE(DATA(2),"^",3)
- End DoDot:1
- +130 ; order number and type...
- +131 SET LINE=LINE+1
- +132 SET RESULTS(LINE)=" Order #: "_$PIECE(DATA(0),"^")
- +133 SET RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),25)_"Type: "_$$OTYP^ALPBUTL($PIECE($GET(DATA(3)),"^"))
- +134 ; order status...
- +135 SET LINE=LINE+1
- +136 SET RESULTS(LINE)=" Status: "_$PIECE($PIECE(DATA(0),"^",3),"~",2)
- +137 ;
- +138 ; med log data...
- +139 SET LINE=LINE+1
- +140 SET RESULTS(LINE)="BCMA MEDICATION LOG HISTORY"
- +141 ;I $G(MLDATE)'="" S RESULTS(LINE)=RESULTS(LINE)_" (since "_$$FMTE^XLFDT(MLDATE)_")"
- +142 IF +$ORDER(DATA(10,0))=0
- Begin DoDot:1
- +143 SET LINE=LINE+1
- +144 SET RESULTS(LINE)=" No Medication Log entries are on file for this order."
- End DoDot:1
- +145 IF +$ORDER(DATA(10,0))
- Begin DoDot:1
- +146 SET LINE=LINE+1
- +147 SET RESULTS(LINE)=" Log Date"
- +148 SET RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),16)_"Message"
- +149 SET RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),31)_"Log Entry Person"
- +150 IF $ORDER(DATA(10,"IMLOG",0))=""
- Begin DoDot:2
- +151 SET LINE=LINE+1
- +152 SET RESULTS(LINE)=" No entries since the above date are on file."
- End DoDot:2
- +153 ;S ALPBMDT=MLDATE
- +154 SET ALPBMDT=0
- SET ALPBMLC=1
- +155 FOR
- SET ALPBMDT=$ORDER(DATA(10,"IMLOG",ALPBMDT))
- IF 'ALPBMDT!(ALPBMLC>MLCNT)
- QUIT
- Begin DoDot:2
- +156 SET ALPBX=0
- +157 FOR
- SET ALPBX=$ORDER(DATA(10,"IMLOG",ALPBMDT,ALPBX))
- IF 'ALPBX!(ALPBMLC>MLCNT)
- QUIT
- Begin DoDot:3
- +158 SET LINE=LINE+1
- SET ALPBMLC=ALPBMLC+1
- +159 SET RESULTS(LINE)=" "_$$FDATE^ALPBUTL($PIECE(DATA(10,ALPBX,0),"^",1))
- +160 SET RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),16)_$PIECE(DATA(10,ALPBX,0),"^",3)
- +161 SET RESULTS(LINE)=$$PAD^ALPBUTL(RESULTS(LINE),31)_$SELECT($PIECE(DATA(10,ALPBX,0),"^",2)'="":$PIECE(DATA(10,ALPBX,0),"^",2),1:"<not on file")
- End DoDot:3
- +162 KILL ALPBX
- End DoDot:2
- +163 KILL ALPBMDT,ALPBMLC
- End DoDot:1
- +164 ;
- +165 ; BCMA LAST ACTION
- +166 IF +$GET(ALPPAT)>0
- Begin DoDot:1
- +167 SET ALPBX=0
- +168 FOR
- SET ALPBX=$ORDER(DATA(7,ALPBX))
- IF 'ALPBX
- QUIT
- Begin DoDot:2
- +169 SET ALPDRUG=$PIECE(DATA(7,ALPBX,0),"^",1)
- SET ALPBDNM=$PIECE(DATA(7,ALPBX,0),"^",2)
- +170 IF +ALPDRUG'>0
- QUIT
- +171 SET ALPLACT=$$LACT^ALPBUTL3(ALPPAT,ALPDRUG)
- +172 IF ALPLACT'=""
- Begin DoDot:3
- +173 SET LINE=LINE+1
- SET RESULTS(LINE)=$$REPEAT^XLFSTR("-",75)
- +174 SET LINE=LINE+1
- +175 SET RESULTS(LINE)="Last action for "_ALPBDNM_" "_" was "_$PIECE(ALPLACT,"^",3)_" on "_$$FDATE^ALPBUTL($PIECE(ALPLACT,"^",1))
- +176 SET RESULTS(LINE)=RESULTS(LINE)_" By "_$SELECT($PIECE(ALPLACT,"^",2)'="":$PIECE(ALPLACT,"^",2),1:"<not on file>")
- End DoDot:3
- End DoDot:2
- End DoDot:1
- +177 KILL ALPLACT,ALPDRUG,ALPBX
- +178 ;
- +179 IF LINE<11
- FOR I=1:1
- IF LINE=11
- QUIT
- Begin DoDot:1
- +180 SET LINE=LINE+1
- +181 SET RESULTS(LINE)=""
- End DoDot:1
- +182 ;
- +183 ; now add admin times and initial boxes to lines 4-10 as required
- +184 ; by number of administration times...
- +185 SET ALPBIBOX="______|"
- +186 SET ALPBNBOX="******|"
- +187 IF +$GET(ALPBADM)=0
- SET ALPBADM=8
- +188 ;S ALPBPRN=ALPBADM+4
- +189 SET ALPBSTOP=$PIECE($GET(DATA(1)),"^",2)
- +190 FOR I=1:1:ALPBADM
- Begin DoDot:1
- +191 SET ALPBPRN=I+3
- +192 SET ALPBADMT=$GET(ALPBADM(I))
- +193 IF ALPBADMT=""
- SET ALPBADMT=" "
- +194 IF '$DATA(RESULTS(I+3))
- Begin DoDot:2
- +195 SET RESULTS(I+3)=" "
- +196 SET LINE=LINE+1
- End DoDot:2
- +197 SET RESULTS(I+3)=$$PAD^ALPBUTL(RESULTS(I+3),65)_"| "
- +198 SET RESULTS(I+3)=RESULTS(I+3)_$SELECT($LENGTH(ALPBADMT)=2:ALPBADMT_"00",1:ALPBADMT)
- +199 SET RESULTS(I+3)=$$PAD^ALPBUTL(RESULTS(I+3),74)_"|"
- +200 FOR J=1:1:DAYS
- Begin DoDot:2
- +201 SET ALPBDAY=ALPBDAYS(J)_"."_ALPBADMT
- +202 SET ALPBPBOX=ALPBIBOX
- +203 IF ALPBDAY=ALPBSTOP!(ALPBDAY>ALPBSTOP)
- SET ALPBPBOX=ALPBNBOX
- +204 SET RESULTS(I+3)=RESULTS(I+3)_ALPBPBOX
- End DoDot:2
- +205 KILL ALPBADMT,ALPBPBOX,ALPBDAY
- End DoDot:1
- +206 KILL ALPBIBOX,ALPBNBOX
- +207 ; if PRN med, add line for documenting effectiveness...
- +208 IF +ALPBPRNG
- Begin DoDot:1
- +209 SET ALPBFLG=0
- SET ALPBPRN=ALPBPRN+1
- +210 IF '$DATA(RESULTS(ALPBPRN))
- SET RESULTS(ALPBPRN)=" "
- SET ALPBFLG=1
- +211 SET RESULTS(ALPBPRN)=$$PAD^ALPBUTL(RESULTS(ALPBPRN),63)_" PRN Effectiveness:_____________"
- +212 IF ALPBFLG
- SET LINE=LINE+1
- End DoDot:1
- +213 SET LINE=LINE+1
- +214 SET RESULTS(LINE)=$$REPEAT^XLFSTR("-",132)
- +215 SET RESULTS(0)=LINE
- +216 QUIT