Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSORENW3

PSORENW3.m

Go to the documentation of this file.
PSORENW3 ;IHS/DSD/JCM - EDIT TEMPLATE FOR RENEW RX ORDER ENTRY ;04-Jun-2013 13:07;DU
 ;;7.0;OUTPATIENT PHARMACY;**11,20,46,100,117,1006,1008,1017**;DEC 1997;Build 40
 ;External reference to ^PSDRUG supported by DBIA 221
 ;External reference to ^SC supported by DBIA 10040
 ;
 ; Modified - IHS/CIA/PLS - 01/06/04 - Numerous lines
 ;            IHS/MSC/PLS - 08/20/07 - Line 451 now calls TRPDCLS^APSPDIR API
 ;                          03/13/08 - Added label 68 and line DSPLY+22
 ;                          01/23/09 - Added label 69 and lines DSPLY+24 and JUMP+4
 ;                          06/04/13 - Changed label 69 to 70 and added label 69 and lines at DSPLY+24 and JUMP+4
 ;
START ;
 D INIT
 ;
1 S PSORENW("FLD")=1 D ISSDT^PSODIR2(.PSORENW) ; Get Issue Date
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
 ; IHS/CIA/PLS - 01/06/04 - Set APSRNEW
2 ;S PSORENW("FLD")=2 D FILLDT^PSODIR2(.PSORENW) ; Get Fill date
 S PSORENW("FLD")=2,APSRNEW=1 D FILLDT^PSODIR2(.PSORENW) ; Get Fill date
 D FFDTWARN^APSPFUNC($G(PSORENW("FILL DATE")))  ;IHS/CIA/PLS - 04/05/04 - Warn Future Fill Date
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
3 S PSORENW("FLD")=3 D PROV^PSODIR(.PSORENW) ; Get Provider
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
 ; IHS/CIA/PLS - 01/06/04 - Added QTY prompt
40 S PSORENW("FLD")=40 D QTY^PSODIR1(.PSORENW)
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ; IHS/CIA/PLS - 01/06/04 - Added Triplicate prompt
451 ;G:$G(PSOTRIP)'=1 501  ; Triplicate Switch
 G:'$$TRPDCLS^APSPDIR($G(PSOTRIP),$G(PSODRUG("DEA"))) 501
45 S PSORENW("FLD")=45 D TRIP^APSPDIR(.PSORENW)  ; Get Triplicate Number
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ; IHS/CIA/PLS - 01/06/04 - Added NDC prompt
501 G:$G(PSONDC)'=1 601  ; NDC Field Switch
50 S PSORENW("FLD")=50 D NDC^APSPDIR(.PSORENW)  ; Get NDC
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 K PSORENW("AWP")
 K PSORENW("COST")
 ; IHS/CIA/PLS - 01/06/04 - Added AWP prompt
601 G:$G(PSOAWP)'=1 611
60 S PSORENW("FLD")=60 D AWP^APSPDIR(.PSORENW)
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ; IHS/CIA/PLS - 01/06/04 - Added COST prompt
611 G:$G(PSOCOST)'=1 62  ; Cost Switch
61 S PSORENW("FLD")=61 D COST^APSPDIR(.PSORENW)
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ; IHS/CIA/PLS - 01/06/04 - Added Manufacturer prompt
62 G:(($G(APSPMAN)=3)!($G(APSPMAN)="")) 4 G:$G(APSPMAN)=2 67  ; MANUF switch
63 S PSORENW("FLD")=63 D MANUF^APSPDIR(.PSORENW)   ; Get Manufacturer
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ; IHS/CIA/PLS - 01/06/04 - Added Lot # prompt
65 S PSORENW("FLD")=65 D LOT^APSPDIR(.PSORENW)  ; Get Lot #
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ; IHS/CIA/PLS - 01/06/04 - Added Expiration Date prompt
67 S PSORENW("FLD")=67 D EXPDATE^APSPDIR(.PSORENW)  ; Get Expiration Date
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ; IHS/MSC/PLS - 03/13/08 - Added Substitution prompt
68 S PSORENW("FLD")=68 D SUBS^APSPDIR(.PSORENW)
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ; IHS/MSC/PLS - 06/04/13 - Added Discharge Medication
69 S PSORENW("FLD")=69 D DSCMED^APSPDIR(.PSORENW)
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ; IHS/MSC/PLS - 01/23/09 - Added Cash Due prompt
70 I $$GET1^DIQ(9009033,PSOSITE,319,"I") S PSORENW("FLD")=70 D CASHDUE^APSPDIR(.PSORENW)
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
4 S PSORENW("FLD")=4,PSORENW("DAYS SUPPLY")=$P(PSORENW("RX0"),"^",8)
 K PSORENW("# OF REFILLS") D REFILL^PSODIR1(.PSORENW) ; Get # of refills
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
 ; IHS/CIA/PLS - 01/06/04 - Added Billing and Insurer prompts
 S PSORENW("BST")=PSOBILST G:$G(PSOBILRX)'=1 5  ; Billing Switch
85 S PSORENW("FLD")=85 D BST^APSPDIR(.PSORENW)  ; Get Billing Status Code
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
 ; IHS/CIA/PLS - 01/06/04 - Added Insurer prompt
87 S PSORENW("FLD")=87 D INSURER^APSPDIR(.PSORENW)  ; Get Insurer
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
5 S PSORENW("FLD")=5 D RMK^PSODIR2(.PSORENW) ; Get Remarks
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
6 S PSORENW("FLD")=6 D MW^PSODIR2(.PSORENW) ; Get Mail/Window Info
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
 ; IHS/CIA/PLS - 01/06/04 - Commented out next two lines
7 ;I $G(DUZ("AG"))="I" S PSORENW("FLD")=7 D EXP^PSODIR2(.PSORENW) ; Get Expiration Date - Indian Health Service ONLY
 ;G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
8 I $G(DUZ("AG"))="I" S PSORENW("FLD")=8 D CLERK^PSODIR2(.PSORENW) ; Get Clerk Code
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
9 S PSORENW("FLD")=9 D CLINIC^PSODIR2(.PSORENW)
 G:PSORENW("DFLG") END G:PSORENW("FIELD") @PSORENW("FIELD")
 ;
 ; PLS - 06/21/04 ;S APFLAG="RE" D ^APSPQ  ; IHS/CIA/PLS - 01/06/04 - Due Questionnaire
END ;
 ; IHS/CIA/PLS - 01/06/04 - Added next two lines
 S:'$D(PSORENW("AWP")) PSORENW("AWP")=$$AWP^APSQDAWP($S($D(PSORENW("NDC")):PSORENW("NDC"),1:PSODRUG("NDC")),PSODRUG("IEN"),.TALK)
 S:'$D(PSORENW("PATIENT STATUS")) PSORENW("PATIENT STATUS")=PSORX("PATIENT STATUS")
 K PSORENW3 S PSORENW("EDIT")=1
 Q
 ;
INIT ;
 S PSORENW("QTY")=$P(PSORENW("RX0"),"^",7)
 I '$G(PSORENW("DAYS SUPPLY")) S PSORENW("DAYS SUPPLY")=$P(PSORENW("RX0"),"^",8)
 S (PSORENW("DFLG"),PSORENW("FIELD"),PSORENW3)=0
 G:$G(PSORENW("EDIT")) INITX
 S PSORENW("ISSUE DATE")=$S(DT>PSORENW("FILL DATE"):PSORENW("FILL DATE"),1:DT)
 S PSORENW("CLINIC")=$P(PSORENW("RX0"),"^",5)
 I $G(PSOFDR),$P($G(OR0),"^",13) S PSORENW("CLINIC")=$P($G(OR0),"^",13)
 S:PSORENW("CLINIC") PSORX("CLINIC")=$P(^SC(PSORENW("CLINIC"),0),"^")
 S Y=PSORENW("FILL DATE") X ^DD("DD") S PSORX("FILL DATE")=Y K Y
 S PSORENW("PROVIDER")=$S($G(PSORENW("PROVIDER")):PSORENW("PROVIDER"),1:$P(PSORENW("RX0"),"^",4))
 S PSORENW("PROVIDER NAME")=$P($G(^VA(200,PSORENW("PROVIDER"),0)),"^")
 S PSORENW("PTST NODE")=$G(^PS(53,$P(PSORENW("RX0"),"^",3),0))
 S PSORENW("# OF REFILLS")=$S($G(PSORENW("# OF REFILLS")):PSORENW("# OF REFILLS"),1:$P(PSORENW("RX0"),"^",9))
 S PSORENW("REMARKS")="RENEWED FROM RX # "_$P(PSORENW("RX0"),"^")
 S PSORX("MAIL/WINDOW")=$S($G(PSORX("MAIL/WINDOW"))]"":PSORX("MAIL/WINDOW"),$P(PSORENW("RX0"),"^",11)="W":"WINDOW",1:"MAIL")
 S:$G(PSORX("CLERK CODE"))']"" PSORX("CLERK CODE")=$P($G(^VA(200,DUZ,0)),"^")
 S PSORENW("INS")=$S($G(PSORENW("INS"))]"":PSORENW("INS"),1:$G(^PSRX(PSORENW("OIRXN"),"INS")))
 F D=0:0 S D=$O(^PSRX(PSORENW("OIRXN"),"INS1",D)) Q:'D  S PSORENW("SIG",D)=^PSRX(PSORENW("OIRXN"),"INS1",D,0)
 I '$O(PSORENW("DOSE",0)) F I=0:0 S I=$O(^PSRX(PSORENW("OIRXN"),6,I)) Q:'I  S DOSE=^PSRX(PSORENW("OIRXN"),6,I,0) D
 .S PSORENW("ENT")=$G(PSORENW("ENT"))+1,PSORENW("DOSE",PSORENW("ENT"))=$P(DOSE,"^")
 .S PSORENW("UNITS",PSORENW("ENT"))=$P(DOSE,"^",3),PSORENW("DOSE ORDERED",PSORENW("ENT"))=$P(DOSE,"^",2),PSORENW("ROUTE",PSORENW("ENT"))=$P(DOSE,"^",7)
 .S PSORENW("SCHEDULE",PSORENW("ENT"))=$P(DOSE,"^",8),PSORENW("DURATION",PSORENW("ENT"))=$P(DOSE,"^",5),PSORENW("CONJUNCTION",PSORENW("ENT"))=$P(DOSE,"^",6)
 .S PSORENW("NOUN",PSORENW("ENT"))=$P(DOSE,"^",4),PSORENW("VERB",PSORENW("ENT"))=$P(DOSE,"^",9)
 .I $G(^PSRX(PSORENW("OIRXN"),6,I,1))]"" S PSORENW("ODOSE",PSORENW("ENT"))=^PSRX(PSORENW("OIRXN"),6,I,1)
 .K DOSE
 I $P($G(^PSRX(PSORENW("OIRXN"),"SIG")),"^",2),'$O(SIG(0)) S SIGOK=1 D  Q
 .F I=0:0 S I=$O(^PSRX(PSORENW("OIRXN"),"SIG1",I)) Q:'I  S SIG(I)=^PSRX(PSORENW("OIRXN"),"SIG1",I,0)
 .I '$O(SIG(0)),$G(ORD),$G(PSOORRNW) F I=0:0 S I=$O(^PS(52.41,ORD,"SIG",I)) Q:'I  S SIG(I)=^PS(52.41,ORD,"SIG",I,0)
 .I '$O(SIG(0)) S SIG(1)="This Prescription is MISSING Required Medication Instructions for the Patient.  Please Review Dosaging Instructions."
 I $P($G(^PSRX(PSORENW("OIRXN"),"SIG")),"^")]"",'$P(^("SIG"),"^",2),'$O(SIG(0)) S SIGOK=1 D
 .S X=$P($G(^PSRX(PSORENW("OIRXN"),"SIG")),"^") D SIG^PSOHELP I $G(INS1)]"" S SIG(1)=$E(INS1,2,999)
 .I '$O(SIG(0)) S (PSORENW("SIG"),SIG(1))="This Prescription is MISSING Required Usable Medication Instructions for the Patient.  Please Review Dosaging Instructions."
 S PSORENW("NDC")=$G(PSODRUG("NDC"))    ; IHS/CIA/PLS - 01/06/04
 S PSORENW("AWP")=$G(PSODRUG("AWP"))    ; IHS/CIA/PLS - 01/06/04
 S PSORENW("COST")=$G(PSODRUG("COST"))  ; IHS/CIA/PLS - 01/06/04
INITX Q
JUMP ;
 S PSORENW("FIELD")=$S(+Y=1:1,+Y=22:2,+Y=4:3,+Y=5:9,+Y=9:4,+Y=12:5,+Y=11:6,+Y=29:7,+Y=16:8,1:PSORENW("FLD"))
 ; IHS/CIA/PLS - 01/06/04 - Added $S for additional fields
 ;S PSONEW("FIELD")=$S(+Y=7:40,+Y=9999999.13:45,+Y=27:50,+Y=9999999.06:60,+Y=17:61,+Y=28:63,+Y=24:65,+Y=26:67,+Y=9999999.07:85,+Y=9999999.12:87,1:PSONEW("FIELD"))
 ; IHS/MSC/PLS - 01/23/09 - Added 68 and 69 to $S
 ; IHS/MSC/PLS - 06/04/13 - changed 69 to 70 and added 69 to $S
 S PSONEW("FIELD")=$S(+Y=7:40,+Y=9999999.13:45,+Y=27:50,+Y=9999999.06:60,+Y=17:61,+Y=28:63,+Y=24:65,+Y=26:67,+Y=9999999.07:85,+Y=9999999.12:87,+Y=9999999.25:68,+Y=9999999.28:69,+Y=9999999.26:70,1:PSONEW("FIELD"))
 Q
DSPLY ;called from PSORENW0
 W !!,PSORENW("NRX #"),?12," ",$P(^PSDRUG(PSORENW("DRUG IEN"),0),"^"),?46," QTY: ",$P(PSORENW("RX0"),"^",7)
 W !,"# OF REFILLS: "_$S($G(PSORENW("# OF REFILLS")):PSORENW("# OF REFILLS"),1:$P(PSORENW("RX0"),"^",9))
 W "  ISSUED: "_$S(DT>PSORENW("FILL DATE"):$E(PSORENW("FILL DATE"),4,5)_"-"_$E(PSORENW("FILL DATE"),6,7)_"-"_$E(PSORENW("FILL DATE"),2,3),1:$E(DT,4,5)_"-"_$E(DT,6,7)_"-"_$E(DT,2,3))
 ;S X=PSORENW("INS") D SIG^PSOHELP S PSORENW("SIG")=$E(INS1,2,9999999)
 F DR=1:1:PSORENW("ENT") I $G(PSORENW("DURATION",DR))]"" D
 .S DUR1=PSORENW("DURATION",DR)
 .S PSORENW("DURATION",DR)=$S($E(DUR1,1)'?.N:$E(DUR1,2,99)_$E(DUR1,1),1:DUR1)
 F D=0:0 S D=$O(^PSRX(PSORENW("OIRXN"),"INS1",D)) Q:'D  S PSORENW("SIG",D)=^PSRX(PSORENW("OIRXN"),"INS1",D,0)
 K DR,DUR1 ;D EN^PSOFSIG(.PSORENW)
 I $G(SIGOK) D:'$O(SIG(0))  W !,"SIG: " F D=0:0 Q:'$O(SIG(D))  S D=$O(SIG(D)) W SIG(D),!
 .F I=0:0 S I=$O(^PSRX(PSORENW("OIRXN"),"SIG1",I)) Q:'I  S SIG(I)=^PSRX(PSORENW("OIRXN"),"SIG1",I,0)
 .I '$O(SIG(0)) S SIG(1)="This Prescription is MISSING Required Usable Medication Instructions",SIG(2)="for the Patient.  Please Review Dosaging Instructions.",PSORENW("DFLG")=1
 E  W "  SIG: "_PSORENW("SIG")_"  "
 W "FILLED: "_$E(PSORENW("FILL DATE"),4,5)_"-"_$E(PSORENW("FILL DATE"),6,7)_"-"_$E(PSORENW("FILL DATE"),2,3)
 W !,"ROUTING: "_$S($G(PSORENW("MAIL/WINDOW"))["W":"WINDOW",1:"MAIL")
 W "     PHYS: "_PSORX("PROVIDER NAME"),!
 ; IHS/CIA/PLS - 01/06/04 - Added next three lines
 W "NDC: ",$S($G(PSORENW("NDC"))]"":PSORENW("NDC"),1:$G(PSODRUG("NDC")))
 W " ("_$S($G(PSORENW("AWP"))]"":PSORENW("AWP"),1:$G(PSODRUG("AWP")))_") "
 W " ("_$S($G(PSORENW("COST"))]"":PSORENW("AWP"),1:$G(PSODRUG("COST")))_")"
 ; IHS/MSC/PLS - 03/13/08
 W !,"SUBSTITUTION: "_$$EXTERNAL^DILFD(52,9999999.25,,$G(PSONEW("DAW")))
 ; IHS/MSC/PLS - 06/04/13
 W !,"DISCHARGE MEDICATION: "_$$EXTERNAL^DILFD(52,9999999.28,,$G(PSONEW("DSCMED")))
 ;IHS/MSC/PLS - 01/23/09
 W !,"CASH DUE: "_$$EXTERNAL^DILFD(52,9999999.26,,$G(PSONEW("CASH DUE")))
 I $G(PSORENW("DFLG")),'$G(SPEED) K DIR S DIR(0)="E",DIR("A")="Rx NOT Renewed. Press Return to Continue" D ^DIR K DIR,DIRUT,DTOUT,DUOUT
DSPLYX Q