GMTSPOST ;SLC/JER - Post-init for Health Summary ;10/4/19 9:39am
;;2.7;Health Summary;**129**;Oct 20, 1995;Build 8
MAIN ; Controls branching and execution
N GMI,INCLUDE,GMTSEG,GMTSI,GMTSIFN,GMTJ,GMTSNM
W !!,"Starting post-init action now...."
D SPOOL,PARAM
;GMTS*2.7*129 remove call to SOWK^GMTSPOS1
D INPHAR,DIET,OERR,VITALS,LAB,RAD,MHPE,PRGNOTE,SURG,DCS,CP,PL^GMTSPOS1,PCE,MED^GMTSPOS1,PSO^GMTSPOS1,OUTPHAR
D EN^GMTSPOS2
K ^GMT(142,12,1,"C") ;Get rid of "C" xref in case there are duplicate entries
W !!,"'C' cross-reference on the GMTS AD HOC OPTION type in file 142 deleted."
W !,"It will be rebuilt"
S INCLUDE=0 D ENPOST^GMTSLOAD
D ^GMTSONIT
W !!,"Post-init successfully completed."
D FINITO
K GMTSIST
Q
SPOOL ; Convert spool name to pointer value
N DIC,DIE,DA,X
S X=$P($G(^GMT(142.99,1,0)),U,4)
Q:+X!(X']"") ;Quit is Spool Device is null or a numeric value
S DIC=3.5,DIC(0)="X"
D ^DIC
W !!,"Converting "_X_" to a pointer value for Spool Device in Site Parameter file."
I +Y'>0 D Q
. W !,"** Can't converted "_X_" to a pointer value. **"
. W !,"Enter a Valid Spool Device using 'Edit Health Summary Site Parameters' option."
S $P(^GMT(142.99,1,0),U,4)=+Y
W !,X," converted successfully."
Q
PARAM ; Convert YES/NO codes from 1/0 to Y/N
N GMNUM,X
F GMNUM=2,3,5 D
. S X=$P($G(^GMT(142.99,1,0)),U,GMNUM)
. Q:X']""!(X="Y")!(X="N") ;Quit there is not entry or it is "Y" or "N"
. I X=0 S $P(^GMT(142.99,1,0),U,GMNUM)=""
. I X=1 S $P(^GMT(142.99,1,0),U,GMNUM)="Y"
Q
INPHAR ; Checks conditions auto-disable of Inpatient Pharmacy components
N GMMSG,X
S X="PSJEEU0"
X ^%ZOSF("TEST")
Q:$T
F X="PHARMACY INTRAVENOUS","PHARMACY UNIT DOSE" S GMMSG="Inpatient Medications not yet available" D DISABLE
Q
OUTPHAR ; Checks conditions auto-disable of Outpatient Pharmacy components
N GMMSG,X
S X="PSOHCSUM"
X ^%ZOSF("TEST")
Q:$T
F X="PHARMACY OUTPATIENT" S GMMSG="Outpatient Pharmacy not yet available" D DISABLE
Q
DIET ; Checks conditions auto-disable of Dietetics
N GMMSG,X
S X="FHWHEA"
X ^%ZOSF("TEST")
Q:$T
F X="DIETETICS" S GMMSG="Dietetics not yet available" D DISABLE
Q
OERR ; Checks conditions auto-disable of OERR Orders
N GMMSG,X
S X="ORF4"
X ^%ZOSF("TEST")
Q:$T
F X="ORDERS CURRENT" S GMMSG="OE/RR Orders not yet available" D DISABLE
Q
VITALS ; Checks conditions auto-disable of Vitals
N GMMSG,X
S X="GMRVUT0"
X ^%ZOSF("TEST")
Q:$T
F X="VITAL SIGNS","VITAL SIGNS SELECTED" S GMMSG="Vital Signs not yet available" D DISABLE
Q
PRGNOTE ; Checks conditions auto-disable of Progress Note components
N GMMSG,X
I ($D(^YSP(606))<10),($D(^GMR(121))<10) F X="PROGRESS NOTES","PROGRESS NOTES BRIEF" S GMMSG="Progress Notes not yet available" D DISABLE
I $D(^GMR(121))<10 F X="ADVANCE DIRECTIVE","CLINICAL WARNINGS","CRISIS NOTES" S GMMSG=X_" not yet available" D DISABLE
Q
SURG ; Checks conditions for auto-disable of Surgery component
N X,GMMSG
I $D(^SRF)<10 F X="SURGERY REPORTS","SURGERY REPORTS BRIEF" S GMMSG="Surgery Package not yet installed" D DISABLE
Q
DCS ; Checks conditions for auto-disable of Discharge Summary components
N X,GMMSG
I $D(^GMR(128))<10 D
. S GMMSG="Discharge Summary Package not yet installed or available"
. F X="DISCHARGE SUMMARY","DISCHARGE SUMMARY BRIEF" D DISABLE
Q
CP ; Checks conditions for auto-disable of Compensation and Pension component
N X,GMMSG
; Checks conditions for auto-disable of Comp & Pen component
I +$$VERSION^XPDUTL("DVBA")<2.7 D
. S GMMSG="Requires AMIE version 2.7"
. S X="COMPENSATION AND PENSION EXAMS" D DISABLE^GMTSPOST
Q
LAB ; Checks condition for auto-disable of Lab components
N GMMSG,X
I $$VERSION^XPDUTL("LR")<5.1 D
. S GMMSG="Requires Lab version 5.1 or later"
. F X="LAB BLOOD AVAILABILITY","LAB BLOOD TRANSFUSIONS","LAB CHEMISTRY & HEMATOLOGY","LAB CUMULATIVE SELECTED","LAB CUMULATIVE SELECTED 1" D DISABLE^GMTSPOST
. F X="LAB CUMULATIVE SELECTED 2","LAB CUMULATIVE SELECTED 3","LAB CUMULATIVE SELECTED 4","LAB CYTOPATHOLOGY","LAB ELECTRON MICROSCOPY","LAB MICROBIOLOGY" D DISABLE^GMTSPOST
. F X="LAB MICROBIOLOGY BRIEF","LAB ORDERS","LAB ORDERS BRIEF","LAB SURGICAL PATHOLOGY","LAB TESTS SELECTED" D DISABLE^GMTSPOST
Q
RAD ; Checks condition for auto-disable of Radiology
N GMMSG,X
I $$VERSION^XPDUTL("RA")<3 D
. S GMMSG="Requires Radiology version 3 or later"
. F X="RADIOLOGY IMPRESSION","RADIOLOGY IMPRESSION SELECTED","RADIOLOGY PROFILE","RADIOLOGY STATUS" D DISABLE^GMTSPOST
Q
MHPE ; Checks condition for auto-disable of Mental Health
N GMMSG,X
I $$VERSION^XPDUTL("YS")<5 D
. S GMMSG="Requires Mental Health version 5 or later"
. F X="MENTAL HEALTH PHYSICAL EXAM" D DISABLE^GMTSPOST
Q
PCE ; Checks for existence of PCE package...Disables components if absents
N GMMSG,X
I $$VERSION^XPDUTL("PX")'>0 D ;Disable PCE components if PCE not installed nor available
. S GMMSG="Patient Care Encounter Package not yet installed"
. F X="PCE LOCATION OF HOME","PCE CLINICAL REMINDERS","PCE HEALTH FACTORS SELECTED","PCE HEALTH FACTORS ALL","PCE OUTPATIENT ENCOUNTERS","PCE MEASUREMENTS NON-TABULAR","PCE IMMUNIZATIONS","PCE SKIN TESTS" D DISABLE^GMTSPOST
. F X="PCE MEASUREMENTS SELECTED","PCE EDUCATION","PCE EDUCATION LATEST","PCE OUTPATIENT DIAGNOSIS","PCE EXAMS LATEST","PCE TREATMENTS PROVIDED" D DISABLE^GMTSPOST
. F X="PCE CLINICAL MAINTENANCE" D DISABLE^GMTSPOST
Q
DISABLE ; Disable components if auto-disable conditions are met
N DA,DIC,DIE,DR,Y
S DIC="^GMT(142.1,",DIC(0)="X" D ^DIC
I +Y>0 D
. W !,X," Health Summary Component disabled"
. S DA=+Y,DR="5///"_"P"_";8///"_GMMSG,DIE=DIC D ^DIE
Q
FINITO ; Finish initialization, inform user
N GMTSIFT,GMTSITD,X
S GMTSIFT=$$NOW^GMTSPREI,GMTSITD=$$DIFF(GMTSIFT,+$G(GMTSIST))
W !!,"HEALTH SUMMARY VERSION 2.7 INITIALIZATION COMPLETE!"
Q:'$L($T(FMDIFF^XLFDT))
S X=$G(GMTSIST) D REGDTM^GMTSU
W !!?9,"Initialization began at: ",X
S X=GMTSIFT D REGDTM^GMTSU
W !!?5,"Initialization completed at: ",X
W !!?7,"TOTAL Initialization Time: ",GMTSITD
Q
DIFF(END,BEGIN) ; Converts time difference to external format
N DIFF,HR,MIN,SEC,Y
S DIFF=$$FMDIFF^XLFDT(END,BEGIN,2),HR=DIFF\3600
S MIN=DIFF\60,SEC=DIFF#60
S HR=$E("00",0,2-$L(HR))_HR,MIN=$E("00",0,2-$L(MIN))_MIN,SEC=$E("00",0,2-$L(SEC))_SEC
S Y=HR_":"_MIN_":"_SEC
Q Y
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSPOST 6394 printed Dec 13, 2024@01:59:27 Page 2
GMTSPOST ;SLC/JER - Post-init for Health Summary ;10/4/19 9:39am
+1 ;;2.7;Health Summary;**129**;Oct 20, 1995;Build 8
MAIN ; Controls branching and execution
+1 NEW GMI,INCLUDE,GMTSEG,GMTSI,GMTSIFN,GMTJ,GMTSNM
+2 WRITE !!,"Starting post-init action now...."
+3 DO SPOOL
DO PARAM
+4 ;GMTS*2.7*129 remove call to SOWK^GMTSPOS1
+5 DO INPHAR
DO DIET
DO OERR
DO VITALS
DO LAB
DO RAD
DO MHPE
DO PRGNOTE
DO SURG
DO DCS
DO CP
DO PL^GMTSPOS1
DO PCE
DO MED^GMTSPOS1
DO PSO^GMTSPOS1
DO OUTPHAR
+6 DO EN^GMTSPOS2
+7 ;Get rid of "C" xref in case there are duplicate entries
KILL ^GMT(142,12,1,"C")
+8 WRITE !!,"'C' cross-reference on the GMTS AD HOC OPTION type in file 142 deleted."
+9 WRITE !,"It will be rebuilt"
+10 SET INCLUDE=0
DO ENPOST^GMTSLOAD
+11 DO ^GMTSONIT
+12 WRITE !!,"Post-init successfully completed."
+13 DO FINITO
+14 KILL GMTSIST
+15 QUIT
SPOOL ; Convert spool name to pointer value
+1 NEW DIC,DIE,DA,X
+2 SET X=$PIECE($GET(^GMT(142.99,1,0)),U,4)
+3 ;Quit is Spool Device is null or a numeric value
if +X!(X']"")
QUIT
+4 SET DIC=3.5
SET DIC(0)="X"
+5 DO ^DIC
+6 WRITE !!,"Converting "_X_" to a pointer value for Spool Device in Site Parameter file."
+7 IF +Y'>0
Begin DoDot:1
+8 WRITE !,"** Can't converted "_X_" to a pointer value. **"
+9 WRITE !,"Enter a Valid Spool Device using 'Edit Health Summary Site Parameters' option."
End DoDot:1
QUIT
+10 SET $PIECE(^GMT(142.99,1,0),U,4)=+Y
+11 WRITE !,X," converted successfully."
+12 QUIT
PARAM ; Convert YES/NO codes from 1/0 to Y/N
+1 NEW GMNUM,X
+2 FOR GMNUM=2,3,5
Begin DoDot:1
+3 SET X=$PIECE($GET(^GMT(142.99,1,0)),U,GMNUM)
+4 ;Quit there is not entry or it is "Y" or "N"
if X']""!(X="Y")!(X="N")
QUIT
+5 IF X=0
SET $PIECE(^GMT(142.99,1,0),U,GMNUM)=""
+6 IF X=1
SET $PIECE(^GMT(142.99,1,0),U,GMNUM)="Y"
End DoDot:1
+7 QUIT
INPHAR ; Checks conditions auto-disable of Inpatient Pharmacy components
+1 NEW GMMSG,X
+2 SET X="PSJEEU0"
+3 XECUTE ^%ZOSF("TEST")
+4 if $TEST
QUIT
+5 FOR X="PHARMACY INTRAVENOUS","PHARMACY UNIT DOSE"
SET GMMSG="Inpatient Medications not yet available"
DO DISABLE
+6 QUIT
OUTPHAR ; Checks conditions auto-disable of Outpatient Pharmacy components
+1 NEW GMMSG,X
+2 SET X="PSOHCSUM"
+3 XECUTE ^%ZOSF("TEST")
+4 if $TEST
QUIT
+5 FOR X="PHARMACY OUTPATIENT"
SET GMMSG="Outpatient Pharmacy not yet available"
DO DISABLE
+6 QUIT
DIET ; Checks conditions auto-disable of Dietetics
+1 NEW GMMSG,X
+2 SET X="FHWHEA"
+3 XECUTE ^%ZOSF("TEST")
+4 if $TEST
QUIT
+5 FOR X="DIETETICS"
SET GMMSG="Dietetics not yet available"
DO DISABLE
+6 QUIT
OERR ; Checks conditions auto-disable of OERR Orders
+1 NEW GMMSG,X
+2 SET X="ORF4"
+3 XECUTE ^%ZOSF("TEST")
+4 if $TEST
QUIT
+5 FOR X="ORDERS CURRENT"
SET GMMSG="OE/RR Orders not yet available"
DO DISABLE
+6 QUIT
VITALS ; Checks conditions auto-disable of Vitals
+1 NEW GMMSG,X
+2 SET X="GMRVUT0"
+3 XECUTE ^%ZOSF("TEST")
+4 if $TEST
QUIT
+5 FOR X="VITAL SIGNS","VITAL SIGNS SELECTED"
SET GMMSG="Vital Signs not yet available"
DO DISABLE
+6 QUIT
PRGNOTE ; Checks conditions auto-disable of Progress Note components
+1 NEW GMMSG,X
+2 IF ($DATA(^YSP(606))<10)
IF ($DATA(^GMR(121))<10)
FOR X="PROGRESS NOTES","PROGRESS NOTES BRIEF"
SET GMMSG="Progress Notes not yet available"
DO DISABLE
+3 IF $DATA(^GMR(121))<10
FOR X="ADVANCE DIRECTIVE","CLINICAL WARNINGS","CRISIS NOTES"
SET GMMSG=X_" not yet available"
DO DISABLE
+4 QUIT
SURG ; Checks conditions for auto-disable of Surgery component
+1 NEW X,GMMSG
+2 IF $DATA(^SRF)<10
FOR X="SURGERY REPORTS","SURGERY REPORTS BRIEF"
SET GMMSG="Surgery Package not yet installed"
DO DISABLE
+3 QUIT
DCS ; Checks conditions for auto-disable of Discharge Summary components
+1 NEW X,GMMSG
+2 IF $DATA(^GMR(128))<10
Begin DoDot:1
+3 SET GMMSG="Discharge Summary Package not yet installed or available"
+4 FOR X="DISCHARGE SUMMARY","DISCHARGE SUMMARY BRIEF"
DO DISABLE
End DoDot:1
+5 QUIT
CP ; Checks conditions for auto-disable of Compensation and Pension component
+1 NEW X,GMMSG
+2 ; Checks conditions for auto-disable of Comp & Pen component
+3 IF +$$VERSION^XPDUTL("DVBA")<2.7
Begin DoDot:1
+4 SET GMMSG="Requires AMIE version 2.7"
+5 SET X="COMPENSATION AND PENSION EXAMS"
DO DISABLE^GMTSPOST
End DoDot:1
+6 QUIT
LAB ; Checks condition for auto-disable of Lab components
+1 NEW GMMSG,X
+2 IF $$VERSION^XPDUTL("LR")<5.1
Begin DoDot:1
+3 SET GMMSG="Requires Lab version 5.1 or later"
+4 FOR X="LAB BLOOD AVAILABILITY","LAB BLOOD TRANSFUSIONS","LAB CHEMISTRY & HEMATOLOGY","LAB CUMULATIVE SELECTED","LAB CUMULATIVE SELECTED 1"
DO DISABLE^GMTSPOST
+5 FOR X="LAB CUMULATIVE SELECTED 2","LAB CUMULATIVE SELECTED 3","LAB CUMULATIVE SELECTED 4","LAB CYTOPATHOLOGY","LAB ELECTRON MICROSCOPY","LAB MICROBIOLOGY"
DO DISABLE^GMTSPOST
+6 FOR X="LAB MICROBIOLOGY BRIEF","LAB ORDERS","LAB ORDERS BRIEF","LAB SURGICAL PATHOLOGY","LAB TESTS SELECTED"
DO DISABLE^GMTSPOST
End DoDot:1
+7 QUIT
RAD ; Checks condition for auto-disable of Radiology
+1 NEW GMMSG,X
+2 IF $$VERSION^XPDUTL("RA")<3
Begin DoDot:1
+3 SET GMMSG="Requires Radiology version 3 or later"
+4 FOR X="RADIOLOGY IMPRESSION","RADIOLOGY IMPRESSION SELECTED","RADIOLOGY PROFILE","RADIOLOGY STATUS"
DO DISABLE^GMTSPOST
End DoDot:1
+5 QUIT
MHPE ; Checks condition for auto-disable of Mental Health
+1 NEW GMMSG,X
+2 IF $$VERSION^XPDUTL("YS")<5
Begin DoDot:1
+3 SET GMMSG="Requires Mental Health version 5 or later"
+4 FOR X="MENTAL HEALTH PHYSICAL EXAM"
DO DISABLE^GMTSPOST
End DoDot:1
+5 QUIT
PCE ; Checks for existence of PCE package...Disables components if absents
+1 NEW GMMSG,X
+2 ;Disable PCE components if PCE not installed nor available
IF $$VERSION^XPDUTL("PX")'>0
Begin DoDot:1
+3 SET GMMSG="Patient Care Encounter Package not yet installed"
+4 FOR X="PCE LOCATION OF HOME","PCE CLINICAL REMINDERS","PCE HEALTH FACTORS SELECTED","PCE HEALTH FACTORS ALL","PCE OUTPATIENT ENCOUNTERS","PCE MEASUREMENTS NON-TABULAR","PCE IMMUNIZATIONS","PCE SKIN TESTS"
DO DISABLE^GMTSPOST
+5 FOR X="PCE MEASUREMENTS SELECTED","PCE EDUCATION","PCE EDUCATION LATEST","PCE OUTPATIENT DIAGNOSIS","PCE EXAMS LATEST","PCE TREATMENTS PROVIDED"
DO DISABLE^GMTSPOST
+6 FOR X="PCE CLINICAL MAINTENANCE"
DO DISABLE^GMTSPOST
End DoDot:1
+7 QUIT
DISABLE ; Disable components if auto-disable conditions are met
+1 NEW DA,DIC,DIE,DR,Y
+2 SET DIC="^GMT(142.1,"
SET DIC(0)="X"
DO ^DIC
+3 IF +Y>0
Begin DoDot:1
+4 WRITE !,X," Health Summary Component disabled"
+5 SET DA=+Y
SET DR="5///"_"P"_";8///"_GMMSG
SET DIE=DIC
DO ^DIE
End DoDot:1
+6 QUIT
FINITO ; Finish initialization, inform user
+1 NEW GMTSIFT,GMTSITD,X
+2 SET GMTSIFT=$$NOW^GMTSPREI
SET GMTSITD=$$DIFF(GMTSIFT,+$GET(GMTSIST))
+3 WRITE !!,"HEALTH SUMMARY VERSION 2.7 INITIALIZATION COMPLETE!"
+4 if '$LENGTH($TEXT(FMDIFF^XLFDT))
QUIT
+5 SET X=$GET(GMTSIST)
DO REGDTM^GMTSU
+6 WRITE !!?9,"Initialization began at: ",X
+7 SET X=GMTSIFT
DO REGDTM^GMTSU
+8 WRITE !!?5,"Initialization completed at: ",X
+9 WRITE !!?7,"TOTAL Initialization Time: ",GMTSITD
+10 QUIT
DIFF(END,BEGIN) ; Converts time difference to external format
+1 NEW DIFF,HR,MIN,SEC,Y
+2 SET DIFF=$$FMDIFF^XLFDT(END,BEGIN,2)
SET HR=DIFF\3600
+3 SET MIN=DIFF\60
SET SEC=DIFF#60
+4 SET HR=$EXTRACT("00",0,2-$LENGTH(HR))_HR
SET MIN=$EXTRACT("00",0,2-$LENGTH(MIN))_MIN
SET SEC=$EXTRACT("00",0,2-$LENGTH(SEC))_SEC
+5 SET Y=HR_":"_MIN_":"_SEC
+6 QUIT Y