source: WorldVistAEHR/trunk/r/GEN_MED_OTHER-GMV/GMVDCUTL.m@ 1177

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

initial load of WorldVistAEHR

File size: 4.6 KB
Line 
1GMVDCUTL ;HOIFO/DAD,FT-VITALS COMPONENT: UTILITIES ;9/29/00 09:18
2 ;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
3 ;
4 ; This routine uses the following IAs:
5 ; #10104 - ^XLFSTR calls (supported)
6 ;
7VITIEN(GMVITTYP) ;
8 ; Convert a vital type abbr / PCE abbr / name to an IEN
9 ; Input:
10 ; A vital type IEN or abbr or PCE abbr or name
11 ; Output:
12 ; A pointer to the GMRV Vital Type file (#120.51)
13 N GMVABR,GMVNAM,GMVPCE
14 S GMVABR=$S($G(GMVITTYP)]"":+$O(^GMRD(120.51,"C",GMVITTYP,0)),1:0)
15 S GMVPCE=$S($G(GMVITTYP)]"":+$O(^GMRD(120.51,"APCE",GMVITTYP,0)),1:0)
16 S GMVNAM=$S($G(GMVITTYP)]"":+$O(^GMRD(120.51,"B",GMVITTYP,0)),1:0)
17 S GMVD0=$S(GMVITTYP=+GMVITTYP:GMVITTYP,GMVABR:GMVABR,GMVPCE:GMVPCE,GMVNAM:GMVNAM,1:-1)
18 S GMVD0=$S($D(^GMRD(120.51,GMVD0,0))#2:GMVD0,1:-1)
19 Q GMVD0
20 ;
21QUAIEN(GMVITQUA) ;
22 ; Convert a vital qualifier name to an IEN
23 ; Input:
24 ; A vital qualifier IEN or name or synonym
25 ; Output:
26 ; A pointer to the GMRV Vital Qualifier file (#120.52)
27 N GMVD0,GMVIEN,GMVNAM
28 S GMVNAM=$S($G(GMVITQUA)]"":+$O(^GMRD(120.52,"B",GMVITQUA,0)),1:-1)
29 S GMVD0=$S(GMVITQUA=+GMVITQUA:GMVITQUA,GMVNAM>0:GMVNAM,1:-1)
30 S GMVD0=$S($D(^GMRD(120.52,GMVD0,0))#2:GMVD0,1:-1)
31 I GMVD0'>0,$G(GMVITQUA)]"" D
32 . S GMVIEN=0
33 . F S GMVIEN=$O(^GMRD(120.52,GMVIEN)) Q:GMVIEN'>0 D Q:GMVD0>0
34 .. I $P($G(^GMRD(120.52,GMVIEN,0)),U,2)=GMVITQUA S GMVD0=GMVIEN
35 .. Q
36 . Q
37 Q GMVD0
38 ;
39CATIEN(GMVITCAT) ;
40 ; Convert a vital category name to an IEN
41 ; Input:
42 ; A vital category IEN or name
43 ; Output:
44 ; A pointer to the GMRV Vital Category file (#120.53)
45 N GMVCAT,GMVD0
46 S GMVCAT=$S($G(GMVITCAT)]"":+$O(^GMRD(120.53,"B",GMVITCAT,0)),1:0)
47 S GMVD0=$S(GMVITCAT=+GMVITCAT:GMVITCAT,GMVCAT:GMVCAT,1:-1)
48 S GMVD0=$S($D(^GMRD(120.53,GMVD0,0))#2:GMVD0,1:-1)
49 Q GMVD0
50 ;
51REAIEN(GMVITREA) ;
52 ; Convert an entered in error reason external form to an internal form
53 ; Input:
54 ; A vital entered in error reason in internal/external form
55 ; Output:
56 ; A vital entered in error reason in internal form
57 N GMVD0,GMVDATA
58 S GMVDATA=$$GET1^DID(120.506,.01,"","POINTER")
59 S GMVITREA(0)=$P(GMVDATA,":"_GMVITREA_";")
60 S GMVITREA(0)=$P(GMVITREA(0),";",$L(GMVITREA(0),";"))
61 S GMVD0=$S(GMVITREA=+GMVITREA:GMVITREA,GMVITREA(0):GMVITREA(0),1:-1)
62 S GMVD0=$S(";"_GMVDATA[(";"_GMVD0_":"):GMVD0,1:-1)
63 Q GMVD0
64 ;
65MEASYS(GMVMSYS) ;
66 ; Validates and returns the measurement system
67 ; Input:
68 ; GMVMSYS = Measurement system (Optional)
69 ; M = Metric, C - US Customary (Default)
70 ; Output:
71 ; M = Metric, C - US Customary (Default)
72 S GMVMSYS=$$UP^XLFSTR($G(GMVMSYS))
73 Q $S("^C^M^"[(U_GMVMSYS_U):GMVMSYS,1:"C")
74 ;
75FMTPARAM(GMVIN,GMVOUT) ;
76 ; Reformat the validate/save list parameter
77 ; Input:
78 ; GMVIN = The list parameter data as it comes from the RPC broker
79 ; See remote procedure GMV SAVE VITALS or GMV VALIDATE VITALS
80 ; for a description of the format of the data
81 ; GMVOUT = A closed array reference used to store the reformatted data
82 ; Output:
83 ; @GMVOUT@("V",##) = Measurements
84 ; @GMVOUT@("I",##) = Entered in error IENS
85 ; @GMVOUT@("Q",##,##) = Qualifiers
86 ; @GMVOUT@("R",##,##) = Entered in error reasons
87 ; GMVDFN = PatientDFN
88 ; GMVDTDUN = DateTimeTaken
89 ; GMVHOSPL = HospitalLocation
90 ; GMVDTENT = DateTimeEntered
91 ; GMVENTBY = EnteredBy
92 ; GMVERRBY = EnteredInErrorBy
93 ; GMVMSYS = MeasurementSystem
94 ;
95 N GMV,GMVDATA,GMVMAJOR,GMVMINOR,GMVRET,GMVS2V,GMVTYPE,GMVVAR,GMVVARTY
96 K @GMVOUT
97 F GMV=1:1 S GMVDATA=$P($T(SUBVAR+GMV),";;",2) Q:GMVDATA="" D
98 . S GMVVAR=$P(GMVDATA,U,2),GMVVARTY=$P(GMVDATA,U,3)
99 . S GMVS2V($P(GMVDATA,U))=GMVVAR_U_GMVVARTY
100 . S @(GMVVAR_"=-1")
101 . Q
102 S GMV=""
103 F S GMV=$O(GMVIN(GMV)) Q:GMV="" D
104 . I (GMV?1U1"^"1.N)!(GMV?1U1"^"1.N1"^"1.N) D
105 .. S GMVTYPE=$P(GMV,U),GMVMAJOR=$P(GMV,U,2),GMVMINOR=$P(GMV,U,3)
106 .. I "^I^V^"[(U_GMVTYPE_U) D ; Entered in Error IENS & Measurements
107 ... S @GMVOUT@(GMVTYPE,GMVMAJOR)=GMVIN(GMV)
108 ... Q
109 .. I "^Q^R^"[(U_GMVTYPE_U) D ; Qualifiers & Reasons entered in error
110 ... S @GMVOUT@(GMVTYPE,GMVMAJOR,GMVMINOR)=GMVIN(GMV)
111 ... Q
112 .. Q
113 . E D
114 .. S GMVDATA=$G(GMVS2V(GMV))
115 .. S GMVVAR=$P(GMVDATA,U),GMVVARTY=$P(GMVDATA,U,2)
116 .. I GMVVARTY="D" D
117 ... K GMVRET
118 ... D DT^DILF("RSTX",GMVIN(GMV),.GMVRET)
119 ... S GMVIN(GMV)=$G(GMVRET)
120 ... Q
121 .. I GMVVARTY="U",$$UP^XLFSTR(GMVIN(GMV))="DUZ" D
122 ... S GMVIN(GMV)=DUZ
123 ... Q
124 .. I GMVVAR]"",GMVIN(GMV)]"" S @(GMVVAR_"="""_GMVIN(GMV)_"""")
125 .. Q
126 . Q
127 Q
128SUBVAR ;;Subscript ^ Variable ^ DataType (D-Date/Time, L-Literal, U-User)
129 ;;PatientDFN^GMVDFN^L
130 ;;DateTimeTaken^GMVDTDUN^D
131 ;;HospitalLocation^GMVHOSPL^L
132 ;;DateTimeEntered^GMVDTENT^D
133 ;;EnteredBy^GMVENTBY^U
134 ;;EnteredInErrorBy^GMVERRBY^U
135 ;;MeasurementSystem^GMVMSYS^L
136 ;;
Note: See TracBrowser for help on using the repository browser.