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

PXRMP19A.m

Go to the documentation of this file.
PXRMP19A ;BP/WAT;post-install for patch 19 con't ;02/27/17  13:31
 ;;2.0;CLINICAL REMINDERS;**19**;Feb 04, 2005;Build 187
 Q
 ;INTEGRATION AGREEMENTS
 ;;3083 ^AUTTHF( | 10141 ^XPDUTL | 10103 ^XLFDT | 10104 ^XLFSTR | 10063 ^%ZTLOAD | 2263 ^XPAR | 1131 XMB("NETNAME")
 ;;10066 XMZ^XMA2  |  10070 ENT1^XMD  | 2172 XPDID | 10113 ^XMB(3.9
 ;
QUEUE(PXRMSG,ZTRTN,ZTDESC,PXRMITEM) ;CREATE A SPECIFIED TASK
 ;PARAMETERS: PXRMSG   => STRING CONTAINING THE TEXT TO OUTPUT TO THE SCREEN
 ;            ZTRTN    => STRING CONTAINING THE ROUTINE TASKMAN SHOULD EXECUTE
 ;            ZTDESC   => STRING CONTAINING THE TASK'S DESCRIPTION
 ;            PXRMITEM => REFERENCE TO THE VARIABLE STORING THE NUMBER OF THE CURRENT ITEM
 N ZTDTH,ZTIO,ZTSK,ZTSAVE
 S ZTSAVE("^TMP(""PXRM_CCHTHF"",$J,")=""
 S ZTSAVE("DUZ")=$G(DUZ)
 D BMES^XPDUTL("Queueing "_PXRMSG_"...")
 S ZTDTH=$$FMADD^XLFDT($$NOW^XLFDT,0,0,0,10)
 S ZTIO=""
 D ^%ZTLOAD
 S ZTREQ="@"
 I +$G(ZTSK)=0 D
 .I $G(PXRMPOST) D BMES^XPDUTL("Unable to queue the "_PXRMSG_"; file a Remedy ticket for assistance.")
 .E  W "ERROR",!,"Unable to queue the "_PXRMSG_"; file a Remedy ticket for assistance.",!
 E  D
 .I $G(PXRMPOST) D
 ..D BMES^XPDUTL("DONE - Task #"_ZTSK)
 ..D UPDATE^XPDID($G(PXRMITEM))
 ..S PXRMITEM=PXRMITEM+1
 .E  W "DONE",!,"Task #"_ZTSK,!
 Q
SEND(NODE,SUBJECT,FROM) ;Send a MailMan message whose text is in ^TMP(NODE,$J,N,0).
 N SUBSCR,NL,REF,XMDUZ,XMSUB,XMY,XMZ S SUBSCR="PXRM19RECIPS"
 I $Q(^XTMP(SUBSCR,0))[SUBSCR D
 .M XMY=^XTMP(SUBSCR)
 E  S XMY(DUZ)=""
 I $D(ZTQUEUED)>0 D
 .S XMY(DUZ)=""
 S XMSUB=$E(SUBJECT,1,64)
 S XMDUZ=$G(FROM)
 ;
RETRY ;Get the message number.
 D XMZ^XMA2
 I XMZ<1 G RETRY
 ;
 ;Load message, send
 M ^XMB(3.9,XMZ,2)=^TMP(NODE,$J)
 K ^TMP(NODE,$J)
 S NL=$O(^XMB(3.9,XMZ,2,""),-1)
 S ^XMB(3.9,XMZ,2,0)="^3.92^"_+NL_U_+NL_U_DT
 D ENT1^XMD Q
 Q
 ;
MAIN ; main module
 K ^TMP("PXRMPATS",$J)
 N INC,NODE,SUBJ,FROM S INC=1,NODE="PXRM_CCHTHF",SUBJ="LOCAL CCHT HFs NOT USED IN NAT'L HT CLIN REMINDER CONTENT",FROM="PXRM*2.0*19 Install@"_^XMB("NETNAME")
 D LOCHF
 D SEND(NODE,SUBJ,FROM)
 D CLNTMP
 Q
 ;
CLNTMP ;need to check clean up of TMP arrays when done with them
 K ^TMP("PXRM19HF",$J)
 K ^TMP("PXRM_CCHTHF",$J)
 K ^XTMP("PXRM19RECIPS")
 Q
 ;
LOCHF ;report out local CCHT HFs not used in HT reminder content
 ;build list of all HFs in the HT content
 ;build list of all local "CCHT" or "CARE COORDIATION HOME TELEHEALTH" HFs
 ;compare the two lists and report out any local HFs that are NOT used by HT
 N NODEA,NODEB,CATEGORY,INACTIVE,HFIEN,COUNT,FLAG
 S NODEA="PXRM19HF",NODEB="PXRM_CCHTHF",COUNT=3
 D HTHFTMP,HFLKUP,COMPARE(NODEA,NODEB)
 I $D(^TMP("PXRM_CCHTHF",$J))'>0 S ^TMP("PXRM_CCHTHF",$J,1,0)="No local CCHT/CARE COORDINATION health factors found." Q
 ;add category and inactive values to TMP array entries
 F  S COUNT=$O(^TMP("PXRM_CCHTHF",$J,COUNT)) Q:$G(COUNT)=""  D
 . S HFIEN=$P(^TMP("PXRM_CCHTHF",$J,COUNT,0),"^")
 . S:$G(HFIEN) CATEGORY=$P(^AUTTHF(HFIEN,0),"^",3)
 . S:$G(CATEGORY) CATEGORY=$P(^AUTTHF(CATEGORY,0),"^",1)
 . I $L(CATEGORY)<40 S CATEGORY=CATEGORY_$$REPEAT^XLFSTR(" ",(40-$L(CATEGORY)))
 . S FLAG=$P(^AUTTHF(HFIEN,0),"^",11)
 . S ^TMP("PXRM_CCHTHF",$J,COUNT,0)=$P(^TMP("PXRM_CCHTHF",$J,COUNT,0),U,2)
 . S ^TMP("PXRM_CCHTHF",$J,COUNT+.1,0)=$J($G(CATEGORY),47)_$J($S($G(FLAG)=1:"YES",1:"NO"),17)
 . S COUNT=$O(^TMP("PXRM_CCHTHF",$J,COUNT)) ;need this to get past the X.1 subscript set in the line above
 ;add header text
 S ^TMP("PXRM_CCHTHF",$J,1,0)="HEALTH FACTOR"
 S ^TMP("PXRM_CCHTHF",$J,2,0)=$J("CATEGORY",15)_$J("INACTIVE?",55)
 S ^TMP("PXRM_CCHTHF",$J,3,0)=$$REPEAT^XLFSTR("-",78)
 Q
 ;
HTHFTMP ;build TMP array of HT HFs
 K ^TMP("PXRM19HF",$J)
 N PXRMI,PXRMFCTR,PXRMCNT
 S PXRMCNT=1
 F PXRMI=1:1 S PXRMFCTR=$P($T(HF+PXRMI^PXRMP19B),";",3) Q:PXRMFCTR="EOF"  D
 .I PXRMFCTR="HT (CARE COORDINATION HOME TELEHEALTH)" S PXRMFCTR="HT (HOME TELEHEALTH)"
 .S ^TMP("PXRM19HF",$J,PXRMCNT)=PXRMFCTR,PXRMCNT=PXRMCNT+1
 Q
 ;
COMPARE(PXRMA,PXRMB) ; compare list PXRMA and PXRMB.  Remove duplicate items from PXRMB
 Q:'$D(^TMP(PXRMA,$J))
 Q:'$D(^TMP(PXRMB,$J))
 N ACOUNT,BCOUNT,HFA,HFB,INDEX S (ACOUNT,BCOUNT,INDEX)=0
 F  S BCOUNT=$O(^TMP(PXRMB,$J,BCOUNT)) Q:BCOUNT=""  D
 . S HFB=^TMP(PXRMB,$J,BCOUNT,0),HFB=$P(HFB,U,2)
 . F  S ACOUNT=$O(^TMP(PXRMA,$J,ACOUNT)) Q:ACOUNT=""  D
 . . S HFA=^TMP(PXRMA,$J,ACOUNT)
 . . I HFA=HFB K ^TMP(PXRMB,$J,BCOUNT) ;leave only non-matches in PXRM_CCHTHF
 Q
 ;
HFLKUP ;find local HFs with "CCHT" or "CARE COORDINATION" in name or category
 ;^TMP("PXRM_CCHTHF",$J)=IEN OF HF ^ NAME OF HF
 K ^TMP("PXRM_CCHTHF",$J)
 N HFIEN,HFNAME,HFCAT,CNT S HFIEN=0,HFNAME="",CNT=4
 F  S HFNAME=$O(^AUTTHF("B",HFNAME)) Q:HFNAME=""  D
 .S HFIEN=$O(^AUTTHF("B",HFNAME,"")) Q:HFIEN'>99999
 .S HFCAT=$P(^AUTTHF(HFIEN,0),U,3) I $G(HFCAT)'="" D
 ..I $D(^AUTTHF(HFCAT))>0 S HFCAT=$P(^AUTTHF(HFCAT,0),U)
 .I (HFNAME["CCHT")!(HFNAME["CARE COORDINATION HOME TELEHEALTH")!(HFCAT["CCHT")!(HFCAT["CARE COORDINATION HOME TELEHEALTH")  D
 ..S ^TMP("PXRM_CCHTHF",$J,CNT,0)=HFIEN_"^"_HFNAME_"^0",CNT=CNT+1
 Q
 ;
ORWPCE(PXRMITEM) ;set parameter value to true
 ;;HT (HOME TELEHEALTH)
 ;;HT ASSESSMENT/TREATMENT PLAN
 ;;HT CAREGIVER RISK ASSESSMENT SCREEN
 ;;HT CONTINUUM OF CARE (CCF)
 ;;HT DISCHARGE
 ;;HT REFERRALS FOR VETERAN/CAREGIVER
 ;;HT TELEHEALTH DELIVERY/INSTALL MODE
 ;;HT TELEHEALTH DEMOGRAPHICS
 D BMES^XPDUTL("Checking ORWPCE EXCLUDE HEALTH FACTORS at the SYSTEM level")
 D MES^XPDUTL("for each HT Health Factor Category")
 N HFIEN,HFCATNAM,PXRMERR,LVL,PAR,PXRMPAR,CNT,LASTVAL
 S PAR="ORWPCE EXCLUDE HEALTH FACTORS",LVL="SYS"
 F CNT=1:1:8  D
 .D GETLST^XPAR(.PXRMPAR,LVL,PAR,"I",.PXRMERR)
 .S HFCATNAM=$P($T(ORWPCE+CNT),";;",2)
 .S HFIEN=$O(^AUTTHF("B",HFCATNAM,""))
 .D:$$CHKLIST(HFIEN,.PXRMPAR)=0&(HFIEN>0)
 ..S LASTVAL=$O(PXRMPAR(""),-1)
 ..S LASTVAL=LASTVAL+1
 ..D EN^XPAR(LVL,PAR,LASTVAL,"`"_$G(HFIEN),.PXRMERR)
 ..I +$G(PXRMERR)=0 D MES^XPDUTL("Parameter set for "_HFCATNAM)
 ..I +$G(PXRMERR)>0 D BMES^XPDUTL("ERROR: "_$P(PXRMERR,U,2))
 I $G(PXRMPOST) D
 .D UPDATE^XPDID($G(PXRMITEM))
 .S PXRMITEM=PXRMITEM+1
 Q
 ;
TIURMDLG(PXRMITEM)  ;set parameter value to true
 ;;VA-HT ASSESSMENT TREATMENT PLAN TEMPLATE
 ;;VA-HT CAREGIVER ASSESSMENT TEMPLATE
 ;;VA-HT CONTINUUM OF CARE TEMPLATE
 ;;VA-HT DISCHARGE TEMPLATE
 ;;VA-HT INTERVENTION TEMPLATE
 ;;VA-HT PERIODIC EVALUATION
 ;;VA-HT SCREENING CONSULT TEMPLATE
 ;;VA-HT TECH EDUCATION & INSTALLATION TEMPLATE
 ;;VA-HT TEMPLATE FOR PREVIOUSLY ENROLLED PATIENTS
 ;;VA-HT VIDEO VISIT TEMPLATE
 N CNT,LASTVAL,PAR,LVL,PXRMPAR,PXRMERR,DIEN,DNAME
 D BMES^XPDUTL("Checking TIU TEMPLATE REMINDER DIALOGS at the SYSTEM level")
 S PAR="TIU TEMPLATE REMINDER DIALOGS",LVL="SYS"
 F CNT=1:1:10 D
 .D GETLST^XPAR(.PXRMPAR,LVL,PAR,"I",.PXRMERR)
 .S DNAME=$P($T(TIURMDLG+CNT),";;",2)
 .S DIEN=$O(^PXRMD(801.41,"B",DNAME,"")) Q:+$G(DIEN)'>0
 .D:$$CHKLIST($G(DIEN),.PXRMPAR)=0
 ..S LASTVAL=$O(PXRMPAR(""),-1)
 ..S LASTVAL=LASTVAL+1
 ..D EN^XPAR(LVL,PAR,LASTVAL,"`"_$G(DIEN),.PXRMERR)
 ..I +$G(PXRMERR)=0 D MES^XPDUTL("Parameter set for "_DNAME)
 ..I +$G(PXRMERR)>0 D BMES^XPDUTL("ERROR: "_$P(PXRMERR,U,2))
 I $G(PXRMPOST) D
 .D UPDATE^XPDID($G(PXRMITEM))
 .S PXRMITEM=PXRMITEM+1
 Q
 ;
CHKLIST(IEN,LIST) ;see if parameter value is already set
 N I,CHECK S CHECK=0,I=""
 Q:LIST'>0 CHECK
 F  S I=$O(LIST(I)) Q:I=""!(CHECK=1)  D
 .I $G(LIST(I))=IEN S CHECK=1
 Q CHECK