PSSCKOS ;BP/AGV - Returns order status for OP pharmacy using the CK option ;12/14/12
;;1.0;PHARMACY DATA MANAGEMENT;**175**;9/30/97;Build 9
;
; @Author - Alberto Vargas
; @Date - December 14, 2012
; @Version - 1.0
; @CCRs - 5828, 6450, 6600
;
THOSTAT(DRG,THR,TCTR) ;**Add order status to THERAPY order check messages while using the hidden CK option
NEW DRGN,PSOSTA,PSONM,PSOPON,PSOCFLG,PSOFLG SET DRGN="",PSOSTA="",PSONM="",PSOPON="",PSOCFLG="",PSOFLG=""
;**Retrieve and extract associated order number
SET DRGN=DRG,PSOPON=$P($G(^TMP($J,LIST,"OUT","THERAPY",THR,"DRUGS",TCTR)),U,1),PSOCFLG=$P(PSOPON,";",1),PSOPON=$P(PSOPON,";",2)
;**Check for a clinic order
IF PSOCFLG["C" SET DRGN=DRG_" (Clinic order)" Q DRGN
;**Order through PSOSD array to retrieve associated order statuses from patient's profile
FOR SET PSOSTA=$O(PSOSD(PSOSTA)) Q:(PSOSTA="")!($G(PSOFLG)) D
.IF '$D(PSOSD(PSOSTA,DRG)),DRG=PSODRUG("NAME") SET DRGN=DRG_" (Prospective)",PSOFLG=1
.FOR SET PSONM=$O(PSOSD(PSOSTA,PSONM)) Q:(PSONM="")!($G(PSOFLG)) D
..IF DRG=$P(PSONM,U,1) D
...IF PSOSTA="ACTIVE",PSOPON=$P(PSOSD(PSOSTA,PSONM),U,1) SET DRGN=DRG_" (Local Rx)",PSOFLG=1
...IF PSOSTA="ZNONVA",PSOPON=$P(PSOSD(PSOSTA,PSONM),U,10) SET DRGN=DRG_" (Non-VA)",PSOFLG=1
...IF PSOSTA="DISCONTINUED",PSOPON=$P(PSOSD(PSOSTA,PSONM),U,1) SET DRGN=DRG_" (Discontinued)",PSOFLG=1
...IF PSOSTA="PENDING",PSOPON=$P(PSOSD(PSOSTA,PSONM),U,10) SET DRGN=DRG_" (Pending)",PSOFLG=1
Q DRGN
;
OSTAT(DRG,ON) ;**Add order status to DRUG order check messages while using the hidden CK option
NEW DRGN,PSOSTA,PSONM,PSOPON,PSOCFLG,PSOFLG SET DRGN="",PSOSTA="",PSONM="",PSOPON="",PSOCFLG="",PSOFLG=""
;**Retrieve and extract associated order number
SET DRGN=DRG,PSOCFLG=$P(ON,";",1),PSOPON=$P(ON,";",2)
;**Check for a clinic order
IF PSOCFLG["C" SET DRGN=DRG_" (Clinic order)" Q DRGN
;**Order through PSOSD array to retrieve associated order statuses from patient's profile
FOR SET PSOSTA=$O(PSOSD(PSOSTA)) Q:(PSOSTA="")!($G(PSOFLG)) D
.IF '$D(PSOSD(PSOSTA,DRG)),DRG=PSODRUG("NAME") SET DRGN=DRG_" (Prospective)",PSOFLG=1
.FOR SET PSONM=$O(PSOSD(PSOSTA,PSONM)) Q:(PSONM="")!($G(PSOFLG)) D
..IF DRG=$P(PSONM,U,1) D
...IF PSOSTA="ACTIVE",PSOPON=$P(PSOSD(PSOSTA,PSONM),U,1) SET DRGN=DRG_" (Local Rx)",PSOFLG=1
...IF PSOSTA="ZNONVA",PSOPON=$P(PSOSD(PSOSTA,PSONM),U,10) SET DRGN=DRG_" (Non-VA)",PSOFLG=1
...IF PSOSTA="PENDING",PSOPON=$P(PSOSD(PSOSTA,PSONM),U,10) SET DRGN=DRG_" (Pending)",PSOFLG=1
Q DRGN
;
POSTAT(DRG,PDRG,SV,ON,CT) ;**Add order status to PDRUG order check messages while using the hidden CK option
NEW PDRGN,PSOSTA,PSONM,PSOPON,PSOCFLG,PSOFLG SET PDRGN="",PSOSTA="",PSONM="",PSOPON="",PSOCFLG="",PSOFLG=""
;**Retrieve and extract associated order number
SET PDRGN=PDRG,PSOPON=$P($G(^TMP($J,LIST,"OUT","DRUGDRUG",SV,DRG,ON,CT)),U,1),PSOCFLG=$P(PSOPON,";",1),PSOPON=$P(PSOPON,";",2)
;**Check for a clinic order
IF PSOCFLG["C" SET PDRGN=PDRG_" (Clinic order)" Q PDRGN
;**Order through PSOSD array to retrieve associated order statuses from patient's profile
FOR SET PSOSTA=$O(PSOSD(PSOSTA)) Q:(PSOSTA="")!($G(PSOFLG)) D
.IF '$D(PSOSD(PSOSTA,PDRG)),PDRG=PSODRUG("NAME") SET PDRGN=PDRG_" (Prospective)",PSOFLG=1
.FOR SET PSONM=$O(PSOSD(PSOSTA,PSONM)) Q:(PSONM="")!($G(PSOFLG)) D
..IF PDRG=$P(PSONM,U,1) D
...IF PSOSTA="ACTIVE",PSOPON=$P(PSOSD(PSOSTA,PSONM),U,1) SET PDRGN=PDRG_" (Local Rx)",PSOFLG=1
...IF PSOSTA="ZNONVA",PSOPON=$P(PSOSD(PSOSTA,PSONM),U,10) SET PDRGN=PDRG_" (Non-VA)",PSOFLG=1
...IF PSOSTA="PENDING",PSOPON=$P(PSOSD(PSOSTA,PSONM),U,10) SET PDRGN=PDRG_" (Pending)",PSOFLG=1
Q PDRGN
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSSCKOS 3671 printed Oct 16, 2024@18:31:11 Page 2
PSSCKOS ;BP/AGV - Returns order status for OP pharmacy using the CK option ;12/14/12
+1 ;;1.0;PHARMACY DATA MANAGEMENT;**175**;9/30/97;Build 9
+2 ;
+3 ; @Author - Alberto Vargas
+4 ; @Date - December 14, 2012
+5 ; @Version - 1.0
+6 ; @CCRs - 5828, 6450, 6600
+7 ;
THOSTAT(DRG,THR,TCTR) ;**Add order status to THERAPY order check messages while using the hidden CK option
+1 NEW DRGN,PSOSTA,PSONM,PSOPON,PSOCFLG,PSOFLG
SET DRGN=""
SET PSOSTA=""
SET PSONM=""
SET PSOPON=""
SET PSOCFLG=""
SET PSOFLG=""
+2 ;**Retrieve and extract associated order number
+3 SET DRGN=DRG
SET PSOPON=$PIECE($GET(^TMP($JOB,LIST,"OUT","THERAPY",THR,"DRUGS",TCTR)),U,1)
SET PSOCFLG=$PIECE(PSOPON,";",1)
SET PSOPON=$PIECE(PSOPON,";",2)
+4 ;**Check for a clinic order
+5 IF PSOCFLG["C"
SET DRGN=DRG_" (Clinic order)"
QUIT DRGN
+6 ;**Order through PSOSD array to retrieve associated order statuses from patient's profile
+7 FOR
SET PSOSTA=$ORDER(PSOSD(PSOSTA))
if (PSOSTA="")!($GET(PSOFLG))
QUIT
Begin DoDot:1
+8 IF '$DATA(PSOSD(PSOSTA,DRG))
IF DRG=PSODRUG("NAME")
SET DRGN=DRG_" (Prospective)"
SET PSOFLG=1
+9 FOR
SET PSONM=$ORDER(PSOSD(PSOSTA,PSONM))
if (PSONM="")!($GET(PSOFLG))
QUIT
Begin DoDot:2
+10 IF DRG=$PIECE(PSONM,U,1)
Begin DoDot:3
+11 IF PSOSTA="ACTIVE"
IF PSOPON=$PIECE(PSOSD(PSOSTA,PSONM),U,1)
SET DRGN=DRG_" (Local Rx)"
SET PSOFLG=1
+12 IF PSOSTA="ZNONVA"
IF PSOPON=$PIECE(PSOSD(PSOSTA,PSONM),U,10)
SET DRGN=DRG_" (Non-VA)"
SET PSOFLG=1
+13 IF PSOSTA="DISCONTINUED"
IF PSOPON=$PIECE(PSOSD(PSOSTA,PSONM),U,1)
SET DRGN=DRG_" (Discontinued)"
SET PSOFLG=1
+14 IF PSOSTA="PENDING"
IF PSOPON=$PIECE(PSOSD(PSOSTA,PSONM),U,10)
SET DRGN=DRG_" (Pending)"
SET PSOFLG=1
End DoDot:3
End DoDot:2
End DoDot:1
+15 QUIT DRGN
+16 ;
OSTAT(DRG,ON) ;**Add order status to DRUG order check messages while using the hidden CK option
+1 NEW DRGN,PSOSTA,PSONM,PSOPON,PSOCFLG,PSOFLG
SET DRGN=""
SET PSOSTA=""
SET PSONM=""
SET PSOPON=""
SET PSOCFLG=""
SET PSOFLG=""
+2 ;**Retrieve and extract associated order number
+3 SET DRGN=DRG
SET PSOCFLG=$PIECE(ON,";",1)
SET PSOPON=$PIECE(ON,";",2)
+4 ;**Check for a clinic order
+5 IF PSOCFLG["C"
SET DRGN=DRG_" (Clinic order)"
QUIT DRGN
+6 ;**Order through PSOSD array to retrieve associated order statuses from patient's profile
+7 FOR
SET PSOSTA=$ORDER(PSOSD(PSOSTA))
if (PSOSTA="")!($GET(PSOFLG))
QUIT
Begin DoDot:1
+8 IF '$DATA(PSOSD(PSOSTA,DRG))
IF DRG=PSODRUG("NAME")
SET DRGN=DRG_" (Prospective)"
SET PSOFLG=1
+9 FOR
SET PSONM=$ORDER(PSOSD(PSOSTA,PSONM))
if (PSONM="")!($GET(PSOFLG))
QUIT
Begin DoDot:2
+10 IF DRG=$PIECE(PSONM,U,1)
Begin DoDot:3
+11 IF PSOSTA="ACTIVE"
IF PSOPON=$PIECE(PSOSD(PSOSTA,PSONM),U,1)
SET DRGN=DRG_" (Local Rx)"
SET PSOFLG=1
+12 IF PSOSTA="ZNONVA"
IF PSOPON=$PIECE(PSOSD(PSOSTA,PSONM),U,10)
SET DRGN=DRG_" (Non-VA)"
SET PSOFLG=1
+13 IF PSOSTA="PENDING"
IF PSOPON=$PIECE(PSOSD(PSOSTA,PSONM),U,10)
SET DRGN=DRG_" (Pending)"
SET PSOFLG=1
End DoDot:3
End DoDot:2
End DoDot:1
+14 QUIT DRGN
+15 ;
POSTAT(DRG,PDRG,SV,ON,CT) ;**Add order status to PDRUG order check messages while using the hidden CK option
+1 NEW PDRGN,PSOSTA,PSONM,PSOPON,PSOCFLG,PSOFLG
SET PDRGN=""
SET PSOSTA=""
SET PSONM=""
SET PSOPON=""
SET PSOCFLG=""
SET PSOFLG=""
+2 ;**Retrieve and extract associated order number
+3 SET PDRGN=PDRG
SET PSOPON=$PIECE($GET(^TMP($JOB,LIST,"OUT","DRUGDRUG",SV,DRG,ON,CT)),U,1)
SET PSOCFLG=$PIECE(PSOPON,";",1)
SET PSOPON=$PIECE(PSOPON,";",2)
+4 ;**Check for a clinic order
+5 IF PSOCFLG["C"
SET PDRGN=PDRG_" (Clinic order)"
QUIT PDRGN
+6 ;**Order through PSOSD array to retrieve associated order statuses from patient's profile
+7 FOR
SET PSOSTA=$ORDER(PSOSD(PSOSTA))
if (PSOSTA="")!($GET(PSOFLG))
QUIT
Begin DoDot:1
+8 IF '$DATA(PSOSD(PSOSTA,PDRG))
IF PDRG=PSODRUG("NAME")
SET PDRGN=PDRG_" (Prospective)"
SET PSOFLG=1
+9 FOR
SET PSONM=$ORDER(PSOSD(PSOSTA,PSONM))
if (PSONM="")!($GET(PSOFLG))
QUIT
Begin DoDot:2
+10 IF PDRG=$PIECE(PSONM,U,1)
Begin DoDot:3
+11 IF PSOSTA="ACTIVE"
IF PSOPON=$PIECE(PSOSD(PSOSTA,PSONM),U,1)
SET PDRGN=PDRG_" (Local Rx)"
SET PSOFLG=1
+12 IF PSOSTA="ZNONVA"
IF PSOPON=$PIECE(PSOSD(PSOSTA,PSONM),U,10)
SET PDRGN=PDRG_" (Non-VA)"
SET PSOFLG=1
+13 IF PSOSTA="PENDING"
IF PSOPON=$PIECE(PSOSD(PSOSTA,PSONM),U,10)
SET PDRGN=PDRG_" (Pending)"
SET PSOFLG=1
End DoDot:3
End DoDot:2
End DoDot:1
+14 QUIT PDRGN