PSORN52A ;IHS/DSD/JCM/SAB/FLS-Break up of PSORN52 ;Mar 30, 2022@14:37:48
;;7.0;OUTPATIENT PHARMACY;**157,148,268,225,306,408,595,661,441,753**;DEC 1997;Build 53
Q ; Call from tag
;
IBHLD ;
I $P(PSOIBHLD,"^",2)="" S $P(PSOIBHLD,"^",2)=$S($P(PSOLDIBQ,"^",2)=1:1,$P(PSOLDIBQ,"^",2)=0:0,1:"")
I $P(PSOIBHLD,"^",3)="" S $P(PSOIBHLD,"^",3)=$S($P(PSOLDIBQ,"^",3)=1:1,$P(PSOLDIBQ,"^",3)=0:0,1:"")
I $P(PSOIBHLD,"^",4)="" S $P(PSOIBHLD,"^",4)=$S($P(PSOLDIBQ,"^",4)=1:1,$P(PSOLDIBQ,"^",4)=0:0,1:"")
I $P(PSOIBHLD,"^",5)="" S $P(PSOIBHLD,"^",5)=$S($P(PSOLDIBQ,"^",5)=1:1,$P(PSOLDIBQ,"^",5)=0:0,1:"")
I $P(PSOIBHLD,"^",6)="" S $P(PSOIBHLD,"^",6)=$S($P(PSOLDIBQ,"^",6)=1:1,$P(PSOLDIBQ,"^",6)=0:0,1:"")
I $P(PSOIBHLD,"^",7)="" S $P(PSOIBHLD,"^",7)=$S($P(PSOLDIBQ,"^",7)=1:1,$P(PSOLDIBQ,"^",7)=0:0,1:"")
I $P(PSOIBHLD,"^",8)="" S $P(PSOIBHLD,"^",8)=$S($P(PSOLDIBQ,"^",8)=1:1,$P(PSOLDIBQ,"^",8)=0:0,1:"")
Q
;
FILE ; - Filling ^PSRX and ^PS(55 entries
S PSOX("NRX0")=PSORENW("RX0"),PSOX("NRX2")=PSORENW("RX2"),PSOX("NRX3")=PSORENW("RX3"),$P(PSOX("NRX3"),"^",5)=""
S $P(PSOX("NRX0"),"^")=PSOX("NRX #") S:$G(PSOX("PROVIDER"))]"" $P(PSOX("NRX0"),"^",4)=PSOX("PROVIDER")
I $G(PSORNSPD),$G(PSOX("PATIENT STATUS")),$G(PSOX("PATIENT STATUS"))?.N S $P(PSOX("NRX0"),"^",3)=PSOX("PATIENT STATUS")
S:$G(PSOX("COSIGNING PROVIDER"))]"" $P(PSOX("NRX3"),"^",3)=PSOX("COSIGNING PROVIDER")
S $P(PSOX("NRX0"),"^",5)=PSOX("CLINIC"),$P(PSOX("NRX0"),"^",9)=PSOX("# OF REFILLS")
I $G(PSOX("DAYS SUPPLY")) S $P(PSOX("NRX0"),"^",8)=PSOX("DAYS SUPPLY")
I $G(PSOX("QTY")) S $P(PSOX("NRX0"),"^",7)=PSOX("QTY")
S $P(PSOX("NRX0"),"^",11)=$S(PSOX("FILL DATE")>DT&($P(PSOPAR,"^",6))&($G(PSOX("MAIL/WINDOW"))'="P"):"M",$D(PSOX("MAIL/WINDOW")):PSOX("MAIL/WINDOW"),1:$P(PSOX("NRX0"),"^",11)) ;*441 PAPI
S $P(PSOX("NRX0"),"^",13)=PSOX("ISSUE DATE"),$P(PSOX("STA"),"^")=PSOX("STATUS"),$P(PSOX("NRX0"),"^",16)=$S($G(PSOX("CLERK CODE"))]"":PSOX("CLERK CODE"),1:DUZ)
S $P(PSOX("NRX0"),"^",15)=$G(PSORENW("ADMINCLINIC"))
S $P(PSOX("NRX0"),"^",17)=$G(PSODRUG("COST"))
S $P(PSOX("NRX2"),"^")=PSOX("LOGIN DATE"),$P(PSOX("NRX2"),"^",2)=PSOX("FILL DATE"),$P(PSOX("NRX2"),"^",3)="",$P(PSOX("NRX2"),"^",4)="",$P(PSOX("NRX2"),"^",5)=PSOX("DISPENSED DATE")
S $P(PSOX("NRX2"),"^",6)=PSOX("STOP DATE"),$P(PSOX("NRX2"),"^",7)=$S($G(PSOX("NDC"))]"":PSOX("NDC"),1:$G(PSODRUG("NDC")))
S $P(PSOX("NRX2"),"^",8)=$S($G(PSOX("MANUFACTURER"))]"":PSOX("MANUFACTURER"),1:$G(PSODRUG("MANUFACTURER")))
S $P(PSOX("NRX2"),"^",9)=+PSOSITE,$P(PSOX("NRX2"),"^",10)=""
S $P(PSOX("NRX2"),"^",11)=$S($G(PSOX("EXPIRATION DATE"))]"":PSOX("EXPIRATION DATE"),1:$G(PSODRUG("EXPIRATION DATE")))
S:$G(PSOX("GENERIC PROVIDER"))]"" $P(PSOX("NRX2"),"^",12)=PSOX("GENERIC PROVIDER")
S $P(PSOX("NRX2"),"^",13)="",$P(PSOX("NRX2"),"^",15)="",$P(PSOX("NRX3"),"^",4)=$P(PSOX("NRX3"),"^")
S $P(PSOX("EPH"),"^")=$S($G(PSOX("DAW"))]"":PSOX("DAW"),1:$G(PSODRUG("DAW")))
;S PSOX("LAST DISPENSED DATE")=$P(PSOX("NRX3"),"^")
S PSOX("LAST DISPENSED DATE")=PSOX("DISPENSED DATE")
S $P(PSOX("NRX3"),"^")=PSOX("LAST DISPENSED DATE")
S:$G(PSOX("NEXT POSSIBLE REFILL"))]"" $P(PSOX("NRX3"),"^",2)=PSOX("NEXT POSSIBLE REFILL")
S:'$P($G(^VA(200,$P(PSOX("NRX0"),"^",4),"PS")),"^",7) $P(PSOX("NRX3"),"^",3)=""
S:$G(PSOX("REMARKS"))']"" PSOX("REMARKS")="RENEWED FROM RX # "_$P(PSOX("RX0"),"^")
S $P(PSOX("NRX3"),"^",7)=PSOX("REMARKS"),$P(PSOX("NRX3"),"^",8)=""
;
; - Patient Counseling questions P661
I $G(OR0) D FULL^VALM1,COUN^PSONEW S PSONOOR=""
;
; - File OTHER PATIENT INSTRUCTIONS into ^PSRX
I $G(PSOFXRNX) S PSOFXRN=1
D ^PSORN52C,FILE^PSORN52D
I $G(^PSRX(PSOX("OIRXN"),"INSS"))]"" S ^PSRX(PSOX("IRXN"),"INSS")=^PSRX(PSOX("OIRXN"),"INSS") K PSOX1 G F55
I $G(PSOX("SINS"))]"" S ^PSRX(PSOX("IRXN"),"INSS")=PSOX("SINS")
K PSOX1
;
; - File Patient Couseling questions after PSOX("IRXN") is set P661
I $D(^XUSEC("PSORPH",DUZ)) S DA=PSOX("IRXN"),DIE=52,DR="41////"_PSOCOU_";S:'X Y=""@1"";42////"_PSOCOUU_";@1" D ^DIE K DIE,DR
;
; - File Patient Mail Exemption set in p743
I $D(^XUSEC("PSORPH",DUZ)) S DA=PSOX("IRXN"),DIE=52,DR="100.2////"_PSOMAILX D ^DIE K DIE,DR
;
; - File data into ^PS(55)
F55 ;
L +^PS(55,PSODFN,"P"):$S(+$G(^DD("DILOCKTM"))>0:+^DD("DILOCKTM"),1:3) S:'$D(^PS(55,PSODFN,"P",0)) ^(0)="^55.03PA^^"
F PSOX1=$P(^PS(55,PSODFN,"P",0),"^",3):1 Q:'$D(^PS(55,PSODFN,"P",PSOX1))
S PSOX("55 IEN")=PSOX1
S ^PS(55,PSODFN,"P",PSOX1,0)=PSOX("IRXN"),$P(^PS(55,PSODFN,"P",0),"^",3,4)=PSOX1_"^"_($P(^PS(55,PSODFN,"P",0),"^",4)+1)
S ^PS(55,PSODFN,"P","A",PSOX("STOP DATE"),PSOX("IRXN"))=""
L -^PS(55,PSODFN,"P")
K PSOX1
;
; - Re-indexing file 52 entry
K DIK,DA S DIK="^PSRX(",DA=PSOX("IRXN") D IX1^DIK K DIK
S DA=PSOX("IRXN") D ORC^PSORN52C
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSORN52A 4761 printed Oct 16, 2024@18:34:44 Page 2
PSORN52A ;IHS/DSD/JCM/SAB/FLS-Break up of PSORN52 ;Mar 30, 2022@14:37:48
+1 ;;7.0;OUTPATIENT PHARMACY;**157,148,268,225,306,408,595,661,441,753**;DEC 1997;Build 53
+2 ; Call from tag
QUIT
+3 ;
IBHLD ;
+1 IF $PIECE(PSOIBHLD,"^",2)=""
SET $PIECE(PSOIBHLD,"^",2)=$SELECT($PIECE(PSOLDIBQ,"^",2)=1:1,$PIECE(PSOLDIBQ,"^",2)=0:0,1:"")
+2 IF $PIECE(PSOIBHLD,"^",3)=""
SET $PIECE(PSOIBHLD,"^",3)=$SELECT($PIECE(PSOLDIBQ,"^",3)=1:1,$PIECE(PSOLDIBQ,"^",3)=0:0,1:"")
+3 IF $PIECE(PSOIBHLD,"^",4)=""
SET $PIECE(PSOIBHLD,"^",4)=$SELECT($PIECE(PSOLDIBQ,"^",4)=1:1,$PIECE(PSOLDIBQ,"^",4)=0:0,1:"")
+4 IF $PIECE(PSOIBHLD,"^",5)=""
SET $PIECE(PSOIBHLD,"^",5)=$SELECT($PIECE(PSOLDIBQ,"^",5)=1:1,$PIECE(PSOLDIBQ,"^",5)=0:0,1:"")
+5 IF $PIECE(PSOIBHLD,"^",6)=""
SET $PIECE(PSOIBHLD,"^",6)=$SELECT($PIECE(PSOLDIBQ,"^",6)=1:1,$PIECE(PSOLDIBQ,"^",6)=0:0,1:"")
+6 IF $PIECE(PSOIBHLD,"^",7)=""
SET $PIECE(PSOIBHLD,"^",7)=$SELECT($PIECE(PSOLDIBQ,"^",7)=1:1,$PIECE(PSOLDIBQ,"^",7)=0:0,1:"")
+7 IF $PIECE(PSOIBHLD,"^",8)=""
SET $PIECE(PSOIBHLD,"^",8)=$SELECT($PIECE(PSOLDIBQ,"^",8)=1:1,$PIECE(PSOLDIBQ,"^",8)=0:0,1:"")
+8 QUIT
+9 ;
FILE ; - Filling ^PSRX and ^PS(55 entries
+1 SET PSOX("NRX0")=PSORENW("RX0")
SET PSOX("NRX2")=PSORENW("RX2")
SET PSOX("NRX3")=PSORENW("RX3")
SET $PIECE(PSOX("NRX3"),"^",5)=""
+2 SET $PIECE(PSOX("NRX0"),"^")=PSOX("NRX #")
if $GET(PSOX("PROVIDER"))]""
SET $PIECE(PSOX("NRX0"),"^",4)=PSOX("PROVIDER")
+3 IF $GET(PSORNSPD)
IF $GET(PSOX("PATIENT STATUS"))
IF $GET(PSOX("PATIENT STATUS"))?.N
SET $PIECE(PSOX("NRX0"),"^",3)=PSOX("PATIENT STATUS")
+4 if $GET(PSOX("COSIGNING PROVIDER"))]""
SET $PIECE(PSOX("NRX3"),"^",3)=PSOX("COSIGNING PROVIDER")
+5 SET $PIECE(PSOX("NRX0"),"^",5)=PSOX("CLINIC")
SET $PIECE(PSOX("NRX0"),"^",9)=PSOX("# OF REFILLS")
+6 IF $GET(PSOX("DAYS SUPPLY"))
SET $PIECE(PSOX("NRX0"),"^",8)=PSOX("DAYS SUPPLY")
+7 IF $GET(PSOX("QTY"))
SET $PIECE(PSOX("NRX0"),"^",7)=PSOX("QTY")
+8 ;*441 PAPI
SET $PIECE(PSOX("NRX0"),"^",11)=$SELECT(PSOX("FILL DATE")>DT&($PIECE(PSOPAR,"^",6))&($GET(PSOX("MAIL/WINDOW"))'="P"):"M",$DATA(PSOX("MAIL/WINDOW")):PSOX("MAIL/WINDOW"),1:$PIECE(PSOX("NRX0"),"^",11))
+9 SET $PIECE(PSOX("NRX0"),"^",13)=PSOX("ISSUE DATE")
SET $PIECE(PSOX("STA"),"^")=PSOX("STATUS")
SET $PIECE(PSOX("NRX0"),"^",16)=$SELECT($GET(PSOX("CLERK CODE"))]"":PSOX("CLERK CODE"),1:DUZ)
+10 SET $PIECE(PSOX("NRX0"),"^",15)=$GET(PSORENW("ADMINCLINIC"))
+11 SET $PIECE(PSOX("NRX0"),"^",17)=$GET(PSODRUG("COST"))
+12 SET $PIECE(PSOX("NRX2"),"^")=PSOX("LOGIN DATE")
SET $PIECE(PSOX("NRX2"),"^",2)=PSOX("FILL DATE")
SET $PIECE(PSOX("NRX2"),"^",3)=""
SET $PIECE(PSOX("NRX2"),"^",4)=""
SET $PIECE(PSOX("NRX2"),"^",5)=PSOX("DISPENSED DATE")
+13 SET $PIECE(PSOX("NRX2"),"^",6)=PSOX("STOP DATE")
SET $PIECE(PSOX("NRX2"),"^",7)=$SELECT($GET(PSOX("NDC"))]"":PSOX("NDC"),1:$GET(PSODRUG("NDC")))
+14 SET $PIECE(PSOX("NRX2"),"^",8)=$SELECT($GET(PSOX("MANUFACTURER"))]"":PSOX("MANUFACTURER"),1:$GET(PSODRUG("MANUFACTURER")))
+15 SET $PIECE(PSOX("NRX2"),"^",9)=+PSOSITE
SET $PIECE(PSOX("NRX2"),"^",10)=""
+16 SET $PIECE(PSOX("NRX2"),"^",11)=$SELECT($GET(PSOX("EXPIRATION DATE"))]"":PSOX("EXPIRATION DATE"),1:$GET(PSODRUG("EXPIRATION DATE")))
+17 if $GET(PSOX("GENERIC PROVIDER"))]""
SET $PIECE(PSOX("NRX2"),"^",12)=PSOX("GENERIC PROVIDER")
+18 SET $PIECE(PSOX("NRX2"),"^",13)=""
SET $PIECE(PSOX("NRX2"),"^",15)=""
SET $PIECE(PSOX("NRX3"),"^",4)=$PIECE(PSOX("NRX3"),"^")
+19 SET $PIECE(PSOX("EPH"),"^")=$SELECT($GET(PSOX("DAW"))]"":PSOX("DAW"),1:$GET(PSODRUG("DAW")))
+20 ;S PSOX("LAST DISPENSED DATE")=$P(PSOX("NRX3"),"^")
+21 SET PSOX("LAST DISPENSED DATE")=PSOX("DISPENSED DATE")
+22 SET $PIECE(PSOX("NRX3"),"^")=PSOX("LAST DISPENSED DATE")
+23 if $GET(PSOX("NEXT POSSIBLE REFILL"))]""
SET $PIECE(PSOX("NRX3"),"^",2)=PSOX("NEXT POSSIBLE REFILL")
+24 if '$PIECE($GET(^VA(200,$PIECE(PSOX("NRX0"),"^",4),"PS")),"^",7)
SET $PIECE(PSOX("NRX3"),"^",3)=""
+25 if $GET(PSOX("REMARKS"))']""
SET PSOX("REMARKS")="RENEWED FROM RX # "_$PIECE(PSOX("RX0"),"^")
+26 SET $PIECE(PSOX("NRX3"),"^",7)=PSOX("REMARKS")
SET $PIECE(PSOX("NRX3"),"^",8)=""
+27 ;
+28 ; - Patient Counseling questions P661
+29 IF $GET(OR0)
DO FULL^VALM1
DO COUN^PSONEW
SET PSONOOR=""
+30 ;
+31 ; - File OTHER PATIENT INSTRUCTIONS into ^PSRX
+32 IF $GET(PSOFXRNX)
SET PSOFXRN=1
+33 DO ^PSORN52C
DO FILE^PSORN52D
+34 IF $GET(^PSRX(PSOX("OIRXN"),"INSS"))]""
SET ^PSRX(PSOX("IRXN"),"INSS")=^PSRX(PSOX("OIRXN"),"INSS")
KILL PSOX1
GOTO F55
+35 IF $GET(PSOX("SINS"))]""
SET ^PSRX(PSOX("IRXN"),"INSS")=PSOX("SINS")
+36 KILL PSOX1
+37 ;
+38 ; - File Patient Couseling questions after PSOX("IRXN") is set P661
+39 IF $DATA(^XUSEC("PSORPH",DUZ))
SET DA=PSOX("IRXN")
SET DIE=52
SET DR="41////"_PSOCOU_";S:'X Y=""@1"";42////"_PSOCOUU_";@1"
DO ^DIE
KILL DIE,DR
+40 ;
+41 ; - File Patient Mail Exemption set in p743
+42 IF $DATA(^XUSEC("PSORPH",DUZ))
SET DA=PSOX("IRXN")
SET DIE=52
SET DR="100.2////"_PSOMAILX
DO ^DIE
KILL DIE,DR
+43 ;
+44 ; - File data into ^PS(55)
F55 ;
+1 LOCK +^PS(55,PSODFN,"P"):$SELECT(+$GET(^DD("DILOCKTM"))>0:+^DD("DILOCKTM"),1:3)
if '$DATA(^PS(55,PSODFN,"P",0))
SET ^(0)="^55.03PA^^"
+2 FOR PSOX1=$PIECE(^PS(55,PSODFN,"P",0),"^",3):1
if '$DATA(^PS(55,PSODFN,"P",PSOX1))
QUIT
+3 SET PSOX("55 IEN")=PSOX1
+4 SET ^PS(55,PSODFN,"P",PSOX1,0)=PSOX("IRXN")
SET $PIECE(^PS(55,PSODFN,"P",0),"^",3,4)=PSOX1_"^"_($PIECE(^PS(55,PSODFN,"P",0),"^",4)+1)
+5 SET ^PS(55,PSODFN,"P","A",PSOX("STOP DATE"),PSOX("IRXN"))=""
+6 LOCK -^PS(55,PSODFN,"P")
+7 KILL PSOX1
+8 ;
+9 ; - Re-indexing file 52 entry
+10 KILL DIK,DA
SET DIK="^PSRX("
SET DA=PSOX("IRXN")
DO IX1^DIK
KILL DIK
+11 SET DA=PSOX("IRXN")
DO ORC^PSORN52C
+12 QUIT