source: WorldVistAEHR/trunk/r/MEDICINE-MC/MCARAPI.m@ 1036

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1MCARAPI ; HOIFO/NCA - Electrocardiogram Data Extraction ;7/3/96 09:13
2 ;;2.3;Medicine;**34**;09/13/1996
3 ; Reference IA #3780
4 ; IA #10154 Access 2nd piece of ^DD(filenumber,fieldnumber,0)
5GET(RESULTS,MCARDFN,MCSDT,MCEDT,MCFLDS) ; Returns list of data from Electrocardiogram File #691.5
6 ; Input: RESULTS - the global array in which (Required)
7 ; to return results.
8 ; MCARDFN - the patient DFN. (Required)
9 ; MCSDT - the start date of the date (Required)
10 ; range to return the data in.
11 ; This must be in FM internal
12 ; format.
13 ; MCEDT - the end date of the date (Required)
14 ; range to return the data in.
15 ; This must be in FM internal
16 ; format.
17 ; MCFLDS - a list of fields from file #691.5 to (Required)
18 ; be returned in RESULTS. MCFLDS should
19 ; contain a list of fields delimited by ";"
20 ; example: MCFLDS=".01;11;20..."
21 ;
22 ; Output: RESULTS (Passed by Reference)
23 ; Global array return in the following FM DIQ call format:
24 ; example:
25 ; ^TMP("MCDATA",$J,file #,record ien_",",field #,"E")=Data
26 ; ^TMP("MCDATA",$J,subfile #,entry #_","_record ien,
27 ; field of the multiple,"E")=data
28 ;
29 ; Only the Electrocardiogram records in the following
30 ; statuses will be returned in the list:
31 ;
32 ; RELEASED ON-LINE VERIFIED
33 ; RELEASED OFF-LINE VERIFIED
34 ; RELEASED NOT VERIFIED
35 ; RELEASED ON-LINE VERIFIED OF SUPERSEDED
36 ; RELEASED OFF-LINE VERIFIED OF SUPERSEDED
37 ;
38 ; RESULTS(0) will equal one of the following, if the call
39 ; failed:
40 ; -1^No Patient DFN.
41 ; -1^No Start Date Range.
42 ; -1^No End Date Range.
43 ; -1^Start Date greater than End Date.
44 ; -1^No fields defined.
45 ; -1^Global TMP array only.
46 ; If no return array defined,^TMP("MCAPI",$J,0) equals
47 ; -1^No return array global.
48 ;
49 ; If no data, RESULTS(0) equals
50 ; -1^No data for patient.
51 ;
52 N MCCODE,MCDR,MCK,MCLP,MCN,MCNOD,MCSUBF,MCX,MCY
53 K ^TMP("MCAPI",$J)
54 I '$D(RESULTS) S ^TMP("MCAPI",$J,0)="-1^No return array global." Q
55 I $G(RESULTS)'["^TMP" S ^TMP("MCAPI",$J,0)="-1^Global TMP array only." Q
56 I '+$G(MCARDFN) S @RESULTS@(0)="-1^No Patient DFN." Q
57 I '$G(MCSDT) S @RESULTS@(0)="-1^No Start Date Range." Q
58 I '$G(MCEDT) S @RESULTS@(0)="-1^No End Date Range." Q
59 I MCSDT>MCEDT S @RESULTS@(0)="-1^Start Date greater than End Date." Q
60 I $G(MCFLDS)="" S @RESULTS@(0)="-1^No fields defined." Q
61 S (MCDR,MCX,MCY)="",MCEDT=MCEDT\1+.3
62 S MCN=$L(MCFLDS,";")
63 F MCK=1:1:MCN S MCY=+$P(MCFLDS,";",MCK) I MCY D
64 .Q:'$$VFIELD^DILFD(691.5,MCY)
65 .S MCNOD=$P($G(^DD(691.5,+MCY,0)),"^",2),MCSUBF=0
66 .I +MCNOD[691.5&($E(MCNOD,$L(MCNOD)-1,$L(MCNOD))="PA") S MCSUBF=1
67 .S MCDR=MCDR_$S(MCDR="":"",1:";")_MCY_$S(MCSUBF:"*",1:"")
68 .Q
69 S MCLP=0 F S MCLP=$O(^MCAR(691.5,"C",MCARDFN,MCLP)) Q:MCLP<1 D
70 .S MCX=$G(^MCAR(691.5,MCLP,0)) Q:MCX=""
71 .Q:$P(MCX,"^")<MCSDT!($P(MCX,"^")>MCEDT)
72 .S MCCODE=$P($G(^MCAR(691.5,MCLP,"ES")),"^",7)
73 .S:MCCODE="" MCCODE="RNV"
74 .I MCCODE="S"!(MCCODE["D") Q
75 .D GETS^DIQ(691.5,MCLP_",",MCDR,"E",$NA(@RESULTS))
76 .Q
77 I '$D(@(RESULTS)) S @RESULTS@(0)="-1^No data for patient."
78 Q
Note: See TracBrowser for help on using the repository browser.