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

PSJIPST1.m

Go to the documentation of this file.
  1. PSJIPST1 ;BIR/CML3-INSTALL INPATIENT MEDS FOR OE/RR (& MAS) ;03 OCT 96 / 8:42 AM
  1. ;;5.0; INPATIENT MEDICATIONS ;;16 DEC 97
  1. ;
  1. START ;
  1. ;W !!,"...installing Inpatient Medications protocols for OE/RR (and MAS)..." D ^PSJONIT
  1. ;W !!,"...setting up Inpatient protocols..."
  1. S MENU="DGPM MOVEMENT EVENTS",ITEM="PSJ OR PAT ADT" D SETUP,DONE
  1. ;W !!,"...installing Inpatient Medications List Templates..." D ^PSJL
  1. Q
  1. ;
  1. ENORDER ; Begin conversion of existing orders (active after t-365)
  1. ; THIS IS NO LONGER CALLED FROM OUR POST INIT
  1. ; THIS CONVERSION IS RAN THROUGH CPRS
  1. Q
  1. K ZTSAVE,ZTSK S ZTRTN="DEQORDER^PSJIPST1",ZTDTH=$H,ZTDESC="Inpatient Orders Conversion (INPATIENT MEDS POST-INIT)",ZTIO="" D ^%ZTLOAD
  1. ;W !!,"The conversion of existing Unit Dose orders to the new format is",$S($D(ZTSK):"",1:" NOT")," queued",!
  1. D MES^XPDUTL(" ")
  1. S PSJMESSG="The conversion of existing Unit Dose orders to the new format is"_$S($D(ZTSK):"",1:" NOT")_" queued" D MES^XPDUTL(PSJMESSG)
  1. ;I $D(ZTSK) W " (to start NOW).",!!,"YOU WILL RECEIVE A MAILMAN MESSAGE WHEN TASK #"_ZTSK_" HAS COMPLETED."
  1. I $D(ZTSK) S PSJMESSG="(to start NOW). YOU WILL RECEIVE A MAILMAN MESSAGE WHEN TASK #"_ZTSK_" HAS COMPLETED." D MES^XPDUTL(PSJMESSG)
  1. Q
  1. ;
  1. ENPL ; Entry point to begin conversion process to change pick list
  1. ; from primary drug to orderable item.
  1. ;
  1. K ZTSAVE,ZTSK S ZTIO="",ZTDTH=$H,ZTDESC="Conversion of Pick Lists",ZTRTN="DEQPL^PSJIPST2" D ^%ZTLOAD
  1. ;W !!,"The conversion of existing pick lists from primary drug to orderable item",!,"has",$S($D(ZTSK):"",1:" NOT")," been queued"
  1. D MES^XPDUTL(" ")
  1. S PSJMESSG="The conversion of existing pick lists from primary drug to orderable item has"_$S($D(ZTSK):"",1:" NOT")_" been queued" D MES^XPDUTL(PSJMESSG)
  1. ;I $D(ZTSK) W " (to start NOW).",!!,"YOU WILL RECEIVE A MAILMAN MESSAGE WHEN TASK #"_ZTSK_" HAS COMPLETED."
  1. I $D(ZTSK) S PSJMESSG=" (to start NOW). YOU WILL RECEIVE A MAILMAN MESSAGE WHEN TASK #"_ZTSK_" HAS COMPLETED." D MES^XPDUTL(PSJMESSG)
  1. Q
  1. ;
  1. DEQORDER ; Convert existing UD and IV orders to new format.
  1. ; Entries found with no 0 node will be deleted!
  1. ; THIS IS NO LONGER USED
  1. Q
  1. D NOW^%DTC S PSJSTART=$E(%,1,12),PCNT=0
  1. F DFN=0:0 S DFN=$O(^PS(55,DFN)) Q:'DFN D CONVERT^PSJUTL1(DFN,0) S PCNT=PCNT+1
  1. D BADNAMES^PSJIPST3 ; sends mail message if changed names were found
  1. ;
  1. ; Send mail message when Inpatient order conversion completes.
  1. K PSG,XMY S XMDUZ="MEDICATIONS,INPATIENT",XMSUB="INPATIENT MEDS ORDER CONVERSION COMPLETED",XMTEXT="PSG(",XMY(DUZ)="" D NOW^%DTC S Y=% X ^DD("DD")
  1. S PSG(1,0)=" The conversion of existing Unit Dose orders for use with Inpatient",PSG(2,0)="Medications 5.0 completed as of "_Y_"."
  1. S X=$$FMDIFF^XLFDT(%,PSJSTART,3) S:$L(X," ")>1 DAYS=+$P(X," "),X=$P(X," ",2) S HOURS=+$P(X,":"),MINS=+$P(X,":",2)
  1. S PSG(3,0)=" ",PSG(4,0)="This process converted orders for "_PCNT_" patients in "_$S($G(DAYS):DAYS_" day"_$E("s",DAYS'=1)_", ",1:"")_HOURS_" hour"_$E("s",HOURS'=1),PSG(5,0)=" and "_MINS_" minute"_$E("s",MINS'=1)_"."
  1. N DIFROM D ^XMD
  1. ;
  1. DONE ;
  1. K DA,DFN,DIC,DIE,DIK,DINUM,DLAYGO,DR,ITEM,MENU,ON,PSG,X,XMDUZ,XMSUB,XMTEXT,XMY,Y,ZTDESC,ZTDTH,ZTIO,ZTREQ,ZTRTN,ZTSAVE,ZTSK
  1. Q
  1. UNDO ; FOR DIAGNOSTIC DEVELOPMENT ONLY!!!
  1. F DFN=0:0 S DFN=$O(^PS(55,DFN)) Q:'DFN S $P(^PS(55,DFN,5.1),U,11)="" D
  1. .F ON=0:0 S ON=$O(^PS(55,DFN,5,ON)) Q:'ON K ^PS(55,DFN,5,ON,.2)
  1. .F ON=0:0 S ON=$O(^PS(55,DFN,"IV",ON)) Q:ON K ^PS(55,DFN,"IV",ON,.2)
  1. ;
  1. SETUP ;
  1. S MENUP=$O(^ORD(101,"B",MENU,0)) I 'MENUP W $C(7),!!,"Cannot find the protocol menu '",MENU,"'.",!,"You need to add the protocol '",ITEM,"' to this protocol menu.",! Q
  1. ;
  1. SETUP1 ;
  1. S X=$O(^ORD(101,"B",ITEM,0)) I 'X W $C(7),!!,"Cannot find the protocol '",ITEM,"'.",!,"You need to add this protocol to the protocol menu '",MENU,"'.",! Q
  1. I $D(^ORD(101,MENUP,10,"B",X)) W !,"Protocol '",ITEM,"' is already set up under the protocol",!,"menu '",MENU,"'." Q
  1. I $D(^ORD(101,MENUP,10,0))[0 S ^ORD(101,MENUP,10,0)="^"_$P(^DD(101,10,0),"^",2)
  1. K DA,DD,DO,DIC S DIC="^ORD(101,"_MENUP_",10,",DIC(0)="L",DLAYGO=101.01,DA(1)=MENUP D FILE^DICN
  1. W !,"Protocol '",ITEM,"' ",$S($P(Y,"^",3):"",1:"NOT "),"added to the protocol menu",!,"'",MENU,"'."
  1. Q
  1. ;
  1. ENMUD ; Mark ALL 50 drugs as UD items.
  1. S PSIUX="U" F DRG=0:0 S DRG=$O(^PSDRUG(DRG)) Q:'DRG I $S('$D(^PSDRUG(DRG,"I")):1,'+^("I"):1,+^("I")>DT:1,1:0) S PSIUDA=+DRG D ENS^PSGIU
  1. MAILMUD ;
  1. N DRG,APU,PSJ,XMY D NOW^%DTC S Y=% X ^DD("DD") S XMDUZ="MEDICATIONS,INPATIENT",XMSUB="MARK ALL DRUGS AS UNIT DOSE ITEMS",XMTEXT="PSJ(",XMY(DUZ)=""
  1. S PSJ(1,0)=" The process to mark all ACTIVE drugs in your local drug file (50) as Unit",PSJ(2,0)="Dose items completed as of "_$P(Y,"@")_" "_$P(Y,"@",2)_"."
  1. N DIFROM D ^XMD
  1. Q