PSJ0095 ;BIR/JCH-Populate Pre-Exchange Report Device in Ward Parameteres ;22 JAN 03 / 4:29 PM
;;5.0; INPATIENT MEDICATIONS ;**95**;16 DEC 97
;
ENNV ;
I $G(DUZ)="" W !,"Your DUZ is not defined. It must be defined to run this routine." Q
K ZTSAVE,ZTSK S ZTRTN="EN^PSJ0095",ZTDESC="Inpatient Ward Parameter Pre-Exchange Report Device (INPATIENT MEDS)",ZTIO="" D ^%ZTLOAD
W !!,"The population of Inpatient Ward Parameter PRE-EXCHANGE REPORT DEVICE is",$S($D(ZTSK):"",1:" NOT")," queued",!
I $D(ZTSK) D
. W " (to start NOW).",!!,"YOU WILL RECEIVE A MAILMAN MESSAGE WHEN TASK #"_ZTSK_" HAS COMPLETED."
Q
EN ;
N WARD,PXDEV,CC S (WARD,CC)=0
F S WARD=$O(^PS(59.6,WARD)) Q:'WARD S PXDEV=$P($G(^(WARD,0)),"^",29) D
. I PXDEV Q:$D(^%ZIS(1,PXDEV))
. S DA=WARD,DIE="^PS(59.6,",DR="4////HOME" D ^DIE S CC=CC+1
D SENDMSG
Q
;
DONE ;
K ZTDESC,ZTDTH,ZTIO,ZTREQ,ZTRTN,ZTSAVE,ZTSK S ZTREQ="@"
Q
SENDMSG ;Send mail message when auto-population is complete.
K PSG,XMY S XMDUZ="MEDICATIONS,INPATIENT",XMSUB="PSJ*5*95 POPULATION OF INPATIENT WARD PARAMETER PRE-EXCHANGE REPORT DEVICE "
S XMTEXT="PSG(",XMY(DUZ)="" D NOW^%DTC S Y=% X ^DD("DD")
S PSG(1,0)="The population of the Inpatient Ward parameter 'PRE-EXCHANGE REPORT DEVICE'",PSG(2,0)="completed as of "_Y_"."
S PSG(3,0)="",PSG(4,0)=CC_" Inpatient Wards were updated with this parameter defaulted to 'HOME'."
S PSG(5,0)="This will continue to print the report to the user's screen until it is changed"
S PSG(6,0)="to another device, or deleted to disable the report for that ward."
D ^XMD
Q
PSJ0095 ;BIR/JCH-Populate Pre-Exchange Report Device in Ward Parameteres ;22 JAN 03 / 4:29 PM
+1 ;;5.0; INPATIENT MEDICATIONS ;**95**;16 DEC 97
+2 ;
ENNV ;
+1 IF $GET(DUZ)=""
WRITE !,"Your DUZ is not defined. It must be defined to run this routine."
QUIT
+2 KILL ZTSAVE,ZTSK
SET ZTRTN="EN^PSJ0095"
SET ZTDESC="Inpatient Ward Parameter Pre-Exchange Report Device (INPATIENT MEDS)"
SET ZTIO=""
DO ^%ZTLOAD
+3 WRITE !!,"The population of Inpatient Ward Parameter PRE-EXCHANGE REPORT DEVICE is",$SELECT($DATA(ZTSK):"",1:" NOT")," queued",!
+4 IF $DATA(ZTSK)
Begin DoDot:1
+5 WRITE " (to start NOW).",!!,"YOU WILL RECEIVE A MAILMAN MESSAGE WHEN TASK #"_ZTSK_" HAS COMPLETED."
End DoDot:1
+6 QUIT
EN ;
+1 NEW WARD,PXDEV,CC
SET (WARD,CC)=0
+2 FOR
SET WARD=$ORDER(^PS(59.6,WARD))
IF 'WARD
QUIT
SET PXDEV=$PIECE($GET(^(WARD,0)),"^",29)
Begin DoDot:1
+3 IF PXDEV
IF $DATA(^%ZIS(1,PXDEV))
QUIT
+4 SET DA=WARD
SET DIE="^PS(59.6,"
SET DR="4////HOME"
DO ^DIE
SET CC=CC+1
End DoDot:1
+5 DO SENDMSG
+6 QUIT
+7 ;
DONE ;
+1 KILL ZTDESC,ZTDTH,ZTIO,ZTREQ,ZTRTN,ZTSAVE,ZTSK
SET ZTREQ="@"
+2 QUIT
SENDMSG ;Send mail message when auto-population is complete.
+1 KILL PSG,XMY
SET XMDUZ="MEDICATIONS,INPATIENT"
SET XMSUB="PSJ*5*95 POPULATION OF INPATIENT WARD PARAMETER PRE-EXCHANGE REPORT DEVICE "
+2 SET XMTEXT="PSG("
SET XMY(DUZ)=""
DO NOW^%DTC
SET Y=%
XECUTE ^DD("DD")
+3 SET PSG(1,0)="The population of the Inpatient Ward parameter 'PRE-EXCHANGE REPORT DEVICE'"
SET PSG(2,0)="completed as of "_Y_"."
+4 SET PSG(3,0)=""
SET PSG(4,0)=CC_" Inpatient Wards were updated with this parameter defaulted to 'HOME'."
+5 SET PSG(5,0)="This will continue to print the report to the user's screen until it is changed"
+6 SET PSG(6,0)="to another device, or deleted to disable the report for that ward."
+7 DO ^XMD
+8 QUIT