source: WorldVistAEHR/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLEMRCV.m@ 1261

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

initial load of WorldVistAEHR

File size: 2.3 KB
Line 
1HLEMRCV ;ALB/CJM - Mailman server for HL7 Monitoring Events;12 JUN 1997 10:00 am
2 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13,1995
3 ;
4RECEIVE ;Description: Read the exception message and file it.
5 ;!!!! for testing interactively !!!!!!!!!!!!
6 ;S XMER=0
7 ;S XMFROM="HL7 EVENT LOG AT SAN FRANCISCO"
8 ;S XMPOS=0
9 ;S XMREC="D REC^XMS3"
10 ;S XMRG="**APPLICATION DATA**"
11 ;S XMXX="S.HLEM EVENT LOG SERVER"
12 ;S XMZ=8557
13 ;!!!!!!
14 ;
15 N EVENT,EXIT,TEMP
16 S EXIT=0
17 F X XMREC Q:(XMER<0) D Q:EXIT
18 .I $E(XMRG,1,2)="**" S EXIT=1 Q
19 .N LABEL,DATA
20 .S LABEL=$P(XMRG,":"),DATA=$P(XMRG,":",2,99)
21 .Q:'$L(LABEL)
22 .S EVENT(LABEL)=DATA
23 ;
24 ;don't save IEN from sending site
25 K EVENT("IEN")
26 ;
27 ;need to get local pointers
28 ;event type
29 S:$D(EVENT("TYPE")) TEMP=$$FIND^HLEMT($P($G(EVENT("TYPE")),"^",2),$P($G(EVENT("TYPE")),"^"))
30 I '$G(TEMP) D ERROR("UNKNOWN EVENT TYPE AT REMOTE SITE: "_EVENT("TYPE"),XMZ) Q
31 S EVENT("TYPE")=TEMP
32 ;get the institution ien
33 S:$D(EVENT("SITE")) EVENT("SITE")=$$INSTIEN^HLEMU(EVENT("SITE"))
34 ;
35 ;don't enter duplicates (no updating at present)
36 I $L($G(EVENT("ID"))),$D(^HLEV(776.4,"C",EVENT("ID"))) Q
37 ;
38 ;establish this event on this system
39 S EVENT=$$STORE^HLEME1(.EVENT,.ERROR)
40 ;
41 ;if successful
42 I EVENT D
43 .;add a note with the ien of the message for traceability
44 .I $$ADDNOTE^HLEME(EVENT,"REMOTE EVENT ADDED BY SERVER AT "_$$NOW^XLFDT_", MAILMAN MESSAGE IEN: "_$G(XMZ))
45 ;
46 ;if not successful
47 I 'EVENT D ERROR("Fileman Failed to store remote event: "_$G(ERROR),$G(XMZ)) Q
48 ;
49 ;handle application data
50 I $E(XMRG,1,4)="**AP" D
51 .S EXIT=0
52 .F X XMREC Q:(XMER<0) D Q:EXIT
53 ..I $E(XMRG,1,4)="**NO" S EXIT=1 Q
54 ..N VAR
55 ..I $P(XMRG,":")="VARIABLE" D
56 ...S VAR=$P(XMRG,":",2)
57 ...X XMREC
58 ...I $P(XMRG,":")="VALUE" S @VAR=$P(XMRG,":",2,99) I $$STOREVAR^HLEME(EVENT,.@VAR,VAR)
59 ;
60 ;handle notes
61 I $E(XMRG,1,4)="**NO" D
62 .S EXIT=0
63 .F X XMREC Q:(XMER<0) D Q:EXIT
64 ..N VAR
65 ..I $P(XMRG,":")="VAR" D
66 ...S VAR=$P(XMRG,":",2)
67 ...X XMREC
68 ...I $L(XMRG) D
69 ..I $$ADDNOTE^HLEME(EVENT,XMRG)
70 ;
71 S XMSER="S.HLEM EVENT LOG SERVER"
72 D REMSBMSG^XMA1C
73 Q
74 ;
75ERROR(COMMENT,MAIL) ;
76 ;establishes a new event if this routine encounters an error.
77 ;MAIL is the message id of the MailMan mesage
78 ;
79 N NEWEVENT,VAR
80 S NEWEVENT=$$EVENT^HLEME("SRVR ERROR","HEALTH LEVEL SEVEN")
81 S VAR("MAIL IEN")=$G(MAIL)
82 I $$STOREVAR^HLEME(NEWEVENT,.VAR)
83 I $$ADDNOTE^HLEME(NEWEVENT,$G(COMMENT))
84 Q
Note: See TracBrowser for help on using the repository browser.