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