HLEMSL ;ALB/CJM -List Manager Screen for Event List;12 JUN 1997 10:00 am
;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13,1995
;
EN ;Entry point to viewing the HL7 Monitor Event Log
;
N IDX,SITE,PROFILE
S PROFILE=$$PROFILE
Q:'PROFILE
I PROFILE S PROFILE=$$GET^HLEMP(PROFILE,.PROFILE)
;
S IDX="^TMP(""HLEM"",$J,""EVENTS"")"
D WAIT^DICD
D EN^VALM("HLEM DISPLAY EVENTS")
Q
;
PROFILE() ;returns the profile to use in building the display.
; 1)First checks if there is a default profile, if so,returns it
; 2)If no default profile, but the user has exactly 1 profile, ruturs that
; 3) If multiple profiles, asks the user to select one.
; 4) If the user has no profile, he is asked to create one.
;Input: DUZ must be defined
;Output: function returns profile's ien, or "" if not successful
;
N PROFILE
;get the user's profile
I '$G(DUZ) W !,"** Your DUZ is not defined, please report this to your IRM!" Q ""
S PROFILE=$$FDEFAULT^HLEMP(DUZ)
I 'PROFILE D
.;there is no default profile, check for others
.S PROFILE=$$SELECT^HLEMP1($G(DUZ),10)
I 'PROFILE,$$ASKYESNO^HLEMU("You need a profile before viewing the HL7 Monitor Event Log,would you like to create a new profile now","YES") D
.N NAME,I
.F I=1:1:20 I '$D(^HLEV(776.5,"C",DUZ,"NEW PROFILE"_I)) S NAME="NEW PROFILE"_I Q
.S:$D(NAME) PROFILE=$$CREATE^HLEMP(DUZ,NAME)
.I PROFILE,'$$EDIT^HLEMP(PROFILE) D
..I '$$DELETE^HLEMP(PROFILE) W !,"Incomplete profile couln't be deleted!"
..S PROFILE=""
Q PROFILE
;
HDR ;Header code
S VALMHDR(1)="# TYPE DT/TM APP MSG REVIEW CNT"
Q
;
INIT ;Init variables and list array
D BLD
S VALMSG="USER PROFILE: "_PROFILE("NAME")
D HDR
S VALMBCK="R"
Q
;
BLD ;Build event log screen
D CLEAN^VALM10
N SITE,TIME,TYPE,STATUS,COUNT
K @IDX,VALMHDR
S VALMBG=1,(COUNT,VALMCNT)=0
;
;Build header
D HDR
;
;Build list area
;what sites to include? Put in alphabetical order
S SITE="" F S SITE=$O(^HLEV(776.4,"D",SITE)) Q:'SITE D
.I 'PROFILE("ALL SITES"),'$D(PROFILE("SITES",SITE)) Q
.N STATION
.S STATION=$$STATION^HLEMSU(SITE) S:$L($P(STATION,"^")) SITE($P(STATION,"^"))=SITE
;
S SITE=""
F S SITE=$O(SITE(SITE)) Q:'$L(SITE) D
.N FIRST
.S FIRST=1
.S TYPE=0
.F S TYPE=$O(^HLEV(776.4,"D",SITE(SITE),TYPE)) Q:'TYPE D:(PROFILE("ALL TYPES"))!($D(PROFILE("TYPES",TYPE)))
..;maintain an index for the event type
..S @IDX@("SITE",SITE(SITE),"TYPE",TYPE)=VALMCNT
..S TIME=PROFILE("START")
..F S TIME=$O(^HLEV(776.4,"D",SITE(SITE),TYPE,TIME)) Q:'TIME D
...S STATUS=""
...S STATUS=$O(^HLEV(776.4,"D",SITE(SITE),TYPE,TIME,STATUS)) Q:'$L(STATUS) D
....N EVENTIEN
....S EVENTIEN=0
....F S EVENTIEN=$O(^HLEV(776.4,"D",SITE(SITE),TYPE,TIME,STATUS,EVENTIEN)) Q:'EVENTIEN D
.....N EVENT
.....Q:'$$GET^HLEME(EVENTIEN,.EVENT)
.....I PROFILE("URGENT"),'EVENT("URGENT") Q
.....I 'PROFILE("ALL APPS") Q:'$L(EVENT("APPLICATION")) Q:'$D(PROFILE(EVENT("APPLICATION")))
.....;
.....;if this is the first event for this site,display a header
.....I FIRST D S FIRST=0
......;S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$CENTER^HLEMSU("SITE: "_SITE_" STATION #: "_$P($$STATION^HLEMSU(SITE(SITE)),"^",2)),1,"RUH")
......I $$SET^HLEMSU(VALMCNT,$$LJ^XLFSTR($E($G(@IDX@(VALMCNT,0)),4,80),77),4,"U")
......S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),SITE_" STATION #: "_$P($$STATION^HLEMSU(SITE(SITE)),"^",2),1,"H")
......;also, maintain an index for searching
......S @IDX@("SITE",SITE(SITE))=VALMCNT
......S @IDX@("SITE",SITE)=VALMCNT
.....;
.....;display the event
.....D DISPLAY(.EVENT,.VALMCNT,.COUNT)
Q
;
DISPLAY(EVENT,VALMCNT,COUNT) ;
;Adds one line for an event to the list, increments the counts of lines and events, and maintains the search index for events on the list
;
N CODE,TIME
S @IDX@("EVENT",$$INC^HLEMU(.COUNT))=EVENT("IEN")
S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),COUNT,1,"R")
S VALMCNT=$$SET^HLEMSU(VALMCNT,$$CODE^HLEMT(EVENT("TYPE")),6)
S VALMCNT=$$SET^HLEMSU(VALMCNT,$$FMTE^XLFDT($E(EVENT("DT/TM"),1,12),2),17)
S VALMCNT=$$SET^HLEMSU(VALMCNT,$E(EVENT("APPLICATION"),1,15),32)
I $L(EVENT("MSG TYPE")) S VALMCNT=$$SET^HLEMSU(VALMCNT,EVENT("MSG TYPE")_"~"_EVENT("MSG EVENT"),48)
S VALMCNT=$$SET^HLEMSU(VALMCNT,$E($$EXTERNAL^DILFD(776.4,.06,"F",EVENT("REVIEW STATUS")),1,15),57)
I EVENT("COUNT")>1 S VALNCNT=$$SET^HLEMSU(VALMCNT,EVENT("COUNT"),72)
I EVENT("URGENT") S VALMCNT=$$SET^HLEMSU(VALMCNT,"*",79,"BRH")
Q
;
HELP ;Help code
S X="?" D DISP^XQORM1 W !!
Q
;
EXIT ;Exit code
D CLEAN^VALM10
D CLEAR^VALM1
K @IDX
Q
;
EXPND ;Expand code
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHLEMSL 4689 printed Oct 16, 2024@17:58:20 Page 2
HLEMSL ;ALB/CJM -List Manager Screen for Event List;12 JUN 1997 10:00 am
+1 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13,1995
+2 ;
EN ;Entry point to viewing the HL7 Monitor Event Log
+1 ;
+2 NEW IDX,SITE,PROFILE
+3 SET PROFILE=$$PROFILE
+4 if 'PROFILE
QUIT
+5 IF PROFILE
SET PROFILE=$$GET^HLEMP(PROFILE,.PROFILE)
+6 ;
+7 SET IDX="^TMP(""HLEM"",$J,""EVENTS"")"
+8 DO WAIT^DICD
+9 DO EN^VALM("HLEM DISPLAY EVENTS")
+10 QUIT
+11 ;
PROFILE() ;returns the profile to use in building the display.
+1 ; 1)First checks if there is a default profile, if so,returns it
+2 ; 2)If no default profile, but the user has exactly 1 profile, ruturs that
+3 ; 3) If multiple profiles, asks the user to select one.
+4 ; 4) If the user has no profile, he is asked to create one.
+5 ;Input: DUZ must be defined
+6 ;Output: function returns profile's ien, or "" if not successful
+7 ;
+8 NEW PROFILE
+9 ;get the user's profile
+10 IF '$GET(DUZ)
WRITE !,"** Your DUZ is not defined, please report this to your IRM!"
QUIT ""
+11 SET PROFILE=$$FDEFAULT^HLEMP(DUZ)
+12 IF 'PROFILE
Begin DoDot:1
+13 ;there is no default profile, check for others
+14 SET PROFILE=$$SELECT^HLEMP1($GET(DUZ),10)
End DoDot:1
+15 IF 'PROFILE
IF $$ASKYESNO^HLEMU("You need a profile before viewing the HL7 Monitor Event Log,would you like to create a new profile now","YES")
Begin DoDot:1
+16 NEW NAME,I
+17 FOR I=1:1:20
IF '$DATA(^HLEV(776.5,"C",DUZ,"NEW PROFILE"_I))
SET NAME="NEW PROFILE"_I
QUIT
+18 if $DATA(NAME)
SET PROFILE=$$CREATE^HLEMP(DUZ,NAME)
+19 IF PROFILE
IF '$$EDIT^HLEMP(PROFILE)
Begin DoDot:2
+20 IF '$$DELETE^HLEMP(PROFILE)
WRITE !,"Incomplete profile couln't be deleted!"
+21 SET PROFILE=""
End DoDot:2
End DoDot:1
+22 QUIT PROFILE
+23 ;
HDR ;Header code
+1 SET VALMHDR(1)="# TYPE DT/TM APP MSG REVIEW CNT"
+2 QUIT
+3 ;
INIT ;Init variables and list array
+1 DO BLD
+2 SET VALMSG="USER PROFILE: "_PROFILE("NAME")
+3 DO HDR
+4 SET VALMBCK="R"
+5 QUIT
+6 ;
BLD ;Build event log screen
+1 DO CLEAN^VALM10
+2 NEW SITE,TIME,TYPE,STATUS,COUNT
+3 KILL @IDX,VALMHDR
+4 SET VALMBG=1
SET (COUNT,VALMCNT)=0
+5 ;
+6 ;Build header
+7 DO HDR
+8 ;
+9 ;Build list area
+10 ;what sites to include? Put in alphabetical order
+11 SET SITE=""
FOR
SET SITE=$ORDER(^HLEV(776.4,"D",SITE))
if 'SITE
QUIT
Begin DoDot:1
+12 IF 'PROFILE("ALL SITES")
IF '$DATA(PROFILE("SITES",SITE))
QUIT
+13 NEW STATION
+14 SET STATION=$$STATION^HLEMSU(SITE)
if $LENGTH($PIECE(STATION,"^"))
SET SITE($PIECE(STATION,"^"))=SITE
End DoDot:1
+15 ;
+16 SET SITE=""
+17 FOR
SET SITE=$ORDER(SITE(SITE))
if '$LENGTH(SITE)
QUIT
Begin DoDot:1
+18 NEW FIRST
+19 SET FIRST=1
+20 SET TYPE=0
+21 FOR
SET TYPE=$ORDER(^HLEV(776.4,"D",SITE(SITE),TYPE))
if 'TYPE
QUIT
if (PROFILE("ALL TYPES"))!($DATA(PROFILE("TYPES",TYPE)))
Begin DoDot:2
+22 ;maintain an index for the event type
+23 SET @IDX@("SITE",SITE(SITE),"TYPE",TYPE)=VALMCNT
+24 SET TIME=PROFILE("START")
+25 FOR
SET TIME=$ORDER(^HLEV(776.4,"D",SITE(SITE),TYPE,TIME))
if 'TIME
QUIT
Begin DoDot:3
+26 SET STATUS=""
+27 SET STATUS=$ORDER(^HLEV(776.4,"D",SITE(SITE),TYPE,TIME,STATUS))
if '$LENGTH(STATUS)
QUIT
Begin DoDot:4
+28 NEW EVENTIEN
+29 SET EVENTIEN=0
+30 FOR
SET EVENTIEN=$ORDER(^HLEV(776.4,"D",SITE(SITE),TYPE,TIME,STATUS,EVENTIEN))
if 'EVENTIEN
QUIT
Begin DoDot:5
+31 NEW EVENT
+32 if '$$GET^HLEME(EVENTIEN,.EVENT)
QUIT
+33 IF PROFILE("URGENT")
IF 'EVENT("URGENT")
QUIT
+34 IF 'PROFILE("ALL APPS")
if '$LENGTH(EVENT("APPLICATION"))
QUIT
if '$DATA(PROFILE(EVENT("APPLICATION")))
QUIT
+35 ;
+36 ;if this is the first event for this site,display a header
+37 IF FIRST
Begin DoDot:6
+38 ;S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$CENTER^HLEMSU("SITE: "_SITE_" STATION #: "_$P($$STATION^HLEMSU(SITE(SITE)),"^",2)),1,"RUH")
+39 IF $$SET^HLEMSU(VALMCNT,$$LJ^XLFSTR($EXTRACT($GET(@IDX@(VALMCNT,0)),4,80),77),4,"U")
+40 SET VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),SITE_" STATION #: "_$PIECE($$STATION^HLEMSU(SITE(SITE)),"^",2),1,"H")
+41 ;also, maintain an index for searching
+42 SET @IDX@("SITE",SITE(SITE))=VALMCNT
+43 SET @IDX@("SITE",SITE)=VALMCNT
End DoDot:6
SET FIRST=0
+44 ;
+45 ;display the event
+46 DO DISPLAY(.EVENT,.VALMCNT,.COUNT)
End DoDot:5
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+47 QUIT
+48 ;
DISPLAY(EVENT,VALMCNT,COUNT) ;
+1 ;Adds one line for an event to the list, increments the counts of lines and events, and maintains the search index for events on the list
+2 ;
+3 NEW CODE,TIME
+4 SET @IDX@("EVENT",$$INC^HLEMU(.COUNT))=EVENT("IEN")
+5 SET VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),COUNT,1,"R")
+6 SET VALMCNT=$$SET^HLEMSU(VALMCNT,$$CODE^HLEMT(EVENT("TYPE")),6)
+7 SET VALMCNT=$$SET^HLEMSU(VALMCNT,$$FMTE^XLFDT($EXTRACT(EVENT("DT/TM"),1,12),2),17)
+8 SET VALMCNT=$$SET^HLEMSU(VALMCNT,$EXTRACT(EVENT("APPLICATION"),1,15),32)
+9 IF $LENGTH(EVENT("MSG TYPE"))
SET VALMCNT=$$SET^HLEMSU(VALMCNT,EVENT("MSG TYPE")_"~"_EVENT("MSG EVENT"),48)
+10 SET VALMCNT=$$SET^HLEMSU(VALMCNT,$EXTRACT($$EXTERNAL^DILFD(776.4,.06,"F",EVENT("REVIEW STATUS")),1,15),57)
+11 IF EVENT("COUNT")>1
SET VALNCNT=$$SET^HLEMSU(VALMCNT,EVENT("COUNT"),72)
+12 IF EVENT("URGENT")
SET VALMCNT=$$SET^HLEMSU(VALMCNT,"*",79,"BRH")
+13 QUIT
+14 ;
HELP ;Help code
+1 SET X="?"
DO DISP^XQORM1
WRITE !!
+2 QUIT
+3 ;
EXIT ;Exit code
+1 DO CLEAN^VALM10
+2 DO CLEAR^VALM1
+3 KILL @IDX
+4 QUIT
+5 ;
EXPND ;Expand code
+1 QUIT