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

TIUP258.m

Go to the documentation of this file.
TIUP258 ; ISL/JER - Install HT Titles ;11/10/15  11:42
 ;;1.0;TEXT INTEGRATION UTILITIES;**258**;Jun 20, 1997;Build 96
 ;;ICR
 ;;2053 FILE/UPDATE^DIE, 2051 $$FIND1^DIC, 10013 EN/ENALL/ENALL2^DIK, 10103 XLFDT, 10141 B/MES^XPDUTL, 4440 XUPROD
PRE ; pre-install
 D PREPARE
 Q
POST ; post-install
 N TIUPGNTS,TIUCONDC,TIUHTDC,TIUCLCOR ;Doc Class for PROGRESS NOTES, CONSULTS, HOME TELEHEALTH NOTES; and IEN for user class CLINCAL COORDINATOR
 S TIUPGNTS=$$LU(8925.1,"PROGRESS NOTES","X","I $P(^TIU(8925.1,+Y,0),U,4)=""CL""")
 S TIUCONDC=$$LU(8925.1,"CONSULTS","X","I $P(^TIU(8925.1,+Y,0),U,4)=""DC""")
 S TIUCLCOR=$$LU(8930,"CLINICAL COORDINATOR","X")
 D CRE8DC ;creates/update HT doc class and sets TIUHTDC=IEN
 D CRE8TITL
 D MAP
 D REINDEX
 Q
PREPARE ; Disable/Rename HT titles
 N TIUDA,TIUI,TITLESTR,TIUD0,TIUDC,TIUFPRIV,TIUFWHO
 S TIUFPRIV=1,TIUFWHO="N"
 D BMES^XPDUTL(" Preparing HT Document Class & Titles for Update...")
 S TIUI=""
 ;find and disable CCHT and/or HT doc classes
 F TIUI=1:1 S TITLESTR=$P($T(DOCCLASS+TIUI),";",3) Q:TITLESTR="EOL"  D
 .S TIUDC=$P(TITLESTR,U)
 .S TIUDA=$$LU(8925.1,TIUDC,"X","I $P(^TIU(8925.1,+Y,0),U,4)=""DC""")
 .D:+$G(TIUDA) DISABLE(TIUDA,TIUDC)
 ; Rename Home Telehealth Notes DC if it exists
 S TIUDA=$$LU(8925.1,"CARE COORDINATION HOME TELEHEALTH NOTES","X","I $P(^TIU(8925.1,+Y,0),U,4)=""DC""")
 I +TIUDA D
 . Q:+($$LU(8925.1,"HOME TELEHEALTH NOTES","X","I $P(^TIU(8925.1,+Y,0),U,4)=""DC"""))  ;don't want to rename doc class if already have HOME TELEHEALTH NOTES
 . N TIUREC,TIUERR
 . D MES^XPDUTL(" Renaming document class CARE COORDINATION HOME TELEHEALTH NOTES")
 . D MES^XPDUTL("  as HOME TELEHEALTH NOTES.")
 . S TIUREC(.01)="HOME TELEHEALTH NOTES"
 . D UPDATE(TIUDA,.TIUREC,.TIUERR)
 . I $D(TIUERR) D  Q
 . . D MES^XPDUTL(" Unable to Rename CARE COORDINATION HOME TELEHEALTH NOTES.")
 . . D MES^XPDUTL("  "_$G(TIUERR("DIERR",1,"TEXT",1)))
 ;
 ; Disable CCHT and/or HT Titles if member of Doc Class HOME TELEHEALTH NOTES
 N TIUDCDA,TIUCONS
 S TIUDCDA=$$LU(8925.1,"HOME TELEHEALTH NOTES","X","I $P(^TIU(8925.1,+Y,0),U,4)=""DC""")
 S TIUCONS=$$LU(8925.1,"CONSULTS","X","I $P(^TIU(8925.1,+Y,0),U,4)=""DC""")
 N TIUI,TITLESTR,TIUTTL0,TIUTTL1,TTL0DA,TTL1DA
 F TIUI=1:1 S TITLESTR=$P($T(TITLES+TIUI),";",3) Q:TITLESTR="EOL"  D
 .S TIUTTL0=$P(TITLESTR,U) Q:TIUTTL0']""
 .S TIUTTL1=$P(TITLESTR,U,2) Q:TIUTTL1']""
 .S TTL0DA=$O(^TIU(8925.1,"B",TIUTTL0,""))
 .S TTL1DA=$O(^TIU(8925.1,"B",TIUTTL1,""))
 .I TIUTTL0["CONSULT"&($$ISA^TIULX(+$G(TTL0DA),TIUCONS)) D:$$LU(8925.1,TIUTTL0,"X","I $P(^TIU(8925.1,+Y,0),U,4)=""DOC""") DISABLE(TTL0DA,TIUTTL0)
 .I TIUTTL1["CONSULT"&($$ISA^TIULX(+$G(TTL1DA),TIUCONS)) D:$$LU(8925.1,TIUTTL1,"X","I $P(^TIU(8925.1,+Y,0),U,4)=""DOC""") DISABLE(TTL1DA,TIUTTL1)
 .Q:+$G(TIUDCDA)=0  ;don't attempt disable if no HT or Care Coordination doc class was found.
 .I TIUTTL0'["CONSULT"&($$ISA^TIULX(+$G(TTL0DA),$G(TIUDCDA))) D:$$LU(8925.1,TIUTTL0,"X","I $P(^TIU(8925.1,+Y,0),U,4)=""DOC""") DISABLE(TTL0DA,TIUTTL0)
 .I TIUTTL1'["CONSULT"&($$ISA^TIULX(+$G(TTL1DA),$G(TIUDCDA))) D:$$LU(8925.1,TIUTTL1,"X","I $P(^TIU(8925.1,+Y,0),U,4)=""DOC""") DISABLE(TTL1DA,TIUTTL1)
 K TIUI
 D BMES^XPDUTL("")
 ; Rename selected HT Titles
 F TIUI=1:1 S TITLESTR=$P($T(TITLES+TIUI),";",3) Q:TITLESTR="EOL"  D
 . N TIUDA,TIUTTL0,TIUTTL1,TIUREC,TIUERR
 . S TIUTTL0=$P(TITLESTR,U) Q:TIUTTL0']""
 . S TIUDA=$$LU(8925.1,TIUTTL0,"X","I $P(^TIU(8925.1,+Y,0),U,4)=""DOC""")
 . Q:+TIUDA'>0
 . S TIUTTL1=$P(TITLESTR,U,2) Q:$S((TIUTTL1']""):1,(TIUTTL0=TIUTTL1):1,1:0)
 . I TIUTTL1'["CONSULT" Q:$$ISA^TIULX(TIUDA,$G(TIUDCDA))=0  ;don't rename if title isn't part of correct doc class
 . I TIUTTL1["CONSULT" Q:$$ISA^TIULX(TIUDA,TIUCONS)=0
 . D MES^XPDUTL(" Renaming "_TIUTTL0)
 . D MES^XPDUTL("  as "_TIUTTL1_".")
 . S TIUREC(.01)=TIUTTL1
 . D UPDATE(TIUDA,.TIUREC,.TIUERR)
 . I $D(TIUERR) D  Q
 . . D MES^XPDUTL(" Unable to Rename "_TIUTTL0_".")
 . . D MES^XPDUTL("  "_$G(TIUERR("DIERR",1,"TEXT",1)))
 Q
DISABLE(TIUDA,TIUNM) ; Disable a document definition
 N TIUREC,TIUERR
 D MES^XPDUTL(" Inactivating "_TIUNM_".")
 S TIUREC(.07)="INACTIVE"
 D UPDATE(TIUDA,.TIUREC,.TIUERR)
 I $D(TIUERR) D  Q
 . D MES^XPDUTL(" Unable to Inactivate "_TIUNM_".")
 . D MES^XPDUTL("  "_$G(TIUERR("DIERR",1,"TEXT",1)))
 Q
MAP ; Map HT Titles to appropriate VHA Enterprise Standard Titles
 N TIUERR,TIUIENS,TIUFLAGS,TIUFDA,TIUFPRIV,TIUFWHO,TIUPROD,TIUI,TITLESTR
 D BMES^XPDUTL("Attempting to map HT titles to VHA Enterprise Standard Titles...")
 S TIUPROD=$$PROD^XUPROD(1),TIUFPRIV=1,TIUFWHO="N"
 F TIUI=1:1 S TITLESTR=$P($T(TITLES+TIUI),";",3) Q:TITLESTR="EOL"  D
 . N TIUDA,TIUTTL1,TIUETTL,TIUREC,TIUERR
 . S TIUTTL1=$P(TITLESTR,U,2) Q:TIUTTL1']""
 . S TIUDA=$$LU(8925.1,TIUTTL1,"X","I $P(^TIU(8925.1,+Y,0),U,4)=""DOC""")
 . I +TIUDA'>0 D BMES^XPDUTL(" "_TIUTTL1_" title not installed.") Q
 . S TIUIENS=TIUDA_",",TIUETTL=$P(TITLESTR,U,3)
 . S TIUFDA(8925.1,TIUIENS,1501)=TIUETTL
 . S TIUFDA(8925.1,TIUIENS,1502)=$$FMTE^XLFDT($$NOW^XLFDT)
 . S TIUFDA(8925.1,TIUIENS,1503)="`"_DUZ
 . S TIUFLAGS="ET"
 . D FILE^DIE(TIUFLAGS,"TIUFDA","TIUERR")
 . ; if filing error occurs, write message to install log & quit
 . I $D(TIUERR) D  Q
 . . D:TIUPROD BMES^XPDUTL(" Unable to map "_TIUTTL1_" title") I 1
 . . D:TIUPROD MES^XPDUTL("  to "_TIUETTL_". You'll have to manually map the title.")
 . . D:TIUPROD MES^XPDUTL("  "_$G(TIUERR("DIERR",1,"TEXT",1)))
 . . K TIUFDA(8925.1,TIUIENS)
 . ; otherwise activate title
 . S TIUFDA(8925.1,TIUIENS,".07")="ACTIVE"
 . D FILE^DIE(TIUFLAGS,"TIUFDA","TIUERR")
 . ; if filing error occurs, write message to install log
 . I $D(TIUERR),TIUPROD D  Q
 . . D BMES^XPDUTL(" Unable to Activate "_TIUTTL1_" TITLE.")
 . . D MES^XPDUTL("  "_$G(TIUERR("DIERR",1,"TEXT",1)))
 . . K TIUFDA(8925.1,TIUIENS)
 . ; finally, check for entry in "ACL" cross-reference and if missing, call EN^DIK
 . I +$O(^TIU(8925.1,"ACL",3,TIUTTL1,0))'>0 D
 . . N DIK,DA S DIK="^TIU(8925.1,",DIK(1)=".07^ACL07",DA=TIUDA D EN^DIK
 Q
REINDEX ; Re-index HT Entries
 N DIK
 D BMES^XPDUTL(" Reindexing TIU Titles")
 S DIK="^TIU(8925.1,",DIK(1)=".07^AS"
 D ENALL2^DIK
 S DIK="^TIU(8925.1,",DIK(1)=".07^AS"
 D ENALL^DIK
 Q
LU(FILE,NAME,FLAGS,SCREEN,INDEXES) ; call FileMan Finder to look up file entry
 Q $$FIND1^DIC(FILE,"",$G(FLAGS),NAME,$G(INDEXES),$G(SCREEN),"MSGERR")
CRE8DC ;create HT doc class if not already on system
 N TIUINMSG
 S TIUHTDC=$$CREATE("HOME TELEHEALTH NOTES","","HOME TELEHEALTH NOTES","DC","11",.TIUERR)
 I $D(TIUERR) D
 .N TIUI
 .D BMES^XPDUTL(" The following error message was returned:")
 .S TIUI="" F  S TIUI=$O(TIUERR("DIERR",1,"TEXT",TIUI)) Q:TIUI=""  D MES^XPDUTL("  "_$G(TIUMSG("DIERR",1,"TEXT",TIUI)))
 I +$G(TIUHTDC) D
 .S TIUINMSG=$$INSTALL(TIUHTDC,+$G(TIUPGNTS))
 .I +$G(TIUINMSG)'>0 D BMES^XPDUTL("Error adding HOME TELEHEALTH NOTES to PROGRESS NOTES")
 Q
CRE8TITL  ;will loop thru TITLES to Create and Install new titles
 N TIUI,TITLESTR,TIUX258,TIU01,TIU04,TIU07,TIUERR,TIU4
 S TIU04="DOC",TIU07=13 ;titles are activated in MAP
 F TIUI=1:1 S TITLESTR=$P($T(TITLES+TIUI),";",3) Q:TITLESTR="EOL"  D
 .S TIU01=$P(TITLESTR,U,2),TIU4=$P(TITLESTR,U,4)
 .S TIUX258=$$CREATE(TIU01,"",TIU01,TIU04,TIU07,.TIUERR)
 .I $D(TIUERR) D
 ..N TIUI
 ..D BMES^XPDUTL(" The following error message was returned:")
 ..S TIUI="" F  S TIUI=$O(TIUERR("DIERR",1,"TEXT",TIUI)) Q:TIUI=""  D MES^XPDUTL("  "_$G(TIUMSG("DIERR",1,"TEXT",TIUI)))
 .I +$G(TIUX258) D
 ..I TIU01["CONSULT" S TIUX258=$$INSTALL(+$G(TIUX258),+$G(TIUCONDC),$G(TIU4))
 ..E  S TIUX258=$$INSTALL(+$G(TIUX258),+$G(TIUHTDC),$G(TIU4))
 ..D BMES^XPDUTL(TIU01_" successfully installed")
 .E  D BMES^XPDUTL("Error: "_TIU01_" was not added to the document class")
 Q
 ;
CREATE(TIUNAME,TIUABB,TIUPNAME,TIUTYPE,TIUSTAT,TIUERR) ; call FileMan Updater to create file entry
 ;creates new entry or updates existing entry for pilot program sites; returns IEN of entry
 N TIUREC,TIUDA,TIUFPRIV,TIUFWHO,TIUNATTL
 S TIUNATTL=1
 I $G(TIUNAME)["CONSULT" S TIUNATTL=0
 S TIUFPRIV=1,TIUFWHO="N"
 S TIUREC(8925.1,"?+1,",.01)=$G(TIUNAME) ;NAME
 S TIUREC(8925.1,"?+1,",.02)=$G(TIUABB) ;ABBREVIATION
 S:TIUNAME="HT SUMMARY OF EPISODE NOTE" TIUPNAME="HT MONTHLY MONITOR NOTE"
 S TIUREC(8925.1,"?+1,",.03)=$G(TIUPNAME) ;PRINT NAME
 S TIUREC(8925.1,"?+1,",.04)=$G(TIUTYPE) ;TYPE
 S TIUREC(8925.1,"?+1,",.06)=$G(TIUCLCOR) ;CLASS OWNER
 S TIUREC(8925.1,"?+1,",.07)=$G(TIUSTAT) ;STATUS 11=ACTIVE, 13=INACTIVE
 S TIUREC(8925.1,"?+1,",.13)=$G(TIUNATTL) ;NAT'L STD 1=YES
 S TIUREC(8925.1,"?+1,",3.02)=1 ;OK TO DISTR=YES
 S TIUREC(8925.1,"?+1,",99)=$H ;TIMESTAMP
 D UPDATE^DIE("","TIUREC","TIUDA","TIUERR")
 Q +$G(TIUDA(1))
 ;
INSTALL(TIUDNM,TIUPRNT,TIUMNTXT) ; Install document definition
 ;TIUDNM - title IEN, TIUPRNT - parent IEN, TIUMNTXT - menu text
 N TIU,TIUIEN,TIUMSG
 S TIU(8925.14,"?+1,"_TIUPRNT_",",.01)=TIUDNM
 S TIU(8925.14,"?+1,"_TIUPRNT_",",4)=$G(TIUMNTXT) ;$G b/c menu text not defined for Doc Class
 D UPDATE^DIE("","TIU","TIUIEN","TIUMSG")
 I $D(TIUMSG) D
 . W !!,"The following error message was returned:",!!
 . S TIUMSG="" F  S TIUMSG=$O(TIUMSG("DIERR",1,"TEXT",TIUMSG)) Q:TIUMSG=""  W TIUMSG("DIERR",1,"TEXT",TIUMSG),!
 Q +$G(TIUIEN(1))
UPDATE(TIUDA,TIUREC,TIUERR) ; call FileMan Filer to update record
 N TIUIENS,TIUFLAGS,TIUFDA,TIUFPRIV,TIUFWHO,TIUFI
 S TIUFPRIV=1,TIUFWHO="N",TIUIENS=TIUDA_",",TIUFI=0
 F  S TIUFI=$O(TIUREC(TIUFI)) Q:+TIUFI'>0  D
 . S TIUFDA(8925.1,TIUIENS,TIUFI)=$G(TIUREC(TIUFI))
 S TIUFLAGS="ET" ;External, Transaction (all or nothing)
 D FILE^DIE(TIUFLAGS,"TIUFDA","TIUERR")
 Q
TITLES ; list of titles NAME YOU ARE LOOKING FOR ^ WHAT IT WILL BE RENAMED TO ^ VHA ENT STD TITLE ^ MENU TEXT
 ;;CCHT SCREENING CONSULT^HT SCREENING CONSULT^CARE COORDINATION HOME TELEHEALTH CONSULT^HT Screening Consult
 ;;CARE COORDINATION HOME TELEHEALTH SUBSEQUENT EVAL NOTE^HT INTERVENTION NOTE^CARE COORDINATION HOME TELEHEALTH FOLLOW-UP NOTE^HT Subsequent Eval
 ;;CARE COORDINATION HOME TELEHEALTH SUMMARY OF EPISODE NOTE^HT SUMMARY OF EPISODE NOTE^CARE COORDINATION HOME TELEHEALTH SUMMARIZATION NOTE^HT Summary Episode
 ;;CCHT DISCHARGE NOTE^HT DISCHARGE NOTE^CARE COORDINATION HOME TELEHEALTH DISCHARGE NOTE^HT Discharge Note
 ;;CCHT VIDEO VISIT NOTE^HT VIDEO VISIT NOTE^CARE COORDINATION HOME TELEHEALTH VIDEO VISIT NOTE^HT Video Visit Note
 ;;CCHT ASSESSMENT TREATMENT PLAN NOTE^HT ASSESSMENT TREATMENT PLAN NOTE^CARE COORDINATION HOME TELEHEALTH TREATMENT PLAN NOTE^HT Assmnt Trmnt Plan
 ;;CCHT CAREGIVER ASSESSMENT NOTE^HT CAREGIVER ASSESSMENT NOTE^CARE COORDINATION HOME TELEHEALTH E & M NOTE^HT Caregiver Assmnt
 ;;CCHT CONTINUUM OF CARE NOTE^HT CONTINUUM OF CARE NOTE^CARE COORDINATION HOME TELEHEALTH E & M NOTE^HT Continuum Care
 ;;CCHT NOTE^HT NOTE^CARE COORDINATION HOME TELEHEALTH NOTE^HT Note
 ;;CCHT PERIODIC EVALUATION NOTE^HT PERIODIC EVALUATION NOTE^CARE COORDINATION HOME TELEHEALTH REPORT^HT Periodic Eval
 ;;CCHT TECH EDUCATION NOTE^HT TECH EDUCATION NOTE^CARE COORDINATION HOME TELEHEALTH EDUCATION NOTE^HT Tech Education
 ;;CCHT TELEPHONE CASE MANAGEMENT NOTE^HT TELEPHONE CASE MANAGEMENT NOTE^CARE COORDINATION HOME TELEHEALTH NOTE^HT Case Mgmt Note
 ;;EOL
 Q
DOCCLASS ;list of doc classes
 ;;CARE COORDINATION HOME TELEHEALTH NOTES^
 ;;HOME TELEHEALTH NOTES^HOME TELEHEALTH NOTES^DC
 ;;EOL