source: FOIAVistA/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7QRY.m@ 1683

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

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1LA7QRY ;DALOI/JMC - Lab HL7 Query Utility ; 1/27/04 8:25am
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**46,69**;Sep 27, 1994
3 ;
4 ; Reference to variable DIQUIET supported by DBIA #2098
5 ; Reference to ^DPT("SSN") global supported by DBIA #10035
6 ;
7 Q
8 ;
9GCPR(LA7PTID,LA7SDT,LA7EDT,LA7SC,LA7SPEC,LA7ERR,LA7DEST,LA7HL7) ; Entry point for Government Computerized Patient Record query
10 ;
11 ; Call with LA7PTID = patient identifier, either SSN or MPI/ICN
12 ; if MPI/ICN then should be full ICN (10 digit
13 ; number followed by "V" and six digit checksum)
14 ; For example: 1000720100V271387
15 ; LA7SDT = start date of query (FileMan D/T,time optional)
16 ; LA7EDT = end date of query (FileMan D/T, time optional)
17 ; (FileMan D/T^type of date ("CD" or "RAD")
18 ; Both start and end date values can pass a
19 ; parameter in the second piece to indicate that
20 ; the date values are for specimen collection
21 ; date/time (CD) or results available date (RAD)
22 ; Example: LA7SDT="2991001.1239^CD"
23 ; LA7EDT="2991002.0331^CD"
24 ; LA7SDT="3010201^RAD"
25 ; LA7EDT="3010201^RAD"
26 ;
27 ; LA7SC = Array of search codes, either NLT or LOINC
28 ; (code^coding system ("NLT" or "LN");
29 ; Example: LA7SC(1)="89628.0000^NLT"
30 ; LA7SC(2)="84330.0000^NLT"
31 ; LA7SC(3)="84295.0000^NLT"
32 ; LA7SC(4)="14749-6^LN"
33 ;
34 ; = The "*" (wildcard) for any code;
35 ; Example: LA7SC="*"
36 ;
37 ; = A list of subscripts (separated by commas) from
38 ; where the results will be extracted ("CH", "MI"
39 ; or "SP").
40 ; Example: LA7SC="CH,MI" (CH and MI results only)
41 ;
42 ; LA7SPEC = array of specimen types using HL7 source table
43 ; 0070 or "*" (wildcard) for any code
44 ; Currently specimen type only supported for CH
45 ; and MI subscripted tests.
46 ; Example: LA7SPEC="*"
47 ; or
48 ; LA7SPEC(1)="UR"
49 ; LA7SPEC(2)="SER"
50 ; LA7SPEC(3)="PLAS"
51 ;
52 ; LA7DEST = closed root global reference to return search
53 ; results (optional). If this parameter is
54 ; omitted or equals an empty string, then node
55 ; ^TMP("HLS",$J) is used.
56 ; Example: LA7DEST=$NA(^TMP("ZZTMP",$J))
57 ;
58 ; LA7HL7 = HL7 field separator and encoding characters (4)
59 ; to use to encode results (optional).
60 ; If undefined or incomplete (length<5) then
61 ; field separator = "|" and encoding characters =
62 ; "^\~&"
63 ;
64 ; Returns LA7DEST = contains global reference of search results
65 ; in HL7 message structure, usually ^TMP("HLS",$J)
66 ;
67 ; LA7ERR = array (by reference) containing any errors
68 ;
69 N DFN,DIQUIET,LA76248,LA7CODE,LA7PTYP,LA7QUIT,LA7SCSRC,LRDFN,LRIDT,LRSS,LRSSLST,TMP
70 ;
71 D CLEANUP
72 S U="^",DT=$$DT^XLFDT,DTIME=$$DTIME^XUP($G(DUZ))
73 S GBL=$S($G(LA7DEST)'="":LA7DEST,1:"^TMP(""HLS"","_$J_")")
74 K LA7ERR
75 ; Prevent FileMan from issuing any unwanted WRITE(s).
76 S DIQUIET=1
77 ; Currently not using file #62.48 for configuration information.
78 S LA76248=0
79 ;
80 ; Identify patient, quit if error
81 D PATID^LA7QRY2
82 I $D(LA7ERR) Q ""
83 ;
84 ; Resolve search codes to lab datanames
85 S LA7SCSRC=$G(LA7SC)
86 S TMP=$$SCLIST^LA7QRY2(LA7SCSRC)
87 Q:$D(LA7ERR) ""
88 S LA7SC=TMP D:LA7SC'="*" CHKSC^LA7QRY1
89 ;
90 ; Convert specimen codes to file #61 Topography entries
91 S LA7SPEC=$G(LA7SPEC)
92 I LA7SPEC'="*" D SPEC^LA7QRY1
93 ;
94 ; Search by collection or results available date
95 I $P(LA7SDT,"^",2)="" S $P(LA7SDT,"^",2)="CD"
96 I $P(LA7SDT,"^",2)="RAD" D BRAD^LA7QRY2
97 I $P(LA7SDT,"^",2)="CD" D BCD^LA7QRY2
98 ;
99 I '$D(^TMP("LA7-QRY",$J)) D
100 . S LA7ERR(99)="No results found for requested parameters"
101 . S GBL=""
102 E D BUILDMSG^LA7QRY1
103 ;
104 D CLEANUP S LA7SC=LA7SCSRC
105 ;
106 Q GBL
107 ;
108 ;
109CLEANUP ; Cleanup TMP nodes that are used.
110 ;
111 N I
112 ;
113 F I="LA7-61","LA7-DN","LA7-LN","LA7-NLT","LA7-QRY" K ^TMP(I,$J)
114 D KVAR^LRX
115 ;
116 Q
Note: See TracBrowser for help on using the repository browser.