source: WorldVistAEHR/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLEMSL.m@ 1200

Last change on this file since 1200 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1HLEMSL ;ALB/CJM -List Manager Screen for Event List;12 JUN 1997 10:00 am
2 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13,1995
3 ;
4EN ;Entry point to viewing the HL7 Monitor Event Log
5 ;
6 N IDX,SITE,PROFILE
7 S PROFILE=$$PROFILE
8 Q:'PROFILE
9 I PROFILE S PROFILE=$$GET^HLEMP(PROFILE,.PROFILE)
10 ;
11 S IDX="^TMP(""HLEM"",$J,""EVENTS"")"
12 D WAIT^DICD
13 D EN^VALM("HLEM DISPLAY EVENTS")
14 Q
15 ;
16PROFILE() ;returns the profile to use in building the display.
17 ; 1)First checks if there is a default profile, if so,returns it
18 ; 2)If no default profile, but the user has exactly 1 profile, ruturs that
19 ; 3) If multiple profiles, asks the user to select one.
20 ; 4) If the user has no profile, he is asked to create one.
21 ;Input: DUZ must be defined
22 ;Output: function returns profile's ien, or "" if not successful
23 ;
24 N PROFILE
25 ;get the user's profile
26 I '$G(DUZ) W !,"** Your DUZ is not defined, please report this to your IRM!" Q ""
27 S PROFILE=$$FDEFAULT^HLEMP(DUZ)
28 I 'PROFILE D
29 .;there is no default profile, check for others
30 .S PROFILE=$$SELECT^HLEMP1($G(DUZ),10)
31 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
32 .N NAME,I
33 .F I=1:1:20 I '$D(^HLEV(776.5,"C",DUZ,"NEW PROFILE"_I)) S NAME="NEW PROFILE"_I Q
34 .S:$D(NAME) PROFILE=$$CREATE^HLEMP(DUZ,NAME)
35 .I PROFILE,'$$EDIT^HLEMP(PROFILE) D
36 ..I '$$DELETE^HLEMP(PROFILE) W !,"Incomplete profile couln't be deleted!"
37 ..S PROFILE=""
38 Q PROFILE
39 ;
40HDR ;Header code
41 S VALMHDR(1)="# TYPE DT/TM APP MSG REVIEW CNT"
42 Q
43 ;
44INIT ;Init variables and list array
45 D BLD
46 S VALMSG="USER PROFILE: "_PROFILE("NAME")
47 D HDR
48 S VALMBCK="R"
49 Q
50 ;
51BLD ;Build event log screen
52 D CLEAN^VALM10
53 N SITE,TIME,TYPE,STATUS,COUNT
54 K @IDX,VALMHDR
55 S VALMBG=1,(COUNT,VALMCNT)=0
56 ;
57 ;Build header
58 D HDR
59 ;
60 ;Build list area
61 ;what sites to include? Put in alphabetical order
62 S SITE="" F S SITE=$O(^HLEV(776.4,"D",SITE)) Q:'SITE D
63 .I 'PROFILE("ALL SITES"),'$D(PROFILE("SITES",SITE)) Q
64 .N STATION
65 .S STATION=$$STATION^HLEMSU(SITE) S:$L($P(STATION,"^")) SITE($P(STATION,"^"))=SITE
66 ;
67 S SITE=""
68 F S SITE=$O(SITE(SITE)) Q:'$L(SITE) D
69 .N FIRST
70 .S FIRST=1
71 .S TYPE=0
72 .F S TYPE=$O(^HLEV(776.4,"D",SITE(SITE),TYPE)) Q:'TYPE D:(PROFILE("ALL TYPES"))!($D(PROFILE("TYPES",TYPE)))
73 ..;maintain an index for the event type
74 ..S @IDX@("SITE",SITE(SITE),"TYPE",TYPE)=VALMCNT
75 ..S TIME=PROFILE("START")
76 ..F S TIME=$O(^HLEV(776.4,"D",SITE(SITE),TYPE,TIME)) Q:'TIME D
77 ...S STATUS=""
78 ...S STATUS=$O(^HLEV(776.4,"D",SITE(SITE),TYPE,TIME,STATUS)) Q:'$L(STATUS) D
79 ....N EVENTIEN
80 ....S EVENTIEN=0
81 ....F S EVENTIEN=$O(^HLEV(776.4,"D",SITE(SITE),TYPE,TIME,STATUS,EVENTIEN)) Q:'EVENTIEN D
82 .....N EVENT
83 .....Q:'$$GET^HLEME(EVENTIEN,.EVENT)
84 .....I PROFILE("URGENT"),'EVENT("URGENT") Q
85 .....I 'PROFILE("ALL APPS") Q:'$L(EVENT("APPLICATION")) Q:'$D(PROFILE(EVENT("APPLICATION")))
86 .....;
87 .....;if this is the first event for this site,display a header
88 .....I FIRST D S FIRST=0
89 ......;S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$CENTER^HLEMSU("SITE: "_SITE_" STATION #: "_$P($$STATION^HLEMSU(SITE(SITE)),"^",2)),1,"RUH")
90 ......I $$SET^HLEMSU(VALMCNT,$$LJ^XLFSTR($E($G(@IDX@(VALMCNT,0)),4,80),77),4,"U")
91 ......S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),SITE_" STATION #: "_$P($$STATION^HLEMSU(SITE(SITE)),"^",2),1,"H")
92 ......;also, maintain an index for searching
93 ......S @IDX@("SITE",SITE(SITE))=VALMCNT
94 ......S @IDX@("SITE",SITE)=VALMCNT
95 .....;
96 .....;display the event
97 .....D DISPLAY(.EVENT,.VALMCNT,.COUNT)
98 Q
99 ;
100DISPLAY(EVENT,VALMCNT,COUNT) ;
101 ;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
102 ;
103 N CODE,TIME
104 S @IDX@("EVENT",$$INC^HLEMU(.COUNT))=EVENT("IEN")
105 S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),COUNT,1,"R")
106 S VALMCNT=$$SET^HLEMSU(VALMCNT,$$CODE^HLEMT(EVENT("TYPE")),6)
107 S VALMCNT=$$SET^HLEMSU(VALMCNT,$$FMTE^XLFDT($E(EVENT("DT/TM"),1,12),2),17)
108 S VALMCNT=$$SET^HLEMSU(VALMCNT,$E(EVENT("APPLICATION"),1,15),32)
109 I $L(EVENT("MSG TYPE")) S VALMCNT=$$SET^HLEMSU(VALMCNT,EVENT("MSG TYPE")_"~"_EVENT("MSG EVENT"),48)
110 S VALMCNT=$$SET^HLEMSU(VALMCNT,$E($$EXTERNAL^DILFD(776.4,.06,"F",EVENT("REVIEW STATUS")),1,15),57)
111 I EVENT("COUNT")>1 S VALNCNT=$$SET^HLEMSU(VALMCNT,EVENT("COUNT"),72)
112 I EVENT("URGENT") S VALMCNT=$$SET^HLEMSU(VALMCNT,"*",79,"BRH")
113 Q
114 ;
115HELP ;Help code
116 S X="?" D DISP^XQORM1 W !!
117 Q
118 ;
119EXIT ;Exit code
120 D CLEAN^VALM10
121 D CLEAR^VALM1
122 K @IDX
123 Q
124 ;
125EXPND ;Expand code
126 Q
Note: See TracBrowser for help on using the repository browser.