source: WorldVistAEHR/trunk/r/MEDICINE-MC/MCARAM1.m@ 1211

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

initial load of WorldVistAEHR

File size: 4.2 KB
Line 
1MCARAM1 ;WASH ISC/JKL-MUSE TRANSFER LAB DATA TO LOCAL ;4/27/99 09:50
2 ;;2.3;Medicine;**23**;09/13/1996
3 ;
4 ;
5 ;Modules to return lab data in a local array
6 ; USAGE: S X=$$L#^MCARAM1(.A,B) , where # = integer from 1 to 6
7 ; WHERE: .A=local array into which data is placed
8 ; B=1 line of lab data
9 ; if unsuccessful, returns an error message
10 ; if successful, returns a function value of 0 and a value array:
11 ; MCA(field #) = value of field
12 ; MCA("CONT")= line # of diagnosis in alphabetic form
13 ; MCA("DX,#") = line of diagnosis data
14 ; MCA("RX,#")=parsed medication line
15 ; MCA("NAME") = patient name, MCA("AGE")= patient age
16 ; MCA("RACE") = patient race, MCA("SEX")= patient sex
17L1(MCA,MCD) ;Returns "DX,A" = 1st line of diagnosis, Field 2=Type of EKG
18 N MCERR
19 S MCERR=$$AR^MCARAM4(.MCA,"DX,"_MCA("CONT"),MCD,32,84) I +MCERR>50 Q MCERR
20 S MCERR=$$AR^MCARAM4(.MCA,2,MCD,85,134) I +MCERR>50 Q MCERR
21 S MCA(2)=$S(MCA(2)["STAT":"S",MCA(2)["ROUT":"R",MCA(2)["ORIG":"O",1:"")
22 I MCA(2)="" K MCA(2) Q $$LOG^MCARAM7("2-EKG Type is a null data field")
23 Q 0
24 ;
25L2(MCA,MCD) ;Returns "NAME" = patient name, "DX,B" = 2nd line of diagnosis
26 N MCERR
27 S MCERR=$$AR^MCARAM4(.MCA,"NAME",MCD,1,31) Q:+MCERR>50 MCERR I +MCERR=2 S MCA("NAME")="No patient name" Q $$LOG^MCARAM7("57-Name is a null data field")
28 S:MCA("NAME")[", " MCA("NAME")=$P(MCA("NAME"),", ")_","_$P(MCA("NAME"),", ",2)
29 S MCA("NAME")=$$UP^XLFSTR(MCA("NAME"))
30 S MCERR=$$AR^MCARAM4(.MCA,"DX,"_MCA("CONT"),MCD,32,134) I +MCERR>50 Q MCERR
31 Q 0
32 ;
33L3(MCA,MCD) ;Returns Field .02=Social Security number
34 ; Field 18=Ward/Clinic, "DX,C" = 3rd line of diagnosis
35 N MCERR,MCI
36 S MCA(.02)=$E(MCD,4,12),MCERR=$$DFCK^MCARAM4(MCA(.02),1) Q:+MCERR>50 MCERR Q:+MCERR=1 $$LOG^MCARAM7("54-Social Security Number is not numeric") I +MCERR=2 Q $$LOG^MCARAM7("54-Social Security Number is a null data field")
37 S MCERR=$$AR^MCARAM4(.MCA,"DX,"_MCA("CONT"),MCD,32,134) I +MCERR>50 Q MCERR
38 S MCERR=$$AR^MCARAM4(.MCA,18,MCD,18,31) I +MCERR>50 Q MCERR
39 I +MCERR=2 K MCA(18) S MCERR=$$LOG^MCARAM7("2-Ward/Clinic is a null data field") Q MCERR
40 S MCI=MCA(18) K MCA(18)
41 I $D(^SC("B",MCI))!$D(^SC("C",MCI)) S MCA(18)=$O(^(MCI,0))
42 I '$D(MCA(18)) S MCERR=$$LOG^MCARAM7("1-Undefined Ward/Clinic")
43 Q 0
44 ;
45L4(MCA,MCD) ;Returns "AGE"=patient age, Field .08=height, .07=weight
46 ; "RACE"=race, "SEX"=patient sex, "DX,D" = 4th line of diagnosis
47 N MCERR
48 S MCERR=$$AR^MCARAM4(.MCA,"AGE",MCD,1,5,1) I +MCERR>50 Q MCERR
49 I +MCERR=2 K MCA("AGE") S MCERR=$$LOG^MCARAM7("2-Age is a null data field")
50 I +MCERR=1 K MCA("AGE") S MCERR=$$LOG^MCARAM7("1-Age is not a numerical data field")
51 S MCERR=$$AR^MCARAM4(.MCA,.08,MCD,8,11,1) I +MCERR>50 Q MCERR
52 I +MCERR=2 K MCA(.08) S MCERR=$$LOG^MCARAM7("2-Height is a null data field")
53 I +MCERR=1 K MCA(.08) S MCERR=$$LOG^MCARAM7("1-Height is not a numerical data field")
54 S MCERR=$$AR^MCARAM4(.MCA,.07,MCD,14,17,1) I +MCERR>50 Q MCERR
55 I +MCERR=2 K MCA(.07) S MCERR=$$LOG^MCARAM7("2-Weight is a null data field")
56 I +MCERR=1 K MCA(.07) S MCERR=$$LOG^MCARAM7("2-Weight is not a numerical data field")
57 S MCERR=$$AR^MCARAM4(.MCA,"RACE",MCD,21,24) I +MCERR>50 Q MCERR
58 S MCERR=$$AR^MCARAM4(.MCA,"SEX",MCD,25,31) I +MCERR>50 Q MCERR
59 S MCERR=$$AR^MCARAM4(.MCA,"DX,"_MCA("CONT"),MCD,32,134) I +MCERR>50 Q MCERR
60 Q 0
61 ;
62L5(MCA,MCD) ;Returns "RX", #s = data for each medication
63 ; "DX,E" = 5th line of diagnosis
64 N MCERR
65 S MCERR=$$AR^MCARAM4(.MCA,"RX,0",MCD,5,31) I +MCERR>50 Q MCERR
66 S MCERR=$$AR^MCARAM4(.MCA,"DX,"_MCA("CONT"),MCD,32,134) I +MCERR>50 Q MCERR
67 Q 0
68 ;
69L6(MCA,MCD) ;Returns Field 16=systolic bp, 15=diastolic bp,
70 ; "DX,F" = 6th line of diagnosis
71 N MCERR
72 S MCERR=$$AR^MCARAM4(.MCA,16,MCD,11,13,1) Q:+MCERR>50 MCERR I +MCERR=2 K MCA(16) S MCERR=$$LOG^MCARAM7("2-Systolic bp is a null data field")
73 I +MCERR=1 K MCA(16) S MCERR=$$LOG^MCARAM7("2-Systolic bp is not a numerical data field")
74 S MCERR=$$AR^MCARAM4(.MCA,15,MCD,15,17,1) Q:+MCERR>50 MCERR I +MCERR=2 K MCA(15) S MCERR=$$LOG^MCARAM7("2-Diastolic bp is a null data field")
75 I +MCERR=1 K MCA(15) S MCERR=$$LOG^MCARAM7("2-Diastolic bp is not a numerical data field")
76 S MCERR=$$AR^MCARAM4(.MCA,"DX,"_MCA("CONT"),MCD,32,134) I +MCERR>50 Q MCERR
77 Q 0
78 ;
79 ;
80ERR ;Error return
81 Q MCERR
Note: See TracBrowser for help on using the repository browser.