PSOERUT7 ;ALB/MFR - eRx Drug Validation (VD) Utilities; 06/25/2023 5:14pm
;;7.0;OUTPATIENT PHARMACY;**746**;DEC 1997;Build 106
;
DOSEDUE(MODE,NPSPC,ERXIEN,SDERXFLG) ; Sets Dosage & DUE Information
; Input: MODE - Display Mode: "RS": Roll & Scroll | "LM": ListMan
; NMSPC - ListMan Temp Global Namespace (e.g., "PSOERXP1")
; ERXIEN - Pointer to ERX HOLDING QUEUE file (#52.49)
; (o)SDERXFLG - Single eRx View/Display Flag - 1: Single eRx View/Display side-by-side | 0: Existing Functionality
N ERXDOSE,DOSE,XE,XEI,XV,XVI,WRPDOSE,I,DISPUNTS,DOSEX,PDUE,DUESEQ,ERXLINES,VALINES,COAGENT,REASON,RESULT,ACK,VAPATINS
;
D PDUEDATA^PSOERXU9(.PDUE,ERXIEN,1)
S XEI=0,LMLINE=LINE-1
S XEI=XEI+1,LMLINE=LMLINE+1,ERXLINES(XEI)="Prescriber Drug Use Evaluation:"
I '$D(PDUE) D
. S XEI=XEI+1,LMLINE=LMLINE+1,ERXLINES(XEI)=" None",HIGHLN(LMLINE,2)=4
E D
. F DUESEQ=1:1 Q:'$D(PDUE(DUESEQ)) D
. . S COAGENT=$P(PDUE(DUESEQ),"^",8)
. . S XEI=XEI+1,LMLINE=LMLINE+1,ERXLINES(XEI)="Co-Agent: "_$$COMPARE^PSOERUT0(MODE,$E(COAGENT,1,29),$E(COAGENT,1,29),11,,LMLINE)
. . I $L(COAGENT)>29 D
. . . F I=1:1 S COAGENT=$E(COAGENT,30,999) Q:COAGENT="" D
. . . . S XEI=XEI+1,LMLINE=LMLINE+1,ERXLINES(XEI)=" "_$$COMPARE^PSOERUT0(MODE,$E(COAGENT,1,29),$E(COAGENT,1,29),11,,LMLINE)
. . S REASON=$P(PDUE(DUESEQ),"^",2) I $$PRESOLV^PSOERXA1(REASON,"REA") S REASON=$$GET1^DIQ(52.45,$$PRESOLV^PSOERXA1(REASON,"REA"),.02)
. . S XEI=XEI+1,LMLINE=LMLINE+1,ERXLINES(XEI)="Reason: "_$$COMPARE^PSOERUT0(MODE,$E(REASON,1,30),$E(REASON,1,30),9,,LMLINE)
. . I $L(REASON)>31 D
. . . F I=1:1 S REASON=$E(REASON,32,999) Q:REASON="" D
. . . . S XEI=XEI+1,LMLINE=LMLINE+1,ERXLINES(XEI)=" "_$$COMPARE^PSOERUT0(MODE,$E(REASON,1,31),$E(REASON,1,31),9,,LMLINE)
. . S RESULT=$P(PDUE(DUESEQ),"^",4) I $$PRESOLV^PSOERXA1(RESULT,"RES") S RESULT=$$GET1^DIQ(52.45,$$PRESOLV^PSOERXA1(RESULT,"RES"),.02)
. . S XEI=XEI+1,LMLINE=LMLINE+1,ERXLINES(XEI)="Result: "_$$COMPARE^PSOERUT0(MODE,$E(RESULT,1,30),$E(RESULT,1,30),9,,LMLINE)
. . I $L(RESULT)>31 D
. . . F I=1:1 S RESULT=$E(RESULT,32,999) Q:RESULT="" D
. . . . S XEI=XEI+1,LMLINE=LMLINE+1,ERXLINES(XEI)=" "_$$COMPARE^PSOERUT0(MODE,$E(RESULT,1,31),$E(RESULT,1,31),9,,LMLINE)
. . S ACK=$P(PDUE(DUESEQ),"^",9)
. . S XEI=XEI+1,LMLINE=LMLINE+1,ERXLINES(XEI)="Override: "_$$COMPARE^PSOERUT0(MODE,$E(ACK,1,28),$E(ACK,1,28),11,,LMLINE)
. . I $L(ACK)>28 D
. . . F I=1:1 S ACK=$E(ACK,29,999) Q:ACK="" D
. . . . S XEI=XEI+1,LMLINE=LMLINE+1,ERXLINES(XEI)=" "_$$COMPARE^PSOERUT0(MODE,$E(ACK,1,28),$E(ACK,1,28),11,,LMLINE)
. . I $O(PDUE(DUESEQ)) S XEI=XEI+1,LMLINE=LMLINE+1,ERXLINES(XEI)="......................................"
;
D ERXDOSE^PSOERUT4(ERXIEN,.ERXDOSE)
S XVI=0,LMLINE=LINE-1
I '$D(ERXDOSE),'$D(PDUE) D
. S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)=$S($G(SDERXFLG):"",MODE="LM":"2)",1:" ")_$S($G(SDERXFLG):"",1:" ")_" Dosage:"
. I MODE="LM",'$G(SDERXFLG) S UNDERLN(LMLINE,41)=2
F DOSE=1:1 Q:'$D(ERXDOSE("DOSE",DOSE)) D
. I '$G(ERXDOSE("DOSE ORDERED",DOSE)) D
. . S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)=" Verb: "_$$COMPARE^PSOERUT0(MODE,ERXDOSE("VERB",DOSE),ERXDOSE("VERB",DOSE),54,,LMLINE)
. S DOSEX=ERXDOSE("DOSE",DOSE) I $E(DOSEX,1)=".",$G(ERXDOSE("DOSE ORDERED",DOSE)) S DOSEX="0"_DOSEX
. I $G(ERXDOSE("UNITS",DOSE))]"" S DOSEX=DOSEX_" ("_$$GET1^DIQ(50.607,ERXDOSE("UNITS",DOSE),.01)_")"
. D WRAP^PSOERUT(DOSEX,24,.WRPDOSE)
. S XVI=XVI+1,LMLINE=LMLINE+1
. S VALINES(XVI)=$S($G(SDERXFLG):" ",MODE="LM"&(DOSE=1):"2)",1:" ")_" Dosage: "_$$COMPARE^PSOERUT0("LM",$G(WRPDOSE(1,0)),$G(WRPDOSE(1,0)),54,,LMLINE)
. I MODE="LM",DOSE=1,'$G(SDERXFLG) S UNDERLN(LMLINE,41)=2
. F I=2:1 Q:'$D(WRPDOSE(I)) D
. . S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)=" "_$$COMPARE^PSOERUT0("LM",$G(WRPDOSE(I,0)),$G(WRPDOSE(I,0)),54,,LMLINE)
. I $G(ERXDOSE("DOSE ORDERED",DOSE)) D
. . S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)=" Verb: "_$$COMPARE^PSOERUT0(MODE,$G(ERXDOSE("VERB",DOSE)),$G(ERXDOSE("VERB",DOSE)),54,,LMLINE)
. . S DISPUNTS=$S($E(ERXDOSE("DOSE ORDERED",DOSE),1)=".":"0",1:"")_ERXDOSE("DOSE ORDERED",DOSE)
. . S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)="Disp. Units: "_$$COMPARE^PSOERUT0(MODE,$E(DISPUNTS,1,27),$E(DISPUNTS,1,27),54,,LMLINE)
. . I $L(DISPUNTS)>27 D
. . . S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)=$$COMPARE^PSOERUT0(MODE,$E(DISPUNTS,28,999),$E(DISPUNTS,28,999),41)
. I $G(ERXDOSE("NOUN",DOSE))'="" D
. . S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)=" Noun: "_$$COMPARE^PSOERUT0(MODE,ERXDOSE("NOUN",DOSE),ERXDOSE("NOUN",DOSE),54,,LMLINE)
. S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)=" Route: "_$$COMPARE^PSOERUT0(MODE,$G(ERXDOSE("ROUTE",DOSE)),$G(ERXDOSE("ROUTE",DOSE)),54,,LMLINE)
. S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)=" Schedule: "_$$COMPARE^PSOERUT0(MODE,$G(ERXDOSE("SCHEDULE",DOSE)),$G(ERXDOSE("SCHEDULE",DOSE)),54,,LMLINE)
. I $G(ERXDOSE("DURATION",DOSE))'="" D
. . N DUR S DUR=ERXDOSE("DURATION",DOSE)
. . S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)=" Duration: "_$$COMPARE^PSOERUT0(MODE,DUR_" "_$$FREQ^PSOERUT4(DUR),DUR_" "_$$FREQ^PSOERUT4(DUR),54,,LMLINE)
. I $G(ERXDOSE("CONJUNCTION",DOSE))'="" D
. . S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)="Conjunction: "_$$COMPARE^PSOERUT0(MODE,ERXDOSE("CONJUNCTION",DOSE),ERXDOSE("CONJUNCTION",DOSE),54,,LMLINE)
;
; - Patient Instructions
S VAPATINS=$$GET1^DIQ(52.49,ERXIEN,27)
I $G(VAPATINS)'=""!(MODE="LM") D
. I MODE="LM",'$G(SDERXFLG) S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)="________________________________________"
. S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)=$S($G(SDERXFLG):"",MODE="LM":"3)",1:"")_"Patient Instructions:"
. I MODE="LM",'$G(SDERXFLG) S UNDERLN(LMLINE,41)=2
. K VARR D WRAP^PSOERUT($G(VAPATINS),39,.VARR)
. F I=1:1 Q:'$D(VARR(I)) D
. . S XVI=XVI+1,LMLINE=LMLINE+1,VALINES(XVI)=" "_$$COMPARE^PSOERUT0(MODE,$G(VARR(I,0)),$G(VARR(I,0)),42,,LMLINE)
;
; - Setting eRx Prescriber Drug Use Evaluation (DUE), Matched Dosage and Patient Instructions
F ALLLN=1:1 Q:('$D(ERXLINES(ALLLN))&'$D(VALINES(ALLLN))) D
. S ERXALLS=$G(ERXLINES(ALLLN)),VAALLS=$G(VALINES(ALLLN))
. S XE=$G(ERXLINES(ALLLN))
. S XV="|"_$G(VALINES(ALLLN))
. D ADDLINE^PSOERUT0(MODE,NMSPC,XE,XV)
Q
;
SAMEDOSE(ERX,RX) ; Returns if the eRx Dosage and VistA Rx Dosage are the same
; Input: ERX - Pointer to ERX HOLDING QUEUE file (#52.49)
; RX - Pointer to PRESCRIPTION file (#52)
;Output: SAMEDOSE - 1: Exact same Dose | 0 - Different Dose
N SAMEDOSE,EDOSE,VDOSE,NEXTE,NEXTV
D ERXDOSE^PSOERUT4(ERX,.EDOSE,1)
D VARXDOSE^PSOERUT4(RX,.VDOSE)
S SAMEDOSE=1
S NEXTE="EDOSE" F S NEXTE=$Q(@NEXTE) Q:NEXTE="" D I 'SAMEDOSE Q
. S NEXTV="VDOSE("_$P(NEXTE,"(",2)
. I $G(@NEXTE)'=$G(@NEXTV) S SAMEDOSE=0
Q SAMEDOSE
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOERUT7 6831 printed Oct 16, 2024@18:28:47 Page 2
PSOERUT7 ;ALB/MFR - eRx Drug Validation (VD) Utilities; 06/25/2023 5:14pm
+1 ;;7.0;OUTPATIENT PHARMACY;**746**;DEC 1997;Build 106
+2 ;
DOSEDUE(MODE,NPSPC,ERXIEN,SDERXFLG) ; Sets Dosage & DUE Information
+1 ; Input: MODE - Display Mode: "RS": Roll & Scroll | "LM": ListMan
+2 ; NMSPC - ListMan Temp Global Namespace (e.g., "PSOERXP1")
+3 ; ERXIEN - Pointer to ERX HOLDING QUEUE file (#52.49)
+4 ; (o)SDERXFLG - Single eRx View/Display Flag - 1: Single eRx View/Display side-by-side | 0: Existing Functionality
+5 NEW ERXDOSE,DOSE,XE,XEI,XV,XVI,WRPDOSE,I,DISPUNTS,DOSEX,PDUE,DUESEQ,ERXLINES,VALINES,COAGENT,REASON,RESULT,ACK,VAPATINS
+6 ;
+7 DO PDUEDATA^PSOERXU9(.PDUE,ERXIEN,1)
+8 SET XEI=0
SET LMLINE=LINE-1
+9 SET XEI=XEI+1
SET LMLINE=LMLINE+1
SET ERXLINES(XEI)="Prescriber Drug Use Evaluation:"
+10 IF '$DATA(PDUE)
Begin DoDot:1
+11 SET XEI=XEI+1
SET LMLINE=LMLINE+1
SET ERXLINES(XEI)=" None"
SET HIGHLN(LMLINE,2)=4
End DoDot:1
+12 IF '$TEST
Begin DoDot:1
+13 FOR DUESEQ=1:1
if '$DATA(PDUE(DUESEQ))
QUIT
Begin DoDot:2
+14 SET COAGENT=$PIECE(PDUE(DUESEQ),"^",8)
+15 SET XEI=XEI+1
SET LMLINE=LMLINE+1
SET ERXLINES(XEI)="Co-Agent: "_$$COMPARE^PSOERUT0(MODE,$EXTRACT(COAGENT,1,29),$EXTRACT(COAGENT,1,29),11,,LMLINE)
+16 IF $LENGTH(COAGENT)>29
Begin DoDot:3
+17 FOR I=1:1
SET COAGENT=$EXTRACT(COAGENT,30,999)
if COAGENT=""
QUIT
Begin DoDot:4
+18 SET XEI=XEI+1
SET LMLINE=LMLINE+1
SET ERXLINES(XEI)=" "_$$COMPARE^PSOERUT0(MODE,$EXTRACT(COAGENT,1,29),$EXTRACT(COAGENT,1,29),11,,LMLINE)
End DoDot:4
End DoDot:3
+19 SET REASON=$PIECE(PDUE(DUESEQ),"^",2)
IF $$PRESOLV^PSOERXA1(REASON,"REA")
SET REASON=$$GET1^DIQ(52.45,$$PRESOLV^PSOERXA1(REASON,"REA"),.02)
+20 SET XEI=XEI+1
SET LMLINE=LMLINE+1
SET ERXLINES(XEI)="Reason: "_$$COMPARE^PSOERUT0(MODE,$EXTRACT(REASON,1,30),$EXTRACT(REASON,1,30),9,,LMLINE)
+21 IF $LENGTH(REASON)>31
Begin DoDot:3
+22 FOR I=1:1
SET REASON=$EXTRACT(REASON,32,999)
if REASON=""
QUIT
Begin DoDot:4
+23 SET XEI=XEI+1
SET LMLINE=LMLINE+1
SET ERXLINES(XEI)=" "_$$COMPARE^PSOERUT0(MODE,$EXTRACT(REASON,1,31),$EXTRACT(REASON,1,31),9,,LMLINE)
End DoDot:4
End DoDot:3
+24 SET RESULT=$PIECE(PDUE(DUESEQ),"^",4)
IF $$PRESOLV^PSOERXA1(RESULT,"RES")
SET RESULT=$$GET1^DIQ(52.45,$$PRESOLV^PSOERXA1(RESULT,"RES"),.02)
+25 SET XEI=XEI+1
SET LMLINE=LMLINE+1
SET ERXLINES(XEI)="Result: "_$$COMPARE^PSOERUT0(MODE,$EXTRACT(RESULT,1,30),$EXTRACT(RESULT,1,30),9,,LMLINE)
+26 IF $LENGTH(RESULT)>31
Begin DoDot:3
+27 FOR I=1:1
SET RESULT=$EXTRACT(RESULT,32,999)
if RESULT=""
QUIT
Begin DoDot:4
+28 SET XEI=XEI+1
SET LMLINE=LMLINE+1
SET ERXLINES(XEI)=" "_$$COMPARE^PSOERUT0(MODE,$EXTRACT(RESULT,1,31),$EXTRACT(RESULT,1,31),9,,LMLINE)
End DoDot:4
End DoDot:3
+29 SET ACK=$PIECE(PDUE(DUESEQ),"^",9)
+30 SET XEI=XEI+1
SET LMLINE=LMLINE+1
SET ERXLINES(XEI)="Override: "_$$COMPARE^PSOERUT0(MODE,$EXTRACT(ACK,1,28),$EXTRACT(ACK,1,28),11,,LMLINE)
+31 IF $LENGTH(ACK)>28
Begin DoDot:3
+32 FOR I=1:1
SET ACK=$EXTRACT(ACK,29,999)
if ACK=""
QUIT
Begin DoDot:4
+33 SET XEI=XEI+1
SET LMLINE=LMLINE+1
SET ERXLINES(XEI)=" "_$$COMPARE^PSOERUT0(MODE,$EXTRACT(ACK,1,28),$EXTRACT(ACK,1,28),11,,LMLINE)
End DoDot:4
End DoDot:3
+34 IF $ORDER(PDUE(DUESEQ))
SET XEI=XEI+1
SET LMLINE=LMLINE+1
SET ERXLINES(XEI)="......................................"
End DoDot:2
End DoDot:1
+35 ;
+36 DO ERXDOSE^PSOERUT4(ERXIEN,.ERXDOSE)
+37 SET XVI=0
SET LMLINE=LINE-1
+38 IF '$DATA(ERXDOSE)
IF '$DATA(PDUE)
Begin DoDot:1
+39 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)=$SELECT($GET(SDERXFLG):"",MODE="LM":"2)",1:" ")_$SELECT($GET(SDERXFLG):"",1:" ")_" Dosage:"
+40 IF MODE="LM"
IF '$GET(SDERXFLG)
SET UNDERLN(LMLINE,41)=2
End DoDot:1
+41 FOR DOSE=1:1
if '$DATA(ERXDOSE("DOSE",DOSE))
QUIT
Begin DoDot:1
+42 IF '$GET(ERXDOSE("DOSE ORDERED",DOSE))
Begin DoDot:2
+43 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)=" Verb: "_$$COMPARE^PSOERUT0(MODE,ERXDOSE("VERB",DOSE),ERXDOSE("VERB",DOSE),54,,LMLINE)
End DoDot:2
+44 SET DOSEX=ERXDOSE("DOSE",DOSE)
IF $EXTRACT(DOSEX,1)="."
IF $GET(ERXDOSE("DOSE ORDERED",DOSE))
SET DOSEX="0"_DOSEX
+45 IF $GET(ERXDOSE("UNITS",DOSE))]""
SET DOSEX=DOSEX_" ("_$$GET1^DIQ(50.607,ERXDOSE("UNITS",DOSE),.01)_")"
+46 DO WRAP^PSOERUT(DOSEX,24,.WRPDOSE)
+47 SET XVI=XVI+1
SET LMLINE=LMLINE+1
+48 SET VALINES(XVI)=$SELECT($GET(SDERXFLG):" ",MODE="LM"&(DOSE=1):"2)",1:" ")_" Dosage: "_$$COMPARE^PSOERUT0("LM",$GET(WRPDOSE(1,0)),$GET(WRPDOSE(1,0)),54,,LMLINE)
+49 IF MODE="LM"
IF DOSE=1
IF '$GET(SDERXFLG)
SET UNDERLN(LMLINE,41)=2
+50 FOR I=2:1
if '$DATA(WRPDOSE(I))
QUIT
Begin DoDot:2
+51 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)=" "_$$COMPARE^PSOERUT0("LM",$GET(WRPDOSE(I,0)),$GET(WRPDOSE(I,0)),54,,LMLINE)
End DoDot:2
+52 IF $GET(ERXDOSE("DOSE ORDERED",DOSE))
Begin DoDot:2
+53 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)=" Verb: "_$$COMPARE^PSOERUT0(MODE,$GET(ERXDOSE("VERB",DOSE)),$GET(ERXDOSE("VERB",DOSE)),54,,LMLINE)
+54 SET DISPUNTS=$SELECT($EXTRACT(ERXDOSE("DOSE ORDERED",DOSE),1)=".":"0",1:"")_ERXDOSE("DOSE ORDERED",DOSE)
+55 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)="Disp. Units: "_$$COMPARE^PSOERUT0(MODE,$EXTRACT(DISPUNTS,1,27),$EXTRACT(DISPUNTS,1,27),54,,LMLINE)
+56 IF $LENGTH(DISPUNTS)>27
Begin DoDot:3
+57 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)=$$COMPARE^PSOERUT0(MODE,$EXTRACT(DISPUNTS,28,999),$EXTRACT(DISPUNTS,28,999),41)
End DoDot:3
End DoDot:2
+58 IF $GET(ERXDOSE("NOUN",DOSE))'=""
Begin DoDot:2
+59 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)=" Noun: "_$$COMPARE^PSOERUT0(MODE,ERXDOSE("NOUN",DOSE),ERXDOSE("NOUN",DOSE),54,,LMLINE)
End DoDot:2
+60 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)=" Route: "_$$COMPARE^PSOERUT0(MODE,$GET(ERXDOSE("ROUTE",DOSE)),$GET(ERXDOSE("ROUTE",DOSE)),54,,LMLINE)
+61 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)=" Schedule: "_$$COMPARE^PSOERUT0(MODE,$GET(ERXDOSE("SCHEDULE",DOSE)),$GET(ERXDOSE("SCHEDULE",DOSE)),54,,LMLINE)
+62 IF $GET(ERXDOSE("DURATION",DOSE))'=""
Begin DoDot:2
+63 NEW DUR
SET DUR=ERXDOSE("DURATION",DOSE)
+64 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)=" Duration: "_$$COMPARE^PSOERUT0(MODE,DUR_" "_$$FREQ^PSOERUT4(DUR),DUR_" "_$$FREQ^PSOERUT4(DUR),54,,LMLINE)
End DoDot:2
+65 IF $GET(ERXDOSE("CONJUNCTION",DOSE))'=""
Begin DoDot:2
+66 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)="Conjunction: "_$$COMPARE^PSOERUT0(MODE,ERXDOSE("CONJUNCTION",DOSE),ERXDOSE("CONJUNCTION",DOSE),54,,LMLINE)
End DoDot:2
End DoDot:1
+67 ;
+68 ; - Patient Instructions
+69 SET VAPATINS=$$GET1^DIQ(52.49,ERXIEN,27)
+70 IF $GET(VAPATINS)'=""!(MODE="LM")
Begin DoDot:1
+71 IF MODE="LM"
IF '$GET(SDERXFLG)
SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)="________________________________________"
+72 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)=$SELECT($GET(SDERXFLG):"",MODE="LM":"3)",1:"")_"Patient Instructions:"
+73 IF MODE="LM"
IF '$GET(SDERXFLG)
SET UNDERLN(LMLINE,41)=2
+74 KILL VARR
DO WRAP^PSOERUT($GET(VAPATINS),39,.VARR)
+75 FOR I=1:1
if '$DATA(VARR(I))
QUIT
Begin DoDot:2
+76 SET XVI=XVI+1
SET LMLINE=LMLINE+1
SET VALINES(XVI)=" "_$$COMPARE^PSOERUT0(MODE,$GET(VARR(I,0)),$GET(VARR(I,0)),42,,LMLINE)
End DoDot:2
End DoDot:1
+77 ;
+78 ; - Setting eRx Prescriber Drug Use Evaluation (DUE), Matched Dosage and Patient Instructions
+79 FOR ALLLN=1:1
if ('$DATA(ERXLINES(ALLLN))&'$DATA(VALINES(ALLLN)))
QUIT
Begin DoDot:1
+80 SET ERXALLS=$GET(ERXLINES(ALLLN))
SET VAALLS=$GET(VALINES(ALLLN))
+81 SET XE=$GET(ERXLINES(ALLLN))
+82 SET XV="|"_$GET(VALINES(ALLLN))
+83 DO ADDLINE^PSOERUT0(MODE,NMSPC,XE,XV)
End DoDot:1
+84 QUIT
+85 ;
SAMEDOSE(ERX,RX) ; Returns if the eRx Dosage and VistA Rx Dosage are the same
+1 ; Input: ERX - Pointer to ERX HOLDING QUEUE file (#52.49)
+2 ; RX - Pointer to PRESCRIPTION file (#52)
+3 ;Output: SAMEDOSE - 1: Exact same Dose | 0 - Different Dose
+4 NEW SAMEDOSE,EDOSE,VDOSE,NEXTE,NEXTV
+5 DO ERXDOSE^PSOERUT4(ERX,.EDOSE,1)
+6 DO VARXDOSE^PSOERUT4(RX,.VDOSE)
+7 SET SAMEDOSE=1
+8 SET NEXTE="EDOSE"
FOR
SET NEXTE=$QUERY(@NEXTE)
if NEXTE=""
QUIT
Begin DoDot:1
+9 SET NEXTV="VDOSE("_$PIECE(NEXTE,"(",2)
+10 IF $GET(@NEXTE)'=$GET(@NEXTV)
SET SAMEDOSE=0
End DoDot:1
IF 'SAMEDOSE
QUIT
+11 QUIT SAMEDOSE