- PSSDSFDB ;WOIFO/Steve Gordon - Allows for a user to disable FDB interface during an FDB update ;03/17/09
- ;;1.0;PHARMACY DATA MANAGEMENT;**136**;9/30/97;Build 89
- ;
- ;
- EN ;driver
- ; Called from PSS ENABLE/DISABLE DB LINK option
- ;
- I '$G(DUZ) D DUZMSG Q ;if no DUZ, cannot continue
- N OLDVAL
- ;get original value, if one exists
- S OLDVAL=+$G(^PS(59.73,1,0))
- Q:'$$LOCK() ;lock file
- D
- .;if no entry create new one
- .I '$D(^PS(59.73,1,0)) D NEW
- .Q:'$$QSTION(OLDVAL)
- .D CHANGE('OLDVAL)
- .;if the connection is turned on, check for link
- .I OLDVAL'=0,+$G(^PS(59.73,1,0))=0 D Q
- ..N BASE
- ..S BASE="PSPRE"
- ..D PING^PSSHRIT(BASE)
- ..I $G(^TMP($J,BASE,"OUT",0))=0 W !!,"Connected to Vendor database successfully."
- ..E W !!,"Connection could not be made to Vendor database."
- ..K ^TMP($J,BASE)
- ;
- D PRSRTN
- D UNLOCK
- Q
- ;
- DUZMSG ;
- ;
- ;Writes a message that a DUZ is required
- W !,"You are not logged into the system."
- W !,"This option requires a DUZ (user ID) to be defined!"
- D PRSRTN
- Q
- ;
- QSTION(OLDVAL) ;
- ;input: OLDVAL-original value of the .01 field of 59.73
- ;output-response to verification question (1 for yes, 0 for no)
- N NEWSTAT,FINAL,CURSTAT,ENFLAG
- K DIR,Y
- S FINAL=0 ;DEFAULT AS NO
- S NEWSTAT=$S(OLDVAL:"ENABLE",1:"DISABLE")
- S CURSTAT=$S(OLDVAL:"DISABLE",1:"ENABLE")
- S ENFLAG=$S(CURSTAT="ENABLE":1,1:0)
- D HELP(.DIR)
- D
- .I 'OLDVAL D DISMSG(.DIR) Q
- .D ENMSG(.DIR)
- S DIR(0)="Y^A"
- S DIR("B")=$S(ENFLAG:"NO",1:"YES")
- D ^DIR
- D
- .I $G(Y),ENFLAG S FINAL=$$ASK(NEWSTAT) Q
- .I 'ENFLAG S FINAL=+Y
- D
- .I ENFLAG D Q
- ..I $G(FINAL) D
- ...W !!,?5,"Vendor database connection "_NEWSTAT_"D"_"."
- ...I NEWSTAT="DISABLE" D
- ....W !!,"REMEMBER to ENABLE the Vendor database connection AFTER task completed."
- ..I '$G(FINAL) W !!,?5,"The connection to the Vendor database remains ENABLED."
- .I 'ENFLAG D Q
- ..;I FINAL W !!,"Vendor database connection reestablished." Q
- ..I FINAL W !!,"Vendor database connection enabled." Q
- ..I 'FINAL D
- ...W !!," WARNING! The connection to the Vendor Database remains DISABLED"
- ...I $T(DS^PSSDSAPI)]"",$$DS^PSSDSAPI() W !!,"NO Drug-Drug Interactions, Duplicate Therapy or Dosing Order Checks will be"
- ...E W !!,"NO Drug-Drug Interactions or Duplicate Therapy Checks will be"
- ...W !,"performed while the connection is disabled!!!"
- Q FINAL
- ;
- ASK(NEWSTAT) ;
- ;
- ;input: NEWSTAT-Either ENABLE or DISABLE
- ;output: Either 1 or 0 for yes or no
- K DIR,Y
- S DIR(0)="Y^A"
- S DIR("B")="NO"
- I $T(DS^PSSDSAPI)]"",$$DS^PSSDSAPI() S DIR("A",1)="NO Drug-Drug Interactions, Duplicate Therapy or Dosing Order Checks"
- E S DIR("A",1)="NO Drug-Drug Interactions or Duplicate Therapy Order Checks"
- S DIR("A",2)="will be performed while the connection is disabled!!!"
- S DIR("A",3)=" "
- S DIR("A")="Are you sure you want to "_NEWSTAT_" the connection to the Vendor Database"
- D ^DIR
- Q Y
- ;
- DISMSG(DIR) ;
- ;input: DIR Array
- ;output: sets up DIR message array
- S DIR("A",1)="The connection to the Vendor database is currently ENABLED."
- S DIR("A",2)=" "
- ;S DIR("A",3)="NO Drug-Drug Interactions, Duplicate Therapy or Dosing Order Checks"
- ;S DIR("A",4)="will be performed while the connection is disabled!!"
- S DIR("A",3)=""
- S DIR("A")="Do you wish to DISABLE the connection to the Vendor database"
- ;
- ENMSG(DIR) ;
- ;;input: DIR Array
- ;output: sets up DIR message array
- S DIR("A",1)=" WARNING! The connection to the Vendor database is currently DISABLED."
- S DIR("A",2)=" "
- I $T(DS^PSSDSAPI)]"",$$DS^PSSDSAPI() S DIR("A",3)="NO Drug-Drug Interactions, Duplicate Therapy or Dosing Order Checks"
- E S DIR("A",3)="NO Drug-Drug Interactions or Duplicate Therapy Order Checks"
- S DIR("A",4)="will be performed while the connection is disabled!!!"
- S DIR("A",5)=" "
- S DIR("A")="Do you wish to ENABLE the Vendor database connection"
- ;
- NEW ;
- ;There will only be one entry at the top level
- N DINUM,DIC,DO,X
- K D0
- S DINUM=1,X=0,DIC="^PS(59.73,",DIC(0)="Z" D FILE^DICN
- Q
- ;
- CHANGE(NEWVAL) ;
- ;edit flag once it is created.
- N DIE,DR,DA
- S DA=1
- S DIE="^PS(59.73,",DR=".01///^S X=NEWVAL"
- D ^DIE
- D ACT(NEWVAL)
- Q
- ACT(NEWVAL) ;
- ;creates an activity log whenever FDB flag is reset to a new value
- ;
- N DIC,DA,X,ACTION,DIE,DO,DR
- S DIC="^PS(59.73,1,1,",DIC(0)="L",DA(1)=1
- S X=$$GETNOW()
- D FILE^DICN
- S ACTION=$S(NEWVAL:"D",1:"E")
- S DIE="^PS(59.73,1,1,",DA=+Y,DR="1///^S X=+DUZ;2///^S X=ACTION"
- D ^DIE
- Q
- ;
- GETNOW() ;
- N PSNOW
- D NOW^%DTC
- S PSNOW=% K %
- Q PSNOW
- ;
- LOCK() ;
- ;locks 59.73 file
- N LOCKED
- S LOCKED=1 ;SUCCESSFUL
- D
- .L +^PS(59.73,0):0
- .Q:$T
- .W !,"Another terminal is modifying this field!"
- .S LOCKED=0
- Q LOCKED
- UNLOCK ;
- L -^PS(59.73,0)
- Q
- ;
- HELP(DIR) ;
- ;Returns array of help for DIR call
- I $T(DS^PSSDSAPI)]"",$$DS^PSSDSAPI() S DIR("?")="Enter either 'Y' or 'N'. No Drug-Drug Interactions, Duplicate Therapy or Dosing Order Checks will be performed while the connection is disabled!!!"
- E S DIR("?")="Enter either 'Y' or 'N'. No Drug-Drug Interactions or Duplicate Therapy Order Checks will be performed while the connection is disabled!!!"
- Q
- CHKSTAT() ;
- ; Called from IN^PSSHRQ2 routine
- ;RETURNS A -1 if FDB is disabled and 0 if enabled
- ;along with a standard message in PSSHRVL1
- N STAT
- S STAT=+$G(^PS(59.73,1,0))*-1 ;Returns either -1 or 0
- I STAT S STAT=STAT_U_$$STATMSG^PSSHRVL1()
- Q STAT
- ;
- PRSRTN ;
- ;calls std routine to ask user to hit return
- K DIR S DIR(0)="E" S DIR("A")="Press Return to Continue" D ^DIR
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSSDSFDB 5579 printed Apr 23, 2025@18:45:21 Page 2
- PSSDSFDB ;WOIFO/Steve Gordon - Allows for a user to disable FDB interface during an FDB update ;03/17/09
- +1 ;;1.0;PHARMACY DATA MANAGEMENT;**136**;9/30/97;Build 89
- +2 ;
- +3 ;
- EN ;driver
- +1 ; Called from PSS ENABLE/DISABLE DB LINK option
- +2 ;
- +3 ;if no DUZ, cannot continue
- IF '$GET(DUZ)
- DO DUZMSG
- QUIT
- +4 NEW OLDVAL
- +5 ;get original value, if one exists
- +6 SET OLDVAL=+$GET(^PS(59.73,1,0))
- +7 ;lock file
- if '$$LOCK()
- QUIT
- +8 Begin DoDot:1
- +9 ;if no entry create new one
- +10 IF '$DATA(^PS(59.73,1,0))
- DO NEW
- +11 if '$$QSTION(OLDVAL)
- QUIT
- +12 DO CHANGE('OLDVAL)
- +13 ;if the connection is turned on, check for link
- +14 IF OLDVAL'=0
- IF +$GET(^PS(59.73,1,0))=0
- Begin DoDot:2
- +15 NEW BASE
- +16 SET BASE="PSPRE"
- +17 DO PING^PSSHRIT(BASE)
- +18 IF $GET(^TMP($JOB,BASE,"OUT",0))=0
- WRITE !!,"Connected to Vendor database successfully."
- +19 IF '$TEST
- WRITE !!,"Connection could not be made to Vendor database."
- +20 KILL ^TMP($JOB,BASE)
- End DoDot:2
- QUIT
- End DoDot:1
- +21 ;
- +22 DO PRSRTN
- +23 DO UNLOCK
- +24 QUIT
- +25 ;
- DUZMSG ;
- +1 ;
- +2 ;Writes a message that a DUZ is required
- +3 WRITE !,"You are not logged into the system."
- +4 WRITE !,"This option requires a DUZ (user ID) to be defined!"
- +5 DO PRSRTN
- +6 QUIT
- +7 ;
- QSTION(OLDVAL) ;
- +1 ;input: OLDVAL-original value of the .01 field of 59.73
- +2 ;output-response to verification question (1 for yes, 0 for no)
- +3 NEW NEWSTAT,FINAL,CURSTAT,ENFLAG
- +4 KILL DIR,Y
- +5 ;DEFAULT AS NO
- SET FINAL=0
- +6 SET NEWSTAT=$SELECT(OLDVAL:"ENABLE",1:"DISABLE")
- +7 SET CURSTAT=$SELECT(OLDVAL:"DISABLE",1:"ENABLE")
- +8 SET ENFLAG=$SELECT(CURSTAT="ENABLE":1,1:0)
- +9 DO HELP(.DIR)
- +10 Begin DoDot:1
- +11 IF 'OLDVAL
- DO DISMSG(.DIR)
- QUIT
- +12 DO ENMSG(.DIR)
- End DoDot:1
- +13 SET DIR(0)="Y^A"
- +14 SET DIR("B")=$SELECT(ENFLAG:"NO",1:"YES")
- +15 DO ^DIR
- +16 Begin DoDot:1
- +17 IF $GET(Y)
- IF ENFLAG
- SET FINAL=$$ASK(NEWSTAT)
- QUIT
- +18 IF 'ENFLAG
- SET FINAL=+Y
- End DoDot:1
- +19 Begin DoDot:1
- +20 IF ENFLAG
- Begin DoDot:2
- +21 IF $GET(FINAL)
- Begin DoDot:3
- +22 WRITE !!,?5,"Vendor database connection "_NEWSTAT_"D"_"."
- +23 IF NEWSTAT="DISABLE"
- Begin DoDot:4
- +24 WRITE !!,"REMEMBER to ENABLE the Vendor database connection AFTER task completed."
- End DoDot:4
- End DoDot:3
- +25 IF '$GET(FINAL)
- WRITE !!,?5,"The connection to the Vendor database remains ENABLED."
- End DoDot:2
- QUIT
- +26 IF 'ENFLAG
- Begin DoDot:2
- +27 ;I FINAL W !!,"Vendor database connection reestablished." Q
- +28 IF FINAL
- WRITE !!,"Vendor database connection enabled."
- QUIT
- +29 IF 'FINAL
- Begin DoDot:3
- +30 WRITE !!," WARNING! The connection to the Vendor Database remains DISABLED"
- +31 IF $TEXT(DS^PSSDSAPI)]""
- IF $$DS^PSSDSAPI()
- WRITE !!,"NO Drug-Drug Interactions, Duplicate Therapy or Dosing Order Checks will be"
- +32 IF '$TEST
- WRITE !!,"NO Drug-Drug Interactions or Duplicate Therapy Checks will be"
- +33 WRITE !,"performed while the connection is disabled!!!"
- End DoDot:3
- End DoDot:2
- QUIT
- End DoDot:1
- +34 QUIT FINAL
- +35 ;
- ASK(NEWSTAT) ;
- +1 ;
- +2 ;input: NEWSTAT-Either ENABLE or DISABLE
- +3 ;output: Either 1 or 0 for yes or no
- +4 KILL DIR,Y
- +5 SET DIR(0)="Y^A"
- +6 SET DIR("B")="NO"
- +7 IF $TEXT(DS^PSSDSAPI)]""
- IF $$DS^PSSDSAPI()
- SET DIR("A",1)="NO Drug-Drug Interactions, Duplicate Therapy or Dosing Order Checks"
- +8 IF '$TEST
- SET DIR("A",1)="NO Drug-Drug Interactions or Duplicate Therapy Order Checks"
- +9 SET DIR("A",2)="will be performed while the connection is disabled!!!"
- +10 SET DIR("A",3)=" "
- +11 SET DIR("A")="Are you sure you want to "_NEWSTAT_" the connection to the Vendor Database"
- +12 DO ^DIR
- +13 QUIT Y
- +14 ;
- DISMSG(DIR) ;
- +1 ;input: DIR Array
- +2 ;output: sets up DIR message array
- +3 SET DIR("A",1)="The connection to the Vendor database is currently ENABLED."
- +4 SET DIR("A",2)=" "
- +5 ;S DIR("A",3)="NO Drug-Drug Interactions, Duplicate Therapy or Dosing Order Checks"
- +6 ;S DIR("A",4)="will be performed while the connection is disabled!!"
- +7 SET DIR("A",3)=""
- +8 SET DIR("A")="Do you wish to DISABLE the connection to the Vendor database"
- +9 ;
- ENMSG(DIR) ;
- +1 ;;input: DIR Array
- +2 ;output: sets up DIR message array
- +3 SET DIR("A",1)=" WARNING! The connection to the Vendor database is currently DISABLED."
- +4 SET DIR("A",2)=" "
- +5 IF $TEXT(DS^PSSDSAPI)]""
- IF $$DS^PSSDSAPI()
- SET DIR("A",3)="NO Drug-Drug Interactions, Duplicate Therapy or Dosing Order Checks"
- +6 IF '$TEST
- SET DIR("A",3)="NO Drug-Drug Interactions or Duplicate Therapy Order Checks"
- +7 SET DIR("A",4)="will be performed while the connection is disabled!!!"
- +8 SET DIR("A",5)=" "
- +9 SET DIR("A")="Do you wish to ENABLE the Vendor database connection"
- +10 ;
- NEW ;
- +1 ;There will only be one entry at the top level
- +2 NEW DINUM,DIC,DO,X
- +3 KILL D0
- +4 SET DINUM=1
- SET X=0
- SET DIC="^PS(59.73,"
- SET DIC(0)="Z"
- DO FILE^DICN
- +5 QUIT
- +6 ;
- CHANGE(NEWVAL) ;
- +1 ;edit flag once it is created.
- +2 NEW DIE,DR,DA
- +3 SET DA=1
- +4 SET DIE="^PS(59.73,"
- SET DR=".01///^S X=NEWVAL"
- +5 DO ^DIE
- +6 DO ACT(NEWVAL)
- +7 QUIT
- ACT(NEWVAL) ;
- +1 ;creates an activity log whenever FDB flag is reset to a new value
- +2 ;
- +3 NEW DIC,DA,X,ACTION,DIE,DO,DR
- +4 SET DIC="^PS(59.73,1,1,"
- SET DIC(0)="L"
- SET DA(1)=1
- +5 SET X=$$GETNOW()
- +6 DO FILE^DICN
- +7 SET ACTION=$SELECT(NEWVAL:"D",1:"E")
- +8 SET DIE="^PS(59.73,1,1,"
- SET DA=+Y
- SET DR="1///^S X=+DUZ;2///^S X=ACTION"
- +9 DO ^DIE
- +10 QUIT
- +11 ;
- GETNOW() ;
- +1 NEW PSNOW
- +2 DO NOW^%DTC
- +3 SET PSNOW=%
- KILL %
- +4 QUIT PSNOW
- +5 ;
- LOCK() ;
- +1 ;locks 59.73 file
- +2 NEW LOCKED
- +3 ;SUCCESSFUL
- SET LOCKED=1
- +4 Begin DoDot:1
- +5 LOCK +^PS(59.73,0):0
- +6 if $TEST
- QUIT
- +7 WRITE !,"Another terminal is modifying this field!"
- +8 SET LOCKED=0
- End DoDot:1
- +9 QUIT LOCKED
- UNLOCK ;
- +1 LOCK -^PS(59.73,0)
- +2 QUIT
- +3 ;
- HELP(DIR) ;
- +1 ;Returns array of help for DIR call
- +2 IF $TEXT(DS^PSSDSAPI)]""
- IF $$DS^PSSDSAPI()
- SET DIR("?")="Enter either 'Y' or 'N'. No Drug-Drug Interactions, Duplicate Therapy or Dosing Order Checks will be performed while the connection is disabled!!!"
- +3 IF '$TEST
- SET DIR("?")="Enter either 'Y' or 'N'. No Drug-Drug Interactions or Duplicate Therapy Order Checks will be performed while the connection is disabled!!!"
- +4 QUIT
- CHKSTAT() ;
- +1 ; Called from IN^PSSHRQ2 routine
- +2 ;RETURNS A -1 if FDB is disabled and 0 if enabled
- +3 ;along with a standard message in PSSHRVL1
- +4 NEW STAT
- +5 ;Returns either -1 or 0
- SET STAT=+$GET(^PS(59.73,1,0))*-1
- +6 IF STAT
- SET STAT=STAT_U_$$STATMSG^PSSHRVL1()
- +7 QUIT STAT
- +8 ;
- PRSRTN ;
- +1 ;calls std routine to ask user to hit return
- +2 KILL DIR
- SET DIR(0)="E"
- SET DIR("A")="Press Return to Continue"
- DO ^DIR
- +3 QUIT