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

BSDPOST.m

Go to the documentation of this file.
  1. BSDPOST ; IHS/ANMC/LJF - PIMS POSTINIT ; [ 08/24/2004 11:32 AM ]
  1. ;;5.3;PIMS;**1001,1003,1004,1005**;MAY 28, 2004
  1. ; post init code for Scheduling data
  1. ;;IHS/ITSC/LJF 04/14/2005 PATCH 1003 added 1 BTS protocol name to end of routine
  1. ; 06/23/2005 PATCH 1003 added 1 APCH protocol name to end of routine
  1. ; 08/24/2005 PATCH 1004 added 4 BSDX (GUI Scheduling) protocols
  1. ;IHS/OIT/LJF 02/16/2006 PATCH 1005 added new BSDAM RS AT CHECKIN to protocol list
  1. ; (documenting sequence number assignments)
  1. ;
  1. Q
  1. ;IHS/ITSC/WAR 8/21/03 new Xref coming in w/Pkg, now need to
  1. ASTOP ;EP; -- reindex existing records for historic visits in EHR
  1. S DIK="^SC("
  1. S DIK(1)="8^ASTOP"
  1. D ENALL^DIK
  1. Q
  1. ;
  1. ;IHS/ITSC/WAR 10/17/03 added - updates the Sched ver# in pkg file
  1. ;IHS/ITSC/LJF 1/16/2004 added more updates
  1. PKGFILE ;EP
  1. NEW VER,BDGV,BDGN,X,DA,DIC,Y,DIE,DR
  1. I $D(XPDNM) S VER=$$VER^XPDUTL(XPDNM)
  1. I $G(VER)]"" D
  1. .; update current version field
  1. .S BDGN=$O(^DIC(9.4,"C","SD",0)) Q:'BDGN
  1. .S ^DIC(9.4,BDGN,"VERSION")=VER
  1. .;
  1. .; clean up old 5.3 test versions
  1. .S BDGV=0 F S BDGV=$O(^DIC(9.4,BDGN,22,"B",BDGV)) Q:BDGV="" D
  1. ..I BDGV["5.3",BDGV'=5.3 D
  1. ...S DIE="^DIC(9.4,"_BDGN_",22,",DA(1)=BDGN,DR=".01///@"
  1. ...S DA=$O(^DIC(9.4,BDGN,22,"B",BDGV,0)) Q:'DA
  1. ...D ^DIE
  1. .;
  1. .; now add version multiple without test version #
  1. .S DIC="^DIC(9.4,"_BDGN_",22,",DIC(0)="L",X=5.3
  1. .S DIC("P")=$P(^DD(9.4,22,0),U,2)
  1. .S DIC("DR")="2///"_DT_";3///`"_DUZ,DA(1)=BDGN
  1. .D ^DIC
  1. ;
  1. D PATCHES^BSDPOST2 ;add patch history
  1. Q
  1. ;
  1. AIHSDAM ;EP; -- creates xref AIHSDAM upon installation
  1. ;IHS/ITSC/WAR 8/19/2004 PATCH #1001 Next line REMd to allow a call
  1. ; to this tag (from PATCH 1001 post-init rtn) to make sure every
  1. ; site has run this sub-rtn w/o a problem. See 16^BDGPOST...
  1. ; ^BDGPOST(16) has already been set by another process. Next line
  1. ; was REMd for the above mentioned reason.
  1. ;Q:$D(^BDGX(16)) ;already done
  1. D BMES^XPDUTL("Creating AIHSDAM cross-reference on file 44...")
  1. ;
  1. NEW CLIN,DATE,PAT,MADE
  1. K ^SC("AIHSDAM")
  1. S CLIN=0 F S CLIN=$O(^SC(CLIN)) Q:'CLIN D
  1. . S DATE=2991000 F S DATE=$O(^SC(CLIN,"S",DATE)) Q:'DATE D
  1. .. I '$D(ZTQUEUED) W "."
  1. .. S PAT=0 F S PAT=$O(^SC(CLIN,"S",DATE,1,PAT)) Q:'PAT D
  1. ... S MADE=$P($G(^SC(CLIN,"S",DATE,1,PAT,0)),U,7)
  1. ... I MADE]"" S ^SC("AIHSDAM",CLIN,MADE,DATE,PAT)=""
  1. K X S X=$$REPEAT^XLFSTR(" ",20)_"Done." D MES^XPDUTL(.X)
  1. Q
  1. ;
  1. LETTER ;EP; create Appointment Slip letter
  1. Q:$D(^VA(407.5,"B","APPOINTMENT SLIP")) ;already in file
  1. D BMES^XPDUTL("Creating Appointment Slip Letter...")
  1. ;
  1. NEW IEN,DIC,DLAYGO,DD,DO,X,Y
  1. S DIC="^VA(407.5,",DLAYGO=407.5,DIC(0)="L",X="APPOINTMENT SLIP"
  1. S DIC("DR")="1///P;9999999.01///1"
  1. K DD,DO D FILE^DICN
  1. I Y<1 K X S X=" ***> Could not create letter; will need to be added manually" D MES^XPDUTL(.X) Q
  1. ;
  1. ; now add default text
  1. S IEN=+Y,^VA(407.5,IEN,1,0)="^407.52^1^1"
  1. S ^VA(407.5,IEN,1,1,0)=" Your next appointment in our clinic is as follows:"
  1. S ^VA(407.5,IEN,2,0)="^407.53^1^1"
  1. S ^VA(407.5,IEN,2,1,0)="To reschedule any appointments listed, please call our main appointment desk at XXX-XXXX."
  1. ;
  1. K X S X=$$REPEAT^XLFSTR(" ",20)_"Done." D MES^XPDUTL(.X)
  1. Q
  1. ;
  1. MERG ;EP; Change Scheduling Merge routine in Package file
  1. NEW DIE,DA,DR,PKG,IEN
  1. D BMES^XPDUTL("Updating Merge routine for Scheduling...")
  1. ;
  1. ; find package entry
  1. S PKG=$O(^DIC(9.4,"C","SD",0)) I 'PKG D MRGERR Q
  1. ; find entry under Files Affected
  1. S IEN=$O(^DIC(9.4,PKG,20,0)) I 'IEN D MRGERR Q
  1. ; make sure entry if so file 2 (^DPT)
  1. I $P($G(^DIC(9.4,PKG,20,IEN,0)),U)'=2 D MRGERR Q
  1. ;
  1. ; now update entry
  1. S DIE="^DIC(9.4,"_PKG_",20,",DA(1)=PKG,DA=IEN,DR="3///BSDMERG" D ^DIE
  1. K X S X=$$REPEAT^XLFSTR(" ",20)_"Done." D MES^XPDUTL(.X)
  1. Q
  1. ;
  1. MRGERR ; process error message for package merge update
  1. K X S X=$$SP(10)_"Cannot find SD Package; update manually."
  1. D MES^XPDUTL(.X)
  1. Q
  1. ;
  1. CLINIC ;EP; copy clinic parameters to new locations
  1. ; IHS fields that used to be in file 44 are now in 9009017.2
  1. ;
  1. Q:$D(^BDGX(2)) ;already done
  1. D BMES^XPDUTL("Copying IHS fields for each active clinic to new file...")
  1. NEW CLN,OLD,NODE,X,Y,Z
  1. S CLN=0 F S CLN=$O(^SC(CLN)) Q:'CLN D
  1. . ;
  1. . Q:'$$ACTV^BSDU(CLN,DT) ;quit if not currently active
  1. . ;
  1. . ; stuff "ask check-in/check-out time to YES
  1. . NEW DIE,DA,DR
  1. . S DIE=44,DA=CLN,DR="24///1" D ^DIE
  1. . ;
  1. . ; if entry not in new file, add it
  1. . I '$D(^BSDSC(CLN)) D I Y<1 Q
  1. .. NEW DIC,DLAYGO,X,DINUM,DD,DO
  1. .. S DIC="^BSDSC(",DLAYGO=9009017.2,(X,DINUM)=CLN,DIC(0)="L"
  1. .. D FILE^DICN
  1. . ;
  1. . ; now copy fields
  1. . S OLD=$G(^SC(CLN,9999999)) Q:OLD="" ;quit if no data
  1. . ;
  1. . ; move fields to new file and new piece
  1. . F NODE="2^5","6^3","7^2","9^9","13^8","14^13","15^14" D
  1. .. S $P(^BSDSC(CLN,0),U,$P(NODE,U,2))=$P(OLD,U,+NODE)
  1. . ;
  1. . ; 2 fields need set of codes converted Y/N to 1/0
  1. . I $P(OLD,U)]"" S $P(^BSDSC(CLN,0),U,4)=$S($P(OLD,U)="Y":1,1:0)
  1. . I $P(OLD,U,4)]"" S $P(^BSDSC(CLN,0),U,7)=$S($P(OLD,U,4)="Y":1,1:0)
  1. . ;
  1. . ; merge med profile & apro into one new field
  1. . ;IHS/ITSC/WAR 2/3/04 need to init Z each time for "",0 and "N"
  1. . S Z=0
  1. . S X=$P(OLD,U,3),Y=$P($G(^SC(CLN,"PS")),U)
  1. . ;
  1. . ;IHS/ITSC/LJF 4/21/2004 old field had 0=yes; 1=no
  1. . ;I (X="Y"),(Y=1) S Z=3 ;both
  1. . ;I (X="Y"),(Y'=1) S Z=1 ;med profile only
  1. . ;I (X'="Y"),(Y=1) S Z=2 ;action profile only
  1. . I (X="Y"),(Y=0) S Z=3 ;both
  1. . I (X="Y"),(Y'=0) S Z=1 ;med profile only
  1. . I (X'="Y"),(Y=0) S Z=2 ;action profile only
  1. . ;
  1. . S $P(^BSDSC(CLN,0),U,6)=$S($G(Z):Z,1:0)
  1. . ;
  1. . ; move default visit provider to provider multiple
  1. . S X=$P(OLD,U,8) I X,'$D(^SC(CLN,"PR","B",X)) D
  1. .. NEW DIC,DLAYGO,DA
  1. .. S DIC="^SC("_CLN_",""PR"",",DIC(0)="L",X="`"_X,DA(1)=CLN
  1. .. S DIC("DR")=".02///1",DIC("P")="44.1P" D ^DIC
  1. . ;
  1. . ; copy overbook users
  1. . S OVB=0 F S OVB=$O(^SC(CLN,"IHS OB",OVB)) Q:'OVB D
  1. .. S NODE=$G(^SC(CLN,"IHS OB",OVB,0)) Q:NODE=""
  1. .. Q:$D(^BSDSC(CLN,1,"B",+NODE)) ;already there
  1. .. NEW DIC,DLAYGO,X,DA
  1. .. S DIC="^BSDSC("_CLN_",1,",DIC("P")="9009017.21P",DA(1)=CLN
  1. .. S DIC(0)="L",X="`"_(+NODE),DIC("DR")=".02///"_$P(NODE,U,2)
  1. .. D ^DIC
  1. ;
  1. ; reindex new file
  1. K X S X=" Reindexing new Cllinic Setup file..." D MES^XPDUTL(.X)
  1. NEW DIK S DIK="^BSDSC(" D IXALL^DIK
  1. K X S X=$$REPEAT^XLFSTR(" ",20)_"Done." D MES^XPDUTL(.X)
  1. Q
  1. ;
  1. EVENT ;EP; build event driver menu based on protocols installed
  1. ; If you have the following installed, I will add them to event driver
  1. ; Called by EVENT^BSDPOST2 after ADT event driver updated
  1. ;
  1. D BMES^XPDUTL("Building Scheduling Event Driver...")
  1. NEW IEN,ITEM,BSDE
  1. S BSDE=$O(^ORD(101,"B","BSDAM APPOINTMENT EVENTS",0)) Q:'BSDE
  1. ;
  1. ; loop thru list of known protocols
  1. F BSDI=1:1:2 S ITEM=$P($T(PROT+BSDI),";;",2) D
  1. . I $D(^ORD(101,"B",ITEM)) D ;if protocol exists
  1. .. S IEN=$O(^ORD(101,"B",ITEM,0)) Q:'IEN
  1. .. Q:$D(^ORD(101,BSDE,10,"B",IEN)) ;already added to event driver
  1. .. ;
  1. .. ; go ahead and add it
  1. .. S DIC="^ORD(101,"_BSDE_",10,",DIC(0)="L",DLAYGO=101.01
  1. .. S DA(1)=BSDE,DIC("P")="101.01PA",X=IEN
  1. .. S DIC("DR")="3///"_$P($T(PROT+BSDI),";;",3)
  1. .. K DD,DO D FILE^DICN
  1. K X S X=$$REPEAT^XLFSTR(" ",20)_"Done." D MES^XPDUTL(.X)
  1. Q
  1. ;
  1. PAD(D,L) ;EP -- SUBRTN to pad length of data
  1. ; -- D=data L=length
  1. Q $E(D_$$REPEAT^XLFSTR(" ",L),1,L)
  1. ;
  1. SP(N) ; -- SUBRTN to pad N number of spaces
  1. Q $$PAD(" ",N)
  1. ;
  1. PROT ;; Protocols to add to event driver
  1. ;;BHL PYXIS SCHEDULING;;12;;
  1. ;;VEN PRINT PCC+ ENCOUNTER FORM;;15;;
  1. ;;BTS SCHEDULE A PATIENT (3M HDM);;51;;
  1. ;;APCH CHECK-IN PRINT PAT HS;;31;;
  1. ;;BSDX ADD APPOINTMENT;;10.2;;
  1. ;;BSDX CANCEL APPOINTMENT;;10.4;;
  1. ;;BSDX CHECKIN APPOINTMENT;;10.6;;
  1. ;;BSDX NOSHOW APPOINTMENT;;10.8;;
  1. ;;BSDAM RS AT CHECKIN;;13;;