| 1 | RGMTUT98 ;BIR/CML,PTD-Misc. MPI Load COUNTER Utilities ;07/30/02
|
---|
| 2 | ;;1.0;CLINICAL INFO RESOURCE NETWORK;**20**;30 Apr 99
|
---|
| 3 | ;
|
---|
| 4 | ;Reference to ^HLMA("AC" and other fields supported by IA #3273
|
---|
| 5 | ;Reference to ^HLCS(870 supported by IA #3335
|
---|
| 6 | ;Reference to ^VAT(391.71,"AXMIT" supported by IA #3422
|
---|
| 7 | ;Reference to ^ORD(101 supported by IA #2596
|
---|
| 8 | ;Reference to ^DPT("AICN", "AICNL", and "ACMORS" supported by IA #2070
|
---|
| 9 | ;
|
---|
| 10 | HLMA1 ;check the contents of the ^HLMA("AC" xref - brief data
|
---|
| 11 | S FLG=0 G HLMA
|
---|
| 12 | HLMA2 ;check the contents of the ^HLMA("AC" xref - detailed data
|
---|
| 13 | S FLG=1
|
---|
| 14 | HLMA ;
|
---|
| 15 | K ^XTMP("RGMT","HLMQHLMA"),MISSP
|
---|
| 16 | S LOCSITE=$P($$SITE^VASITE(),"^",3),TXTCNT=0
|
---|
| 17 | D NOW^%DTC
|
---|
| 18 | S TXT="<<Run - "_$$FMTE^XLFDT(%)_">>"
|
---|
| 19 | I $D(RGHLMQ) D
|
---|
| 20 | .S TXTCNT=TXTCNT+1
|
---|
| 21 | .S ^XTMP("RGMT","HLMQHLMA",LOCSITE,"@@ RUNDATE")=$$FMTE^XLFDT($E(%,1,12))
|
---|
| 22 | .S ^XTMP("RGMT","HLMQHLMA",LOCSITE,TXTCNT)=TXT
|
---|
| 23 | I '$D(RGHLMQ) W !,TXT
|
---|
| 24 | ;
|
---|
| 25 | S TXT="Outgoing messages:"
|
---|
| 26 | I $D(RGHLMQ) S TXTCNT=TXTCNT+1,^XTMP("RGMT","HLMQHLMA",LOCSITE,TXTCNT)=TXT
|
---|
| 27 | I '$D(RGHLMQ) W !,TXT
|
---|
| 28 | ;
|
---|
| 29 | S SITE=0
|
---|
| 30 | F S SITE=$O(^HLMA("AC","O",SITE)) Q:'SITE D I $D(CNT) D WRT
|
---|
| 31 | .K CNT
|
---|
| 32 | .S LINK=$$GET1^DIQ(870,SITE_",",.01) I $E(LINK,1,2)'="VA"&($E(LINK,1,2)'="MP") S QFLG=1 Q
|
---|
| 33 | .K ARR
|
---|
| 34 | .S MSG=0,CNT=0
|
---|
| 35 | .F S MSG=$O(^HLMA("AC","O",SITE,MSG)) Q:'MSG D
|
---|
| 36 | ..S CNT=CNT+1
|
---|
| 37 | ..Q:'FLG
|
---|
| 38 | ..S PROT=$$GET1^DIQ(773,MSG_",",8,"I")
|
---|
| 39 | ..Q:'PROT
|
---|
| 40 | ..I '$D(ARR(PROT)) S ARR(PROT)=0
|
---|
| 41 | ..S ARR(PROT)=ARR(PROT)+1
|
---|
| 42 | ;
|
---|
| 43 | S TXT=""
|
---|
| 44 | I $D(RGHLMQ) S TXTCNT=TXTCNT+1,^XTMP("RGMT","HLMQHLMA",LOCSITE,TXTCNT)=TXT
|
---|
| 45 | I '$D(RGHLMQ) W !,TXT
|
---|
| 46 | ;
|
---|
| 47 | S TXT="Incoming messages:"
|
---|
| 48 | I $D(RGHLMQ) S TXTCNT=TXTCNT+1,^XTMP("RGMT","HLMQHLMA",LOCSITE,TXTCNT)=TXT
|
---|
| 49 | I '$D(RGHLMQ) W !,TXT
|
---|
| 50 | S SITE=0
|
---|
| 51 | F S SITE=$O(^HLMA("AC","I",SITE)) Q:'SITE D D WRT
|
---|
| 52 | .K ARR
|
---|
| 53 | .S MSG=0,CNT=0
|
---|
| 54 | .F S MSG=$O(^HLMA("AC","I",SITE,MSG)) Q:'MSG D
|
---|
| 55 | ..S CNT=CNT+1
|
---|
| 56 | ..Q:'FLG
|
---|
| 57 | ..S PROT=$$GET1^DIQ(773,MSG_",",8,"I")
|
---|
| 58 | ..Q:'PROT
|
---|
| 59 | ..I '$D(ARR(PROT)) S ARR(PROT)=0
|
---|
| 60 | ..S ARR(PROT)=ARR(PROT)+1
|
---|
| 61 | ;
|
---|
| 62 | QUIT K SITE,CNT,MSG,PROT,PROTNM,ARR,LINKNM,MISSP,MSG,GOT,INFLR
|
---|
| 63 | K FLG,LINK,LOCSITE,QFLG,STATE,TXT1,TXT2,TXTCNT
|
---|
| 64 | Q
|
---|
| 65 | ;
|
---|
| 66 | PIV ;Count # of entries in pivot file xref
|
---|
| 67 | S CNT=0,IEN=0 F S IEN=$O(^VAT(391.71,"AXMIT",4,IEN)) Q:'IEN S CNT=CNT+1
|
---|
| 68 | S TXT="(Total DATA UPDATES waiting to be processed = "_CNT_")"
|
---|
| 69 | I $D(RGHLMQ) S TXTCNT=TXTCNT+1,^XTMP("RGMT","HLMQMONT",LOCSITE,TXTCNT)=TXT
|
---|
| 70 | I '$D(RGHLMQ) W !?3,TXT
|
---|
| 71 | S CNT=0,IEN=0 F S IEN=$O(^VAT(391.71,"AXMIT",5,IEN)) Q:'IEN S CNT=CNT+1
|
---|
| 72 | S TXT="(Total TREATING FACILITY UPDATES waiting to be processed = "_CNT_")"
|
---|
| 73 | I $D(RGHLMQ) S TXTCNT=TXTCNT+1,^XTMP("RGMT","HLMQMONT",LOCSITE,TXTCNT)=TXT
|
---|
| 74 | I '$D(RGHLMQ) W !?3,TXT
|
---|
| 75 | K CNT,IEN,TXT
|
---|
| 76 | Q
|
---|
| 77 | ;
|
---|
| 78 | WRT ;write type and total for messages
|
---|
| 79 | ;find current STATE of Link
|
---|
| 80 | S STATE=$$GET1^DIQ(870,SITE_",",4)
|
---|
| 81 | S TXT1=$$GET1^DIQ(870,SITE_",",.01)_" - "_CNT_" messages"_$S(FLG:":",1:".")
|
---|
| 82 | S TXT2="STATE: "_STATE
|
---|
| 83 | I $D(RGHLMQ) S TXTCNT=TXTCNT+1,^XTMP("RGMT","HLMQHLMA",LOCSITE,TXTCNT)=TXT1_" "_TXT2
|
---|
| 84 | I '$D(RGHLMQ) W !,TXT1,?30,TXT2
|
---|
| 85 | Q:'FLG
|
---|
| 86 | S PROT=0
|
---|
| 87 | F S PROT=$O(ARR(PROT)) Q:'PROT D
|
---|
| 88 | .S PROTNM=$P($G(^ORD(101,PROT,0)),"^") I PROTNM="" S PROTNM="PROTOCOL NOT FOUND"
|
---|
| 89 | .I $D(RGHLMQ) S TXTCNT=TXTCNT+1,TXT=PROTNM_" - "_ARR(PROT),^XTMP("RGMT","HLMQHLMA",LOCSITE,TXTCNT)=TXT
|
---|
| 90 | .I '$D(RGHLMQ) W !?3,PROTNM,?32," - ",$J(ARR(PROT),8)
|
---|
| 91 | Q
|
---|
| 92 | ;
|
---|
| 93 | CNT ;do counts
|
---|
| 94 | D SCORE,ICN,LICN
|
---|
| 95 | Q
|
---|
| 96 | SCORE ;count number of CMOR scores
|
---|
| 97 | D NOW^%DTC
|
---|
| 98 | W !,"<<Run - ",$$FMTE^XLFDT(%),">>"
|
---|
| 99 | W !,"...counting number of CMOR scores"
|
---|
| 100 | S SC=0,CNT=0
|
---|
| 101 | F S SC=$O(^DPT("ACMORS",SC)) Q:'SC D
|
---|
| 102 | .S DFN=0
|
---|
| 103 | .F S DFN=$O(^DPT("ACMORS",SC,DFN)) Q:'DFN D
|
---|
| 104 | ..S CNT=CNT+1
|
---|
| 105 | W !?3,"(Current total # of Patients with CMOR Scores = ",CNT,")"
|
---|
| 106 | K %,SC,CNT,DFN
|
---|
| 107 | Q
|
---|
| 108 | ;
|
---|
| 109 | ICN ;count number of ICNs
|
---|
| 110 | S HOME=$P($$SITE^VASITE(),"^",3)
|
---|
| 111 | W !!,"...counting number of ICNs"
|
---|
| 112 | S ICN=0,CNT=0
|
---|
| 113 | F S ICN=$O(^DPT("AICN",ICN)) Q:'ICN D
|
---|
| 114 | .Q:$E(ICN,1,3)=HOME
|
---|
| 115 | .S CNT=CNT+1
|
---|
| 116 | W !?3,"(Current total # of National ICNs = ",CNT,")"
|
---|
| 117 | K HOME,ICN,CNT
|
---|
| 118 | Q
|
---|
| 119 | ;
|
---|
| 120 | LICN ;count number of local ICNs
|
---|
| 121 | W !!,"...counting number of local ICNs"
|
---|
| 122 | S ICN=0,CNT=0
|
---|
| 123 | F S ICN=$O(^DPT("AICNL",1,ICN)) Q:'ICN S CNT=CNT+1
|
---|
| 124 | W !?3,"(Current total # of Local ICNs = ",CNT,")"
|
---|
| 125 | K CNT,DFN,ICN
|
---|
| 126 | Q
|
---|