source: FOIAVistA/trunk/r/GEN_MED_REC_VITALS-GMRV/GMRVXCH2.m@ 1328

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

initial load of FOIAVistA 6/30/08 version

File size: 3.0 KB
Line 
1GMRVXCH2 ;HIRMFO/YH,RM-GMRV VITAL QUALIFIER FILE CONVERSION ;8/1/96
2 ;;4.0;Vitals/Measurements;;Apr 25, 1997
3CONV52 ; Loop through 120.52 to convert
4 S GMRVDA=0 F S GMRVDA=$O(^GMRD(120.52,GMRVDA)) Q:GMRVDA'>0 D
5 . K GMRVVTYP S GMRVCHAR=$P($G(^GMRD(120.52,GMRVDA,0)),"^")
6 . I '$D(^TMP($J,"GMRVCHAR",GMRVCHAR)) S ^TMP($J,"GMRVCHAR",GMRVCHAR)=""
7 . S GMRVCNV=$G(^TMP($J,"GMRVCHAR",GMRVCHAR))
8 . S GMRVCNV=$S(GMRVCNV]"":GMRVCNV,1:GMRVDA_";GMRD(120.52,")
9 . S $P(^GMRD(120.52,GMRVDA,"CONV"),"^")=GMRVCNV
10 . S GMRVTDA=0
11 . F S GMRVTDA=$O(^GMRD(120.52,GMRVDA,1,GMRVTDA)) Q:GMRVTDA'>0 D
12 . . S GMRVTYP=$P($G(^GMRD(120.52,GMRVDA,1,GMRVTDA,0)),"^")
13 . . Q:GMRVTYP'>0 S GMRVVTYP(GMRVTYP)=GMRVTDA
14 . . I '$D(^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP)) S ^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP)=$$QUAL(GMRVTYP,120.52,GMRVCHAR)
15 . . Q
16 . S GMRVTYP=0
17 . F S GMRVTYP=$O(^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP)) Q:GMRVTYP'>0 D
18 . . S GMRVTDA=$G(GMRVVTYP(GMRVTYP))
19 . . I GMRVTDA'>0 D Q:GMRVTDA'>0
20 . . . S X=GMRVTYP,DA(1)=GMRVDA,DIC="^GMRD(120.52,"_DA(1)_",1,"
21 . . . S DIC(0)="L",DLAYGO=120.52
22 . . . K DO,DINUM,DD D FILE^DICN S GMRVTDA=+Y
23 . . . Q
24 . . S GMRVCNV=$G(^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP))
25 . . S GMRVCAT=$P(GMRVCNV,"^")
26 . . I GMRVCAT]"" S GMRVCAT=$G(^TMP($J,"GMRVCAT",GMRVCAT))
27 . . S $P(GMRVCNV,"^")=GMRVCAT
28 . . S $P(^GMRD(120.52,GMRVDA,1,GMRVTDA,0),"^",2,4)=GMRVCNV
29 . . Q
30 . Q
31 K DA,DIC,DLAYGO,GMRVCHAR,GMRVCNV,GMRVDA,GMRVTDA,GMRVTYP,GMRVVTYP,X
32 Q
33MOVE53 ; Loop through 120.53 and move data from that
34 ; file to the 120.52 file.
35 S GMRVD0=0 F S GMRVD0=$O(^GMRD(120.53,GMRVD0)) Q:GMRVD0'>0 D
36 . S GMRVCHAR=$P($G(^GMRD(120.53,GMRVD0,0)),"^") Q:GMRVCHAR=""
37 . K GMRVFDA,GMRVIEN S GMRVFDA(99,120.52,"+1,",.01)=GMRVCHAR
38 . D UPDATE^DIE("","GMRVFDA(99)","GMRVIEN") Q:GMRVIEN(1)'>0
39 . I '$D(^TMP($J,"GMRVCHAR",GMRVCHAR)) S ^(GMRVCHAR)=GMRVD0_";GMRD(120.53,"
40 . S GMRVDA=GMRVIEN(1),GMRVD1=0
41 . F S GMRVD1=$O(^GMRD(120.53,GMRVD0,1,GMRVD1)) Q:GMRVD1'>0 D
42 . . S GMRVTYP=$P($G(^GMRD(120.53,GMRVD0,1,GMRVD1,0)),"^")
43 . . Q:$P($G(^GMRD(120.51,+GMRVTYP,0)),"^")'="BLOOD PRESSURE"
44 . . K GMRVFDA,GMRVIEN
45 . . S GMRVFDA(99,120.521,"+2,"_GMRVDA_",",.01)=GMRVTYP
46 . . D UPDATE^DIE("","GMRVFDA(99)","GMRVIEN")
47 . . I '$D(^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP)) S ^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP)=$$QUAL(GMRVTYP,120.53,GMRVCHAR)
48 . . Q
49 . Q
50 K GMRVCHAR,GMRVD0,GMRVD1,GMRVDA,GMRVFDA,GMRVTYP
51 Q
52QUAL(TYPE,FILE,CHAR) ; Given a Qualifier (CHAR), the Vital Type (TYPE)
53 ; ptr and the file from which this which the qualifier is from
54 ; (FILE), this function will return the generic Category (CAT).
55 ;
56 N CAT,GTYPE
57 S GTYPE=$P($G(^GMRD(120.51,TYPE,0)),"^",2)
58 I FILE=120.52 S CAT=$S(GTYPE="BP"!(GTYPE="P")!(GTYPE="T"):"LOCATION",GTYPE="R":"METHOD",GTYPE="WT":"QUALITY",1:"")
59 I FILE=120.53 S CAT=$S(GTYPE="BP":"POSITION",1:"")
60 Q CAT
61 ;
62TYP(TYPE) ; This function will return the external text for the Vital
63 ; Type pointed to by TYPE.
64 Q $P($G(^GMRD(120.51,TYPE,0)),"^")
Note: See TracBrowser for help on using the repository browser.