source: FOIAVistA/tag/r/MEDICINE-MC/MCARAM2.m@ 1696

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

initial load of FOIAVistA 6/30/08 version

File size: 3.5 KB
Line 
1MCARAM2 ;WASH ISC/JKL-MUSE TRANSFER LAB DATA TO LOCAL ;2/13/98 09:12
2 ;;2.3;Medicine;**16**;09/13/1996
3 ;
4 ;
5 ;Modules to return lab data in a local array
6 ; USAGE: S X=$$L#^MCARAM2(.A,B) , where # = integer from 7 to 12
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") = diagnosis line # in alphabetic form
13 ; MCA("DX,#") = line of diagnosis data
14 ; MCA("DT") = date/time in FM format
15 ;
16L7(MCA,MCD) ;Returns "DT" = date/time in FM format
17 ; "DX,G" = 7th line of diagnosis
18 N MCERR,Y
19 S MCERR=$$AR^MCARAM4(.MCA,"DAY",MCD,11,22) Q:+MCERR=2 $$LOG^MCARAM7("51-Date is a null data field") I +MCERR>50 Q MCERR
20 S MCERR=$$AR^MCARAM4(.MCA,"TM",MCD,23,31) Q:+MCERR=2 $$LOG^MCARAM7("51-Time is a null data field") I +MCERR>50 Q MCERR
21 S X=MCA("DAY")_"@"_MCA("TM")
22 I X?2N1"-"3A1"-"2N1"@"2N1":"2N Q $$LOG^MCARAM7("52-Date/Time not DD-MMM-YYYY@HH:MM")
23 I X'?2N1"-"3A1"-"4N1"@"2N1":"2N Q $$LOG^MCARAM7("52-Date/Time not DD-MMM-YYYY@HH:MM")
24 S %DT="RX" D ^%DT I Y'>0 Q $$LOG^MCARAM7("53-Date/Time rejected by %DT")
25 S:Y>0 MCA("DT")=Y
26 S MCERR=$$AR^MCARAM4(.MCA,"DX,"_MCA("CONT"),MCD,32,134) I +MCERR>50 Q MCERR
27 Q 0
28 ;
29L8(MCA,MCD) ;Returns Field 3 = vent. rate, "DX,H" = 8th line of diagnosis
30 N MCERR
31 S MCERR=$$AR^MCARAM4(.MCA,3,MCD,11,18,1)
32 I +MCERR=2 K MCA(3) S MCERR=$$LOG^MCARAM7("2-Vent. rate is a null data field")
33 I +MCERR=1 K MCA(3) S MCERR=$$LOG^MCARAM7("1-Vent. rate not numeric")
34 I +MCERR>50 Q MCERR
35 S MCERR=$$AR^MCARAM4(.MCA,"DX,"_MCA("CONT"),MCD,32,134) I +MCERR>50 Q MCERR
36 Q 0
37 ;
38L9(MCA,MCD) ;Returns Field 4 = PR interval, "DX,I" = 9th line of diagnosis
39 N MCERR
40 S MCERR=$$AR^MCARAM4(.MCA,4,MCD,12,18,1)
41 I +MCERR=2 K MCA(4) S MCERR=$$LOG^MCARAM7("2-PR interval is a null data field")
42 I +MCERR=1 K MCA(4) S MCERR=$$LOG^MCARAM7("1-PR interval not numeric")
43 I +MCERR>50 Q MCERR
44 S MCERR=$$AR^MCARAM4(.MCA,"DX,"_MCA("CONT"),MCD,32,134) I +MCERR>50 Q MCERR
45 Q 0
46 ;
47L10(MCA,MCD) ;Returns Field 5 = QRS duration, "DX,J" =10th line of diagnosis
48 N MCERR
49 S MCERR=$$AR^MCARAM4(.MCA,5,MCD,13,18,1)
50 I +MCERR=2 K MCA(5) S MCERR=$$LOG^MCARAM7("2-QRS duration is a null data field")
51 I +MCERR=1 K MCA(5) S MCERR=$$LOG^MCARAM7("1-QRS duration not numeric")
52 I +MCERR>50 Q MCERR
53 S MCERR=$$AR^MCARAM4(.MCA,"DX,"_MCA("CONT"),MCD,32,134) I +MCERR>50 Q MCERR
54 Q 0
55 ;
56L11(MCA,MCD) ;Returns Field 6 = QT, 7 = QTc, "DX,K"=11th line of diagnosis
57 N MCERR
58 S MCERR=$$AR^MCARAM4(.MCA,6,MCD,7,14,1)
59 I +MCERR=2 K MCA(6) S MCERR=$$LOG^MCARAM7("2-QT is a null data field")
60 I +MCERR=1 K MCA(6) S MCERR=$$LOG^MCARAM7("1-QT not numeric")
61 I +MCERR>50 Q MCERR
62 S MCERR=$$AR^MCARAM4(.MCA,7,MCD,16,18,1)
63 I +MCERR=2 K MCA(7) S MCERR=$$LOG^MCARAM7("2-QTc is a null data field")
64 I +MCERR=1 K MCA(7) S MCERR=$$LOG^MCARAM7("1-QTc not numeric")
65 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 ;
69KNMK ; Kill name check variables
70 K MCNAM,MCFNAM,MCLNAM,MC12NAM,MC12FNAM,MC12LNAM,MCA12 Q
71 ;
72ERR ;Error return
73 Q MCERR
74DATE(MCDATE) ; Get the two digit century for the date
75 N MCMTH,A1,A2,A3,SD
76 S SD=$P(MCDATE,"@",1),A2=0
77 S A1=$P(SD,"-",2) G:A1'?3A EXIT
78 S A1=$TR(A1,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
79 S A2=$S(A1="JAN":1,A1="FEB":2,A1="MAR":3,A1="APR":4,A1="MAY":5,A1="JUN":6,A1="JUL":7,A1="AUG":8,A1="SEP":9,A1="OCT":10,A1="NOV":11,A1="DEC":12,1:0) G:'A2 EXIT
80EXIT Q $E(MCDATE,1,7)_1700+$S(A2&(A2>$E(DT,4,5)):1700+$E(DT,1)_$E(MCDATE,8,15))
Note: See TracBrowser for help on using the repository browser.