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

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

initial load of WorldVistAEHR

File size: 6.2 KB
Line 
1XUMFXP ;ISS/RAM - Master File Parameters ; 10/11/02 2:50pm
2 ;;8.0;KERNEL;**299**;Jul 10, 1995
3 ;
4 ;
5 ;
6MAIN(IFN,IEN,TYPE,PARAM,ERROR) ; -- parameters for master file server
7 ;
8 ;INPUT
9 ; IFN Internal File Number (required)
10 ;
11 ; IEN Internal Entry Number (required)
12 ;
13 ; single entry (pass by value) example: IEN=1
14 ;
15 ; multiple entries (pass by reference) IEN(1)=""
16 ; IEN(2)=""
17 ;
18 ; ALL national entries (pass by value) IEN="ALL"
19 ;
20 ; NEW entry (pass by value) IEN="NEW"
21 ;
22 ; TYPE Message TYPE (required)
23 ;
24 ; 0 = MFN - unsolicited update
25 ; 1 = MFQ - query particular record and file
26 ; 3 = MFQ - query particular record in array
27 ; 5 = MFQ - query group records file
28 ; 7 = MFQ - query group records array
29 ; 11 = MFR - query response particular rec file
30 ; 13 = MFR - query response particular rec array
31 ; 15 = MFR - query response group records file
32 ; 17 = MFR - query response group records array
33 ;
34 ;
35 ;INPUT/OUTPUT
36 ;
37 ; PARAM("PROTOCOL") IEN Protocol (#101) file
38 ; PARAM("LLNK") HLL("LINKS",n) 'protocol^logical link'
39 ; PARAM("CDSYS") Coding System - if mult cod sys for
40 ; table - use XUMFIDX x-ref for CDSYS
41 ;
42 ; QRD -- Query definition segment
43 ; -------------------------------
44 ; PARAM("QDT") Query Date/Time
45 ; PARAM("QFC") Query Format Code
46 ; PARAM("QP") Query Priority
47 ; PARAM("QID") Query ID
48 ; PARAM("DRT") Deferred Response Type
49 ; PARAM("DRDT") Deferred Response Date/Time
50 ; PARAM("QLR") Quantity Limited Request
51 ; PARAM("WHO") Who Subject Filter
52 ; PARAM("WHAT") What Subject Filter
53 ; PARAM("WDDC") What Department Data Code
54 ; PARAM("WDCVQ") What Data Code Value Qual
55 ; PARAM("QRL") Query Results Level
56 ;
57 ; MFI -- Master File Identification
58 ; ---------------------------------
59 ; PARAM("MFI") Master File Identifier
60 ; PARAM("MFAI") Master File Application Identifier
61 ; if MFAI contains TEMP do not store
62 ; values in FileMan but parse into
63 ; ^TEMP("XUMF ARRAY",$J, global
64 ; PARAM("FLEC") File-Level Event Code
65 ; PARAM("ENDT") Entered Data/Time
66 ; PARAM("MFIEDT") Effective Date/Time
67 ; PARAM("RLC") Response Level Code
68 ;
69 ; MFE -- Master File Entry
70 ; ------------------------
71 ; PARAM("RLEC") Record-Level Event Code
72 ; PARAM("MFNCID") MFN Control ID
73 ; PARAM("MFEEDT") Effective Date/Time
74 ; PARAM("PKV") Primary Key Value
75 ;
76 ; segment(s) parameters
77 ; -------------------------
78 ; PARAM("SEQ",SEQ,FLD#)=hl7_dataType
79 ; If the FIELD is a pointer add ":" + extended reference
80 ; lookup field (if other than .01) after HL7 data type.
81 ;
82 ; Files involving sub-records and/or extended reference
83 ; -----------------------------------------------------
84 ; PARAM("SEQ",SEQ,"FILE") See FM documentation
85 ; PARAM("SEQ",SEQ,"IENS") $$GET1^DIQ() for value
86 ; PARAM("SEQ",SEQ,"FIELD") of FILE, IENS, & FIELD.
87 ;
88 ; PARAM("SEQ",SEQ,"DTYP") HL7 data type
89 ; PRAAM("SEQ",SEQ,"LKUP") extended reference lookup field
90 ;
91 ; and another node is required for sub-file IENS for group
92 ; ^TMP("XUMF MFS",$J,"PARAM",IEN,"IENS",SEQ)=IENS
93 ;
94 ; NOTE: OUTPUT in ^TMP("XUMF MFS",$J,"PARAM")
95 ;
96 ; Example: MFE PKV is ^TMP("XUMF MFS",$J,"PARAM",IEN,"PKV")
97 ;
98 ;
99 N QUERY,UPDATE,ALL,MFR,MFQ,HLFS,HLCS,GROUP,ARRAY,ROOT,NEW,I,J,CDSYS
100 N PROTOCOL,MFK
101 ;
102 K ^TMP("XUMF MFS",$J)
103 M ^TMP("XUMF MFS",$J,"PARAM")=PARAM
104 ;
105 S IEN=$G(IEN),IFN=$G(IFN)
106 S TYPE=+$G(TYPE),ERROR=$G(ERROR)
107 S UPDATE=$S(TYPE#2:0,1:1)
108 S QUERY='UPDATE
109 S GROUP=$S(UPDATE:0,TYPE[5:1,TYPE[7:1,1:0)
110 S ARRAY=$S(UPDATE:0,TYPE[3:1,TYPE[7:1,1:0)
111 S ALL=$S(IEN="ALL":1,1:0)
112 S NEW=$S(IEN="NEW":1,1:0)
113 S MFR=$S(UPDATE:0,TYPE>10:1,1:0)
114 S MFQ=$S(UPDATE:0,'MFR:1,1:0)
115 S MFK=$S(TYPE=10:1,1:0)
116 ;
117 Q:MFK
118 ;
119 S PROTOCOL=$G(PARAM("PROTOCOL"))
120 ;
121 I 'IFN S ERROR="1^invalid IFN" Q
122 ;
123 ; -- get root of file
124 S ROOT=$$ROOT^DILFD(IFN,,1)
125 ;
126 ; -- if IEN array input, merge with param
127 I 'ALL,'IEN,$O(IEN(0)) M ^TMP("XUMF MFS",$J,"PARAM","IEN")=IEN
128 ;
129 ; -- if CDSYS and ALL get entries
130 S CDSYS=$G(^TMP("XUMF MFS",$J,"PARAM","CDSYS"))
131 I ALL,CDSYS'="" D
132 .S I=0 F S I=$O(@ROOT@("XUMFIDX",CDSYS,I)) Q:'I D
133 ..S J=$O(@ROOT@("XUMFIDX",CDSYS,I,0))
134 ..S ^TMP("XUMF MFS",$J,"PARAM","IEN",J)=I
135 ;
136 ; -- get ALL file 'national' entries
137 I ALL,'$D(^TMP("XUMF MFS",$J,"PARAM","IEN")),CDSYS="" D
138 .S I=0 F S I=$O(@ROOT@("AVUID",I)) Q:'I D
139 ..S J=$O(@ROOT@("AVUID",I,0))
140 ..S ^TMP("XUMF MFS",$J,"PARAM","IEN",J)=I
141 ;
142 ; -- get ALL file
143 I ALL,'$D(^TMP("XUMF MFS",$J,"PARAM","IEN")),CDSYS="" D
144 .S I=0 F S I=$O(@ROOT@(I)) Q:'I D
145 ..S ^TMP("XUMF MFS",$J,"PARAM","IEN",I)=""
146 ;
147 I '$D(^DIC(4.001,+IFN)) S ERROR="1^file not supported" Q
148 ;
149 D MAIN^XUMFXP1
150 ;
151 K PARAM
152 ;
153 Q
154 ;
155 ;
156DTYP(VALUE,TYP,HLCS,TOHL7,TIMEZONE) ;data type conversion
157 ;INPUT
158 ; VALUE value
159 ; TYP HL7 data type
160 ; TOHL7 1=to HL7, 0=to FileMan
161 ;OUTPUT
162 ; $$ formatted data
163 ;
164 N TEXT,CS
165 S TYP=$G(TYP),VALUE=$G(VALUE)
166 S TOHL7=$G(TOHL7),TIMEZONE=$G(TIMEZONE)
167 Q:TYP="" VALUE Q:VALUE="" VALUE
168 S TEXT=$P(TYP,U,2),TYP=$P(TYP,U)
169 I TYP="ST"!(TYP="ID") Q VALUE
170 I TYP="DT",TOHL7 D Q $$HLDATE^HLFNC(VALUE)
171 .N X,Y S X=VALUE D ^%DT S VALUE=+Y
172 I TYP="DT",$E(VALUE,1,4)="0000" Q $$NOW^XLFDT
173 I TYP="DT" Q $$HL7TFM^XLFDT(+VALUE,TIMEZONE)
174 I TYP="ZST" D Q VALUE
175 .N IEN5 S IEN5=+$O(^DIC(5,"C",VALUE,""))
176 .S:IEN5 VALUE=$P($G(^DIC(5,IEN5,0)),"^")
177 I 'TOHL7 Q $P(VALUE,HLCS)
178 Q VALUE_$TR(TEXT,"~",HLCS)
179 ;
Note: See TracBrowser for help on using the repository browser.