source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SCMCHLL.m@ 1499

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

initial load of FOIAVistA 6/30/08 version

File size: 2.7 KB
Line 
1SCMCHLL ;BP/DJB - PCMM HL7 Log Transmission ; 3/2/00 12:59pm
2 ;;5.3;Scheduling;**210,272**;AUG 13, 1993
3 ;
4LOG ;Record HL7 messages in PCMM HL7 TRANSMISSION LOG file.
5 ;Parse the HL7 array and build an array in ^TMP("PCMM","LOG",$J) and
6 ;use to record transmissions.
7 ;
8 NEW FS,MSGID,TDATE
9 ;
10 ;Initialize variables
11 KILL ^TMP("PCMM","LOG",$J)
12 S FS=HL("FS") ;........................Field separator
13 S MSGID=$P(HLRESLT,"^",1) Q:'MSGID ;..Message ID
14 S TDATE=$$NOW^XLFDT ;..................Transmission date
15 S ^TMP("PCMM","LOG",$J,"MSGID")=MSGID
16 S ^TMP("PCMM","LOG",$J,"DT")=TDATE
17 ;
18 D GETDATA ;..Get data from HL7 message array
19 D ADD ;......Create entry in Transmission Log and stuff data
20 ;
21 KILL ^TMP("PCMM","LOG",$J)
22 Q
23 ;
24GETDATA ;Go thru HL7 array and build array of data in ^TMP("PCMM","LOG",$J).
25 NEW CNT,DATA,DFN,SEG,SEQ,ZPCID
26 S CNT=""
27 F S CNT=$O(^TMP("HLS",$J,CNT)) Q:'CNT D ;
28 . S DATA=$G(^(CNT)) Q:DATA=""
29 . S SEG=$P(DATA,FS,1)
30 . ;
31 . ;PID segment - Get patient DFN
32 . I SEG="PID" D Q
33 . . S DFN=+$P(DATA,U,4)
34 . . S ^TMP("PCMM","LOG",$J,"DFN")=DFN
35 . ;
36 . ;ZPC segment - Get sequence # and ZPC ID.
37 . I SEG="ZPC" D Q
38 . . S SEQ=$P(DATA,U,8)
39 . . S ZPCID=$P(DATA,U,2)
40 . . S ^TMP("PCMM","LOG",$J,"ZPC",SEQ)=ZPCID
41 Q
42 ;
43ADD ;Process data array built in GETDATA
44 NEW TRANI
45 S TRANI=$$CREATE(^TMP("PCMM","LOG",$J,"MSGID")) ;..Create new entry
46 Q:+TRANI<0
47 D STORE(TRANI) ;..Store transmission info
48 Q
49 ;
50CREATE(MSGID) ;Create new entry
51 ; Input: Message Control ID
52 ;Output: Pointer to entry in PCMM HL7 TRANSMISSION LOG (#404.471)
53 ; -1^Error - Unable to create entry
54 ;
55 NEW SCERR,SCFDA,SCIEN
56 S SCFDA(404.471,"+1,",.01)=MSGID
57 D UPDATE^DIE("E","SCFDA","SCIEN","SCERR")
58 I $D(SCERR) Q "-1^Unable to create entry in file #404.471"
59 Q SCIEN(1)
60 ;
61STORE(TRANI) ;Store data
62 ;
63 ; Input: TRANI - Pointer PCMM HL7 TRANSMISSION LOG file (#404.471)
64 ;Output: None
65 ;
66 NEW CNT,SCERR,SCIEN,SCIENS,SCIENS1,SCFDA,SEQ,ZPCID
67 ;
68 ;Check input
69 Q:'+$G(TRANI)
70 Q:'$D(^SCPT(404.471,TRANI))
71 ;
72 S SCIENS=TRANI_","
73 S SCFDA(404.471,SCIENS,.02)=$G(^TMP("PCMM","LOG",$J,"DFN")) ;Patient
74 S SCFDA(404.471,SCIENS,.03)=$G(^TMP("PCMM","LOG",$J,"DT")) ;.Date
75 S SCFDA(404.471,SCIENS,.04)="T" ;........................Status
76 I $G(WORK),'SCFDA(404.471,SCIENS,.02) D
77 .S SCFDA(404.471,SCIENS,.07)=$G(VARPTR)
78 .I $G(VARPTR)[404.52 S SCFDA(404.471,SCIENS,.08)=$P($G(^SCTM(404.52,+VARPTR,0)),U,3)
79 D FILE^DIE("I","SCFDA","SCERR")
80 KILL SCFDA,SCERR
81 ;
82 ;Fill in ZPC multiple
83 S (CNT,SEQ)=0
84 F S SEQ=$O(^TMP("PCMM","LOG",$J,"ZPC",SEQ)) Q:'SEQ D ;
85 . S ZPCID=$$CONVERT^SCMCHLRI($G(^(SEQ)))
86 . S CNT=CNT+1
87 . S SCIENS1="+"_CNT_","_SCIENS
88 . S SCFDA(404.47141,SCIENS1,.01)=SEQ
89 . S SCFDA(404.47141,SCIENS1,.02)=ZPCID
90 . D UPDATE^DIE("","SCFDA","SCIEN","SCERR")
91 . ;I $D(SCERR) ZW SCERR
92 Q
Note: See TracBrowser for help on using the repository browser.