HLP109 ;ALB/CJM - Post-Install for patch 109 ;06/03/99
;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
;
SETAC ;Used to undo the changes to the "AC" xref, used only if the patch
;HL*1.6*109 needs to be backed out.
S ^DD(773,7,1,1,1)="S %=$P(^HLMA(DA,0),U,3) S:%]"""" ^HLMA(""AC"",%,X,DA)="""" I %=""O"",'$D(HLTCPO) D LLCNT^HLCSTCP(X,3)"
S ^DD(773,7,1,1,2)="S %=$P(^HLMA(DA,0),U,3) K:%]"""" ^HLMA(""AC"",%,X,DA)"
;S ^DD(773,100,1,1,1)="S ^HLMA(""AD"",X,DA)="""" N %,%1 S %=$G(^HLMA(DA,0)),%1=$P(%,U,3),%=$P(%,U,7) K:%1]""""&% ^HLMA(""AC"",%1,%,DA)"
Q
;
PRE ; Called by KIDS pre-init...
S ^HLCS(869.3,1,772)=($O(^HL(772,":"),-1)\1)
S ^HLCS(869.3,1,773)=($O(^HLMA(":"),-1)\1)
D UNQUEUE^HLEVUTIL
D LOADMON
D ETHL7 ; Make sure every official HL7 entry has PACKAGE NAME...
Q
;
LOADMON ; Create a list of monitors in ^XTMP(XTMP,"O")...
N NOW,XTMP
S NOW=$$NOW^XLFDT
S XTMP="HLEV INSTALL "_NOW
S ^XTMP(XTMP,0)=$$FMADD^XLFDT(NOW,2)_U_NOW_U_"HLEV INSTALLATION MONITOR LIST"
S IEN=0
F S IEN=$O(^HLEV(776.1,IEN)) Q:'IEN D
. S ^XTMP(XTMP,"O",IEN)=$P($G(^HLEV(776.1,IEN,0)),U)_U_$$IENSUM(IEN)
Q
;
;
;
;
POST ; Called by KIDS post-init...
N NO,TEXT,XMDUZ,XMSUB,XMTEXT,XMZ
N %KMPRJT,%XX,%ZH0,%ZHFN,C,D0,DA,DG,DICR,DIFRFRV1,DIFROM,DIU,I,IEN
N J,X,XG255,XGATRSET,XGCURATR,XGEMPATR,XGPAD,XGRT,XGSCRN
N XQCH,ZQJMP,XQSV,XWT,XQUSER,XQZ,Y
N XPD,XPD0,XPDA,XPDBLD,XPDCHECK,XPDCP,XPDD,XPDGREF,XPDIDCNT
N XPDIDMOD,XPDIDTOT,XPDIDVT,XPDIT,XPDNM,XPDPKG,XPDRTN,XPDSET
N XPDSET1,XPDST,XPDT
;
; Load 776.999 file entry if needed...
D LOADPAR
;
; Update list of monitors...
D COMPMON
;
; Send email message to DUZ...
KILL ^TMP($J,"HLMAIL")
D ADD("The installation of the Event Monitoring software held in patch")
D ADD("HL*1.6*109 is complete. ")
S XTMP=$O(^XTMP("HLEV INSTALL 9999999.99999"),-1)
I XTMP]"",$D(^XTMP(XTMP)) D MAILMON
;
; Send Mailman message.
S XMDUZ=.5,XMSUB="HL*1.6*109 Installation - Site# "_$P($$SITE^VASITE,U,3)
S XMTEXT="^TMP("_$J_",""HLMAIL"","
S XMY("HL7SystemMonitoring@domain.ext")=""
;
D ^XMD
;
I '$D(ZTQUEUED) W !!,"Setup instructions message #",$G(XMZ)," sent..."
KILL ^TMP($J,"HLMAIL")
;
D DELMON ; Delete monitor(2)...
D DELMGRP ; Delete mail group(s) from monitor(s)...
;
; Start a new master job...
D STARTJOB^HLEVMST
;
Q
;
DELMON ; Delete renamed, or now unwanted official monitors...
N DA,DIE,DR
D DELONE("STUB 870 SEARCH")
D DELONE("XREF CHECK - FILE 772 & 773")
Q
;
DELONE(NAME) ; Delete a monitor...
N DA
QUIT:$G(NAME)']"" ;->
F S DA=+$O(^HLEV(776.1,"B",NAME,0)) Q:'DA D
. N DIK,DR
. S DIK="^HLEV(776.1,"
. D ^DIK
Q
;
LOADPAR ; Load 776.999 file...
QUIT:$G(^HLEV(776.999,1,0))]"" ;->
S $P(^HLEV(776.999,0),U,3)=1,$P(^HLEV(776.999,0),U,4)=1
S ^HLEV(776.999,1,0)="SYSTEM^A^120^96^^A"
S ^HLEV(776.999,"B","SYSTEM",1)=""
Q
;
COMPMON ; Create list of monitors that have been changed...
N DATA,IEN,NM,XTMP
;
S XTMP=$O(^XTMP("HLEV INSTALL 9999999.999999999"),-1)
QUIT:XTMP'["HLEV INSTALL" ;->
;
S IEN=0
F S IEN=$O(^HLEV(776.1,IEN)) Q:IEN'>0 D
. S $P(^XTMP(XTMP,"O",IEN),U,3)=$P($G(^HLEV(776.1,+IEN,0)),U)
. S $P(^XTMP(XTMP,"O",IEN),U,4)=$$IENSUM(IEN)
. S DATA=^XTMP(XTMP,"O",IEN)
. QUIT:$P(DATA,U)'=$P(DATA,U,3) ;-> Names don't match
. QUIT:$P(DATA,U,2)'=$P(DATA,U,4) ;-> Checksums don't match
. KILL ^XTMP(XTMP,"O",IEN)
;
; Rearrange into new and "used" (pre-existing) monitors...
KILL ^XTMP(XTMP,"NEW"),^XTMP(XTMP,"OLD")
S IEN=0
F S IEN=$O(^XTMP(XTMP,"O",IEN)) Q:'IEN D
. S DATA=^XTMP(XTMP,"O",IEN) QUIT:DATA']"" ;->
. S NM=$P(DATA,U,3)
. S:$P(DATA,U)']"" ^XTMP(XTMP,"NEW",NM,IEN)=DATA
. S:$P(DATA,U)]"" ^XTMP(XTMP,"OLD",NM,IEN)=DATA
;
KILL ^XTMP(XTMP,"O")
;
Q
;
ETHL7 ; Check/reset PACKAGE NAME in HL7 Monitor Event Type file (#776.3)...
N DA,DIE,DR,IEN,IENS,PCE
;
S IENS="1^2^3^4^5^6^7^8^9^10^11^12^13^14^15^16^17^18^100^101^102^103^104^105^106^107^108^109^200^201^202^203^204^205^206^207^208^209^210^211^213^214^215^216"
;
F PCE=1:1:$L(IENS,U) D
. S IEN=$P(IENS,U,+PCE) QUIT:$G(^HLEV(776.3,IEN,0))']"" ;->
. S DA=IEN,DIE=776.3,DR=".08///HEALTH LEVEL SEVEN"
. D ^DIE
;
Q
;
MAILMON ; Add to new or changed monitors to mail text...
N HDR,NM,TXT,TYP
;
D ADD(" - New and changed monitors.")
;
S TYPE=""
F S TYPE=$O(^XTMP(XTMP,TYPE)) Q:TYPE']"" D
. D ADD("")
. S HDR=$S(TYPE="OLD":"Monitors changed during installation",TYPE="NEW":"New monitors",1:"") QUIT:HDR']"" ;->
. D ADD(HDR),ADD($$REPEAT^XLFSTR("-",$L(HDR)))
. S NM="",TXT=""
. F S NM=$O(^XTMP(XTMP,TYPE,NM)) Q:NM']"" D
. . S TXT(1)=$E(NM_$$REPEAT^XLFSTR(" ",40),1,35)
. . S TXT=TXT_TXT(1)
. . I $L(TXT)>35 D ADD(TXT) S TXT=""
. I $L(TXT)>0 D ADD(TXT)
;
Q
;
ADD(TXT) ; Add text to ^TMP($J,"HLMAIL")
N NO
S NO=$O(^TMP($J,"HLMAIL",":"),-1)+1
S ^TMP($J,"HLMAIL",+NO)=TXT
Q
;
IENSUM(IEN) ; Checksum of entry...
N ASC,CHAR,LP,POS,ST,SUM,TXT,VAL
S SUM=0
S LP="^HLEV(776.1,"_IEN,ST=LP_",",LP=LP_")"
F S LP=$Q(@LP) Q:LP'[ST D
. S TXT=LP_"="_@LP
. F POS=1:1:$L(TXT) D
. . S CHAR=$E(TXT,POS),ASC=$A(CHAR)
. . S SUM=SUM+(ASC*POS)
Q SUM
;
DELMGRP ; Delete mailgroup in monitor...
N IEN,MIEN
;
; CHECK 773 AC XREF --- @ --- HL7DevelopmentTeam@domain.ext
S IEN=$O(^HLEV(776.1,"B","CHECK 773 AC XREF",0))
S MIEN=$O(^HLEV(776.1,+IEN,62,"B","HL7DevelopmentTeam@domain.ext",0))
D DELGRP1(IEN,MIEN)
;
; LINK (870) CHECKS
S IEN=$O(^HLEV(776.1,"B","LINK (870) CHECKS",0))
S MIEN=$O(^HLEV(776.1,+IEN,62,"B","HL7DevelopmentTeam@domain.ext",0))
D DELGRP1(IEN,MIEN)
;
Q
;
;
DELGRP1(IEN,MIEN) ; Delete one remote mail group...
N DIE,DIE,DR
QUIT:'$D(^HLEV(776.1,+IEN,62,+MIEN,0)) ;->
S DIE="^HLEV(776.1,"_IEN_",62,",DA(1)=IEN,DA=MIEN
S DR=".01///@"
D ^DIE
Q
;
EOR ;HLEVINIT - Event Monitor PRE&POST-INITS ;5/16/03 14:42
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHLP109 5973 printed Dec 13, 2024@01:59:26 Page 2
HLP109 ;ALB/CJM - Post-Install for patch 109 ;06/03/99
+1 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
+2 ;
SETAC ;Used to undo the changes to the "AC" xref, used only if the patch
+1 ;HL*1.6*109 needs to be backed out.
+2 SET ^DD(773,7,1,1,1)="S %=$P(^HLMA(DA,0),U,3) S:%]"""" ^HLMA(""AC"",%,X,DA)="""" I %=""O"",'$D(HLTCPO) D LLCNT^HLCSTCP(X,3)"
+3 SET ^DD(773,7,1,1,2)="S %=$P(^HLMA(DA,0),U,3) K:%]"""" ^HLMA(""AC"",%,X,DA)"
+4 ;S ^DD(773,100,1,1,1)="S ^HLMA(""AD"",X,DA)="""" N %,%1 S %=$G(^HLMA(DA,0)),%1=$P(%,U,3),%=$P(%,U,7) K:%1]""""&% ^HLMA(""AC"",%1,%,DA)"
+5 QUIT
+6 ;
PRE ; Called by KIDS pre-init...
+1 SET ^HLCS(869.3,1,772)=($ORDER(^HL(772,":"),-1)\1)
+2 SET ^HLCS(869.3,1,773)=($ORDER(^HLMA(":"),-1)\1)
+3 DO UNQUEUE^HLEVUTIL
+4 DO LOADMON
+5 ; Make sure every official HL7 entry has PACKAGE NAME...
DO ETHL7
+6 QUIT
+7 ;
LOADMON ; Create a list of monitors in ^XTMP(XTMP,"O")...
+1 NEW NOW,XTMP
+2 SET NOW=$$NOW^XLFDT
+3 SET XTMP="HLEV INSTALL "_NOW
+4 SET ^XTMP(XTMP,0)=$$FMADD^XLFDT(NOW,2)_U_NOW_U_"HLEV INSTALLATION MONITOR LIST"
+5 SET IEN=0
+6 FOR
SET IEN=$ORDER(^HLEV(776.1,IEN))
if 'IEN
QUIT
Begin DoDot:1
+7 SET ^XTMP(XTMP,"O",IEN)=$PIECE($GET(^HLEV(776.1,IEN,0)),U)_U_$$IENSUM(IEN)
End DoDot:1
+8 QUIT
+9 ;
+10 ;
+11 ;
+12 ;
POST ; Called by KIDS post-init...
+1 NEW NO,TEXT,XMDUZ,XMSUB,XMTEXT,XMZ
+2 NEW %KMPRJT,%XX,%ZH0,%ZHFN,C,D0,DA,DG,DICR,DIFRFRV1,DIFROM,DIU,I,IEN
+3 NEW J,X,XG255,XGATRSET,XGCURATR,XGEMPATR,XGPAD,XGRT,XGSCRN
+4 NEW XQCH,ZQJMP,XQSV,XWT,XQUSER,XQZ,Y
+5 NEW XPD,XPD0,XPDA,XPDBLD,XPDCHECK,XPDCP,XPDD,XPDGREF,XPDIDCNT
+6 NEW XPDIDMOD,XPDIDTOT,XPDIDVT,XPDIT,XPDNM,XPDPKG,XPDRTN,XPDSET
+7 NEW XPDSET1,XPDST,XPDT
+8 ;
+9 ; Load 776.999 file entry if needed...
+10 DO LOADPAR
+11 ;
+12 ; Update list of monitors...
+13 DO COMPMON
+14 ;
+15 ; Send email message to DUZ...
+16 KILL ^TMP($JOB,"HLMAIL")
+17 DO ADD("The installation of the Event Monitoring software held in patch")
+18 DO ADD("HL*1.6*109 is complete. ")
+19 SET XTMP=$ORDER(^XTMP("HLEV INSTALL 9999999.99999"),-1)
+20 IF XTMP]""
IF $DATA(^XTMP(XTMP))
DO MAILMON
+21 ;
+22 ; Send Mailman message.
+23 SET XMDUZ=.5
SET XMSUB="HL*1.6*109 Installation - Site# "_$PIECE($$SITE^VASITE,U,3)
+24 SET XMTEXT="^TMP("_$JOB_",""HLMAIL"","
+25 SET XMY("HL7SystemMonitoring@domain.ext")=""
+26 ;
+27 DO ^XMD
+28 ;
+29 IF '$DATA(ZTQUEUED)
WRITE !!,"Setup instructions message #",$GET(XMZ)," sent..."
+30 KILL ^TMP($JOB,"HLMAIL")
+31 ;
+32 ; Delete monitor(2)...
DO DELMON
+33 ; Delete mail group(s) from monitor(s)...
DO DELMGRP
+34 ;
+35 ; Start a new master job...
+36 DO STARTJOB^HLEVMST
+37 ;
+38 QUIT
+39 ;
DELMON ; Delete renamed, or now unwanted official monitors...
+1 NEW DA,DIE,DR
+2 DO DELONE("STUB 870 SEARCH")
+3 DO DELONE("XREF CHECK - FILE 772 & 773")
+4 QUIT
+5 ;
DELONE(NAME) ; Delete a monitor...
+1 NEW DA
+2 ;->
if $GET(NAME)']""
QUIT
+3 FOR
SET DA=+$ORDER(^HLEV(776.1,"B",NAME,0))
if 'DA
QUIT
Begin DoDot:1
+4 NEW DIK,DR
+5 SET DIK="^HLEV(776.1,"
+6 DO ^DIK
End DoDot:1
+7 QUIT
+8 ;
LOADPAR ; Load 776.999 file...
+1 ;->
if $GET(^HLEV(776.999,1,0))]""
QUIT
+2 SET $PIECE(^HLEV(776.999,0),U,3)=1
SET $PIECE(^HLEV(776.999,0),U,4)=1
+3 SET ^HLEV(776.999,1,0)="SYSTEM^A^120^96^^A"
+4 SET ^HLEV(776.999,"B","SYSTEM",1)=""
+5 QUIT
+6 ;
COMPMON ; Create list of monitors that have been changed...
+1 NEW DATA,IEN,NM,XTMP
+2 ;
+3 SET XTMP=$ORDER(^XTMP("HLEV INSTALL 9999999.999999999"),-1)
+4 ;->
if XTMP'["HLEV INSTALL"
QUIT
+5 ;
+6 SET IEN=0
+7 FOR
SET IEN=$ORDER(^HLEV(776.1,IEN))
if IEN'>0
QUIT
Begin DoDot:1
+8 SET $PIECE(^XTMP(XTMP,"O",IEN),U,3)=$PIECE($GET(^HLEV(776.1,+IEN,0)),U)
+9 SET $PIECE(^XTMP(XTMP,"O",IEN),U,4)=$$IENSUM(IEN)
+10 SET DATA=^XTMP(XTMP,"O",IEN)
+11 ;-> Names don't match
if $PIECE(DATA,U)'=$PIECE(DATA,U,3)
QUIT
+12 ;-> Checksums don't match
if $PIECE(DATA,U,2)'=$PIECE(DATA,U,4)
QUIT
+13 KILL ^XTMP(XTMP,"O",IEN)
End DoDot:1
+14 ;
+15 ; Rearrange into new and "used" (pre-existing) monitors...
+16 KILL ^XTMP(XTMP,"NEW"),^XTMP(XTMP,"OLD")
+17 SET IEN=0
+18 FOR
SET IEN=$ORDER(^XTMP(XTMP,"O",IEN))
if 'IEN
QUIT
Begin DoDot:1
+19 ;->
SET DATA=^XTMP(XTMP,"O",IEN)
if DATA']""
QUIT
+20 SET NM=$PIECE(DATA,U,3)
+21 if $PIECE(DATA,U)']""
SET ^XTMP(XTMP,"NEW",NM,IEN)=DATA
+22 if $PIECE(DATA,U)]""
SET ^XTMP(XTMP,"OLD",NM,IEN)=DATA
End DoDot:1
+23 ;
+24 KILL ^XTMP(XTMP,"O")
+25 ;
+26 QUIT
+27 ;
ETHL7 ; Check/reset PACKAGE NAME in HL7 Monitor Event Type file (#776.3)...
+1 NEW DA,DIE,DR,IEN,IENS,PCE
+2 ;
+3 SET IENS="1^2^3^4^5^6^7^8^9^10^11^12^13^14^15^16^17^18^100^101^102^103^104^105^106^107^108^109^200^201^202^203^204^205^206^207^208^209^210^211^213^214^215^216"
+4 ;
+5 FOR PCE=1:1:$LENGTH(IENS,U)
Begin DoDot:1
+6 ;->
SET IEN=$PIECE(IENS,U,+PCE)
if $GET(^HLEV(776.3,IEN,0))']""
QUIT
+7 SET DA=IEN
SET DIE=776.3
SET DR=".08///HEALTH LEVEL SEVEN"
+8 DO ^DIE
End DoDot:1
+9 ;
+10 QUIT
+11 ;
MAILMON ; Add to new or changed monitors to mail text...
+1 NEW HDR,NM,TXT,TYP
+2 ;
+3 DO ADD(" - New and changed monitors.")
+4 ;
+5 SET TYPE=""
+6 FOR
SET TYPE=$ORDER(^XTMP(XTMP,TYPE))
if TYPE']""
QUIT
Begin DoDot:1
+7 DO ADD("")
+8 ;->
SET HDR=$SELECT(TYPE="OLD":"Monitors changed during installation",TYPE="NEW":"New monitors",1:"")
if HDR']""
QUIT
+9 DO ADD(HDR)
DO ADD($$REPEAT^XLFSTR("-",$LENGTH(HDR)))
+10 SET NM=""
SET TXT=""
+11 FOR
SET NM=$ORDER(^XTMP(XTMP,TYPE,NM))
if NM']""
QUIT
Begin DoDot:2
+12 SET TXT(1)=$EXTRACT(NM_$$REPEAT^XLFSTR(" ",40),1,35)
+13 SET TXT=TXT_TXT(1)
+14 IF $LENGTH(TXT)>35
DO ADD(TXT)
SET TXT=""
End DoDot:2
+15 IF $LENGTH(TXT)>0
DO ADD(TXT)
End DoDot:1
+16 ;
+17 QUIT
+18 ;
ADD(TXT) ; Add text to ^TMP($J,"HLMAIL")
+1 NEW NO
+2 SET NO=$ORDER(^TMP($JOB,"HLMAIL",":"),-1)+1
+3 SET ^TMP($JOB,"HLMAIL",+NO)=TXT
+4 QUIT
+5 ;
IENSUM(IEN) ; Checksum of entry...
+1 NEW ASC,CHAR,LP,POS,ST,SUM,TXT,VAL
+2 SET SUM=0
+3 SET LP="^HLEV(776.1,"_IEN
SET ST=LP_","
SET LP=LP_")"
+4 FOR
SET LP=$QUERY(@LP)
if LP'[ST
QUIT
Begin DoDot:1
+5 SET TXT=LP_"="_@LP
+6 FOR POS=1:1:$LENGTH(TXT)
Begin DoDot:2
+7 SET CHAR=$EXTRACT(TXT,POS)
SET ASC=$ASCII(CHAR)
+8 SET SUM=SUM+(ASC*POS)
End DoDot:2
End DoDot:1
+9 QUIT SUM
+10 ;
DELMGRP ; Delete mailgroup in monitor...
+1 NEW IEN,MIEN
+2 ;
+3 ; CHECK 773 AC XREF --- @ --- HL7DevelopmentTeam@domain.ext
+4 SET IEN=$ORDER(^HLEV(776.1,"B","CHECK 773 AC XREF",0))
+5 SET MIEN=$ORDER(^HLEV(776.1,+IEN,62,"B","HL7DevelopmentTeam@domain.ext",0))
+6 DO DELGRP1(IEN,MIEN)
+7 ;
+8 ; LINK (870) CHECKS
+9 SET IEN=$ORDER(^HLEV(776.1,"B","LINK (870) CHECKS",0))
+10 SET MIEN=$ORDER(^HLEV(776.1,+IEN,62,"B","HL7DevelopmentTeam@domain.ext",0))
+11 DO DELGRP1(IEN,MIEN)
+12 ;
+13 QUIT
+14 ;
+15 ;
DELGRP1(IEN,MIEN) ; Delete one remote mail group...
+1 NEW DIE,DIE,DR
+2 ;->
if '$DATA(^HLEV(776.1,+IEN,62,+MIEN,0))
QUIT
+3 SET DIE="^HLEV(776.1,"_IEN_",62,"
SET DA(1)=IEN
SET DA=MIEN
+4 SET DR=".01///@"
+5 DO ^DIE
+6 QUIT
+7 ;
EOR ;HLEVINIT - Event Monitor PRE&POST-INITS ;5/16/03 14:42