source: FOIAVistA/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUHUIHL7.m@ 677

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

initial load of FOIAVistA 6/30/08 version

File size: 3.2 KB
Line 
1XUHUIHL7 ;OAKCIOFO/JG - HL7 GENERATION ROUTINE; 06/010/2002
2 ;;8.0;KERNEL;**239**;JUL 10, 1995
3 ; Supported by IA#3589
4 ; This routine generates an HL7 MFN Staff message based on data
5 ; passed by the XUHUI FIELD CHANGE EVENT protocol to the XUHUI SEND HL7
6 ; MSG protocol. This data is based on change in value of fields in the
7 ; NEW PERSON (#200) file and in the the KEY (#200.051) multiple.
8 ; The following fields are monitored for the NEW PERSON file:
9 ; .01 NAME
10 ; 9.2 TERMINATION DATE
11 ; 5 DOB
12 ; 9 SSN
13 ; The Provider key is monitored for the KEY subfile.
14 ;
15 ; Input:
16 ; XUHUIXR - Name of xref being passed by protocols
17 ; "AXUHUI": file 200 updated;
18 ; "AXUHUIKEY": file 200.051 updated
19 ; XUHUIA - "S": logic executed; "K": kill logic executed
20 ; XUHUIX2 - X2 array with file 200 content
21 ; XUHUIDA - DA array
22 ;
23 ; Output: none
24 ; Postcondition:
25 ; - An HL7 MFN message is generated that contains the structure
26 ; MSH MFI MFE STF
27 ;
28 N XUHUIERR,NAME,SSN,DOB,TERMDATE,ACTIVE
29 Q:XUHUIXR'["AXUHUI"
30 I XUHUIXR="AXUHUI" D F200
31 I XUHUIXR="AXUHUIKEY" D FKEY
32 Q:$G(XUHUIERR)
33 D SENDMSG
34 Q
35 ;
36F200 ; NEW PERSON file was updated
37 ; XUHUIX2(1)=NAME
38 ; XUHUIX2(2)=TERMINATION DATE
39 ; XUHUIX2(3)=DOB
40 ; XUHUIX2(4)=SSN
41 ; XUHUIDA=file 200 ien
42 I '$D(XUHUIX2) S XUHUIERR="1^no XUHUIX2 array" Q
43 S IEN=XUHUIDA
44 ; TERMINATION DATE determines Active/Inactive
45 S ACTIVE=$S($G(XUHUIX2(2))]"":"I",1:"A")
46 ; get newest values for name, ssn, dob, and termination date
47 S NAME=$S($G(XUHUIX2(1))="":"""""",1:XUHUIX2(1))
48 S SSN=$S($G(XUHUIX2(4))="":"""""",1:XUHUIX2(4))
49 S DOB=$$FMTHL7^XLFDT($G(XUHUIX2(3)))
50 S DOB=$S(DOB="":"""""",1:DOB)
51 S TERMDATE=$$FMTHL7^XLFDT($G(XUHUIX2(2)))
52 S TERMDATE=$S(TERMDATE="":"""""",1:TERMDATE)
53 Q
54 ;
55FKEY ; PROVIDER key was updated
56 ; XUHUIDA(1)=file 200 ien
57 ; XUHUIA= S or K
58 I '$G(XUHUIDA(1)) S XUHUIERR="1^no IEN" Q
59 S IEN=XUHUIDA(1) ; ien of provider staff
60 ; XUHUIA determines Active/Inactive
61 S ACTIVE=$S($G(XUHUIA)="K":"I",1:"A")
62 ; get newest values for name, ssn, dob, and termination date
63 S NAME=$$GET1^DIQ(200,IEN_",","NAME")
64 S NAME=$S(NAME="":"""""",1:NAME)
65 S SSN=$$GET1^DIQ(200,IEN_",","SSN")
66 S SSN=$S(SSN="":"""""",1:SSN)
67 S DOB=$$GET1^DIQ(200,IEN_",","DOB","I")
68 S DOB=$S(DOB="":"""""",1:$$FMTHL7^XLFDT(DOB))
69 S TERMDATE=$$GET1^DIQ(200,IEN_",","TERMINATION DATE","I")
70 S TERMDATE=$S(TERMDATE="":"""""",1:$$FMTHL7^XLFDT(TERMDATE))
71 Q
72 ;
73SENDMSG ; initialize HL variables
74 N HL,NOW,RESULT
75 D INIT^HLFNC2("XUHUI MFN",.HL)
76 I $G(HL) D Q ; error occurred
77 . S XUHUIERR="1^HL init"
78 S HLFS=$G(HL("FS")) S:HLFS="" HLFS="^"
79 S HLCS=$E(HL("ECH"),1)
80 ;
81 ; create message
82 S NOW=$$FMTHL7^XLFDT($$NOW^XLFDT)
83 ; MFI^PRA^VA KERNEL^UPD^entered date^^NE
84 S HLA("HLS",1)="MFI"_HLFS_"PRA"_HLFS_"VA KERNEL"_HLFS_"UPD"_HLFS_NOW_HLFS_HLFS_"NE"
85 ; MFE^MUP^^^ien~IEN~NEW PERSON
86 S HLA("HLS",2)="MFE"_HLFS_"MUP"_HLFS_HLFS_HLFS_IEN_HLCS_"IEN"_HLCS_"NEW PERSON"
87 ; STF^ssn~NEW PERSON~SSN^^name^^^dob^active/inactive^^^^^^inactive date
88 S HLA("HLS",3)="STF"_HLFS_IEN_HLCS_"IEN"_HLCS_"NEW PERSON"_HLFS_SSN_HLCS_HLCS_HLCS_"SSN"_HLFS_NAME_HLFS_HLFS_HLFS_DOB_HLFS_ACTIVE_HLFS_HLFS_HLFS_HLFS_HLFS_HLFS_TERMDATE
89 ; generate message
90 D GENERATE^HLMA("XUHUI MFN","LM",1,.RESULT,"",.HL)
91 I +$P(RESULT,U,2) D Q
92 . S XUHUIERR="1^HL Generate"
93 Q
94 ;
Note: See TracBrowser for help on using the repository browser.