Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: LA7UTL1A

LA7UTL1A.m

Go to the documentation of this file.
  1. LA7UTL1A ;HOIFO/BH - Microbiology Query Utility ; 3/11/03 10:45am
  1. ;;5.2;AUTOMATED LAB INSTRUMENTS;**69**;Sep 27, 1994
  1. ;
  1. ;
  1. GETDATA(LRDFN,LASDT,LAEDT,LASEARCH,RESULTS) ;
  1. ;
  1. ; Input:
  1. ;
  1. ; LRDFN - Lab DFN
  1. ; LASDT - Search Start Date
  1. ; LAEDT - Search End Date
  1. ; LASEARCH - Set to CD (collection date) or RAD (completion date).
  1. ; RESULTS - Closed root destination array reference
  1. ;
  1. ; Output:
  1. ; If an error is found with the input variables one for the
  1. ; strings will be returned.
  1. ;
  1. ; -1^Start date is after end date
  1. ; -2^No return array global
  1. ; -3^Global array only
  1. ; -4^No Patient lab DFN
  1. ; -5^No Start Date Range
  1. ; -6^No End Date Range
  1. ;
  1. ; If there are no errors with the input variables the processing
  1. ; will return '1'. If there is no data in the passed in global
  1. ; there was no data available for the patient.
  1. ;
  1. ; If there is data available for the patient the routine will pass
  1. ; back the following data (the example assumes the passed in closed
  1. ; root global was "^TMP($J)"):
  1. ;
  1. ; Fields .01 (Accession date),.05 (Site Specimen),.055 (Sample Type),
  1. ; .06 (Accession #),11.51 (Sterility Control),11.57 (Urine Screen),
  1. ; 11.58 (Sputum Screen), 22 (TB RPT Date Approved), 23 (TB RPT Status),
  1. ; 24 (ACID Fast Stain), 25 (Quantity) and .99 (Specimen Comment) from
  1. ; the top node in the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"0",Field #,"E" or "I")=Field Data
  1. ;
  1. ; Field .01 of sub file 63.29 - Gram Stain - in the following format
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"2",Sub File IEN,"0",Field #,"E" or "I")=Data
  1. ;
  1. ; Field .01 (Organism) and 1 (Quantity) of sub file 63.3 in the
  1. ; following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"3",Sub File IEN,"0",Field #,"E" or "I")=Data
  1. ;
  1. ; Within the Organism data there is an antibiotic multiple. The
  1. ; routine returns the antibiotic (.01) along with the Mic (field #1)
  1. ; and Mbc (field #2) from the sub file 63.32 in the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"3",Sub File IEN,"3",Sub-Sub File IEN,"0"
  1. ; ,Field #,"E" or "I")=Data
  1. ;
  1. ;
  1. ; Organisms can potentially have specific antibiotics associated with
  1. ; them. This API pulls any of the Antibiotics (along with their
  1. ; interpretation and screen) that have been entered in the antibiotic
  1. ; fields that exist within the standard Lab DD. Within this sub file
  1. ; these fields are numbered between 5 and 160.2 and have node numbers
  1. ; that begin with the numbers 2.00.
  1. ; It is also possible for sites to enter their own specific named
  1. ; antibiotics within this multiple using a lab option. This option
  1. ; creates a new node number for the new antibiotic entry that is
  1. ; comprised in the
  1. ; following way "2.00"_site #_n (where n is an incremented number).
  1. ; This node number also becomes the field number for this antibiotic.
  1. ; The interpretation and screen values of these antibiotics should
  1. ; follow a pattern where interpretation field number is comprised as
  1. ; follows "2.00"_site #_n_1 and the screen is "2.00"_site #_n_2.
  1. ;
  1. ; However only antibiotics have been entered in the standard Organism
  1. ; DD will get extracted. Any antibiotics entered into the site
  1. ; specified fields will not get extracted.
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"3",Sub File IEN,"0",Field #,"I")=data
  1. ; ^TMP($J,LRDFN,Record_IEN,"3",Sub File IEN,"0",Field #,"E")=field name
  1. ; ^data
  1. ;
  1. ; Note the "E" node contains the field name and it's related data.
  1. ;
  1. ;
  1. ; Within the Organism data there is a comment multiple which the
  1. ; routine also returns.
  1. ; Field .01 Comment of sub file 63.31 in the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"3",Sub File IEN,"1",Sub-Sub File IEN,"0"
  1. ; ,Field #,"E" or "I")=Data
  1. ;
  1. ; Field .01 Bact RPT Remark of sub file 63.33 in the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"4",Sub File IEN,"0",Field #,"E" or "I")=Data
  1. ;
  1. ; Field .01 Parasite of sub file 63.34 in the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"6",Sub File IEN,"0",Field #,"E" or "I")=Data
  1. ;
  1. ; Within Parasite data there is a stage code multiple that the routine
  1. ; also returns.
  1. ; Fields .01 Stage code and 1 Quantity of sub file 63.35 in the
  1. ; following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"6",Sub File IEN,"1",Sub-Sub File IEN,"0"
  1. ; ,Field #,"E" or "I")=Data
  1. ;
  1. ; Within the Stage Code multiple there can be a Stage Code Comment
  1. ; multiple that this routine also returns;
  1. ; Field .01 of the Stage Code Comment Multiple 63.351 in the
  1. ; following format;
  1. ;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"6",Sub File IEN,"1",Sub-Sub File IEN,"1"
  1. ; ,Sub Sub Sub File IEN,"0",Field #,"E" or "I")=Data)
  1. ;
  1. ; Field .01 Parasite RPT Remark 63.36 in the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"7",Sub File IEN,"0",Field #,"E" or "I")=Data
  1. ;
  1. ; Field .01 Fungus/Yeast and field 1 Quantity of sub file 63.37 in the
  1. ; following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"9",Sub File IEN,"0",Field #,"E" or "I")=Data
  1. ;
  1. ; Within the Fungus/Yeast data there is a comment multiple which the
  1. ; routine also returns.
  1. ; Field .01 Comment of sub file 63.372 in the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"9",Sub File IEN,"1",Sub-Sub File IEN,"0"
  1. ; ,Field #,"E" or "I")=Data
  1. ;
  1. ;
  1. ; Field .01 Mycobacterium and field 1 Quantity of sub file 63.39 in
  1. ; the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"12",Sub File IEN,"0",Field #,"E" or "I")
  1. ; =Data
  1. ; Mycobacterium can potentially have antibiotics associated with them.
  1. ; This API pulls any of the Antibiotics that have been entered in the
  1. ; antibiotic
  1. ; fields that exist within the standard Lab DD. Within this sub file
  1. ; these fields are numbered between 5 and 55).
  1. ; It is also possible for sites to enter their own antibiotics
  1. ; within this multiple using a lab option. This option creates a new
  1. ; node number for the new antibiotic entry that is comprised in the
  1. ; following way "2.00"_site #_n (where n is an incremented number).
  1. ; This node number also becomes the field number for this antibiotic.
  1. ;
  1. ; However only antibiotics have been entered in the standard
  1. ; Mycobacterium antibiotic DD will get extracted. Any antibiotics
  1. ; entered into the site specified fields will not get extracted.
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"12",Sub File IEN,"0",Field #,"I")=data
  1. ; ^TMP($J,LRDFN,Record_IEN,"12",Sub File IEN,"0",Field #,"E")
  1. ; =field name^data
  1. ;
  1. ; Note the "E" node contains the field name and it's related data.
  1. ;
  1. ;
  1. ;
  1. ; Within the Mycobacterium data there is a comment multiple which the
  1. ; routine also returns.
  1. ; Field .01 Comment of sub file 63.4 in the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"12",Sub File IEN,"1",Sub-Sub File IEN,"0"
  1. ; ,Field #,"E" or "I")=Data
  1. ;
  1. ; Field .01 BACT Smear/Prep of sub file 63.291 in the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"25",Sub File IEN,"0",Field #,"E" or "I")
  1. ; = Data
  1. ;
  1. ; Field .01 PARA Smear/Prep of sub file 63.341 in the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"24",Sub File IEN,"0",Field #,"E" or "I")
  1. ; =Data
  1. ;
  1. ; Field .01 VIRUS of sub file 63.43 in the following format;
  1. ;
  1. ; ^TMP($J,LRDFN,Record_IEN,"17",Sub File IEN,"0",Field #,"E" or "I")
  1. ; =Data
  1. ;
  1. ;
  1. ; ---------------------------------------------------------------------
  1. ;
  1. N LAARRAY,LAINX,LATYP,LAFILE,LAARRET,LACD,LACDFLD,LACDTYP,LADATA,LASET,LASUB,LA763,LATYPE
  1. ;
  1. I LASDT>LAEDT Q "-1^Start date is after end date"
  1. I '$D(RESULTS) Q "-2^No return array global"
  1. I $E(RESULTS,1,1)'="^" Q "-3^Global array only"
  1. I '+$G(LRDFN) Q "-4^No Patient lab DFN"
  1. I '$G(LASDT) Q "-5^No Start Date Range"
  1. I '$G(LAEDT) Q "-6^No End Date Range"
  1. S LAFILE=63.05,LATYPE="MI"
  1. ;
  1. ; - Used for internal processing
  1. S LAARRAY="^XTMP(""LA7UTL1A"",$J)"
  1. ; - Passed in global reference, returns results
  1. S LAARRET=$S($G(RESULTS)'="":RESULTS,1:"^TMP(""LA7UTL1A"","_$J_")")
  1. K @LAARRAY,@LAARRET
  1. I LASEARCH="RAD" D RAD
  1. I LASEARCH="CD" D CD
  1. ;
  1. Q 1
  1. ;
  1. CD ; Search by collection date
  1. ;
  1. N LRIDT,LRSS,LANSDT,LANEDT
  1. ;
  1. I LASDT S LANSDT=9999999-LASDT
  1. I LAEDT S LANEDT=9999999-LAEDT
  1. ;
  1. S LRIDT=LANSDT
  1. F S LRIDT=$O(^LR(LRDFN,LATYPE,LRIDT),-1) Q:LRIDT=""!(LRIDT<LANEDT) D
  1. . D MI^LA7UTL1C(LRDFN,LRIDT,LAARRAY),ARRANGE^LA7UTL1B(LAARRAY,LAARRET)
  1. ;
  1. Q
  1. ;
  1. RAD ; Search by completion date.
  1. ;
  1. N LRIDT
  1. S LRIDT=0
  1. F S LRIDT=$O(^LR(LRDFN,LATYPE,LRIDT)) Q:'LRIDT D
  1. . S LA763(0)=$G(^LR(LRDFN,LATYPE,LRIDT,0))
  1. . I $P(LA763(0),"^",3)>LASDT,$P(LA763(0),"^",3)<LAEDT D MI^LA7UTL1C(LRDFN,LRIDT,LAARRAY),ARRANGE^LA7UTL1B(LAARRAY,LAARRET)
  1. Q
  1. ;
  1. ;
  1. ;