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

BIEXP3.m

Go to the documentation of this file.
  1. BIEXP3 ;IHS/CMI/MWR - EXPORT IMMUNIZATION RECORDS.; MAY 10, 2010
  1. ;;8.5;IMMUNIZATION;**9**;OCT 01,2014
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; EXPORT IMMUNIZATION RECORDS: EXPORT ROUTINE
  1. ;; PATCH 9: Changes to limit export of imms to specific vaccines within
  1. ;; a date range. START+75
  1. ;
  1. ;
  1. ;----------
  1. START(BIRTN) ;EP
  1. ;---> Export Data.
  1. ;---> Parameters:
  1. ; 1 - BIRTN (req) Calling routine for reset.
  1. ;
  1. I $G(BIRTN)="" D ERRCD^BIUTL2(621,,1) Q
  1. ;
  1. ;---> Variables:
  1. ; 1 - BISVDT (req) Survey Date
  1. ; 2 - BIPG (req) Group of patients (9=Individual)
  1. ; 3 - BIPAT (opt) Patient DFN's (array) if BIPG=9
  1. ; 4 - BIAG (req) Age Range (=0 if not limited by age)
  1. ; 5 - BIHCF (req) Facility (array)
  1. ; 6 - BICC (req) Current Community (array)
  1. ; 7 - BIMMR (req) Immunizations Received, IEN's (array)
  1. ; 8 - BIDE (req) Data Elements to be passed (array)
  1. ; 9 - BIFMT (req) Format: 1=ASCII,2=HL7,3=ImmServe
  1. ; 10 - BIOUT (req) Export: 0=screen, 1=host file
  1. ; 11 - BIFLNM (opt) File name
  1. ; 12 - BIPATH (opt) Path name for File
  1. ;
  1. ; 13 - BIMMRF (opt) Immunizations filtered for output, CVX's (array)
  1. ; 14 - BIRDT (opt) Date Range for Imms Received.
  1. ;
  1. ;
  1. ;---> Check for required variables.
  1. N BIERR S BIERR=""
  1. D
  1. .I '$D(BISVDT) S BIERR=640 Q
  1. .I '$D(BIPG) S BIERR=641 Q
  1. .I BIPG=9&('$O(BIPAT(0))) S BIERR=650 Q
  1. .I '$D(BIAG) S BIERR=642 Q
  1. .I '$D(BIHCF) S BIERR=643 Q
  1. .I '$D(BICC) S BIERR=644 Q
  1. .I '$D(BIMMR) S BIERR=645 Q
  1. .I '$D(BIDE)&(BIFMT=1) S BIERR=646 Q
  1. .I '$D(BIFMT) S BIERR=647 Q
  1. .I '$D(BIOUT) S BIERR=648 Q
  1. .I BIOUT,$G(BIFLNM)="" S BIERR=649 Q
  1. .I BIOUT,$G(BIPATH)="" S BIERR=651 Q
  1. ;
  1. ;---> If an error exists, report it and return to first screen.
  1. I BIERR D Q
  1. .D ERRCD^BIUTL2(BIERR,,1),@("RESET^"_BIRTN)
  1. ;
  1. ;
  1. D INIT N BIPOP
  1. ;
  1. ;---> If exporting all Data Elements, set them now.
  1. D:$D(BIDE("ALL")) BIDE(.BIDE)
  1. ;
  1. ;---> If format is ImmServe, set Data Elements necessary for ImmServe.
  1. I BIFMT=3 D BIDE^BIPATUP(.BIDE)
  1. ;
  1. ;---> Get okay to proceed.
  1. D FULL^VALM1
  1. D TITLE^BIUTL5("EXPORT IMMUNIZATION RECORDS")
  1. D OKAY^BIEXPRT8(.BIPOP)
  1. I BIPOP D @("RESET^"_BIRTN) Q
  1. ;
  1. ;---> If export is to Host File, open Host File and test access,
  1. ;---> and LEAVE OPEN for export.
  1. D
  1. .I BIOUT D HFS^BIEXPRT8(BIFLNM,.BIPATH,1,.BIPOP) Q
  1. .S IOP=0 D ^%ZIS
  1. I BIPOP D @("RESET^"_BIRTN) Q
  1. ;
  1. ;---> Patients.
  1. D
  1. .;---> If individuals in local array, store in ^BITMP.
  1. .I BIPG=9 D Q
  1. ..N DFN S DFN=0 F S DFN=$O(BIPAT(DFN)) Q:'DFN S ^BITMP($J,1,DFN)=""
  1. .;
  1. .;---> Gather patients by group and store in ^BITMP.
  1. .;
  1. .;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
  1. .;---> Changes to limit export of imms to specific vaccines within
  1. .;---> a date range. Parameters BIMMR and BIRDT added below.
  1. .;D PATIENT^BIEXPRT2(BIPG,BIAG,BISVDT,.BIHCF,.BICC)
  1. .D PATIENT^BIEXPRT2(BIPG,BIAG,BISVDT,.BIHCF,.BICC,.BIMMR,$G(BIRDT))
  1. ;
  1. ;---> Gather Immunization History for each patient stored.
  1. ;---> (If not all vaccines, gather only ones selected--BIMMR.)
  1. ;---> If ImmServe export, get vaccines that should not be forecast.
  1. I BIFMT=3 D NOFORC^BIPATUP(.BINF)
  1. ;
  1. D HISTORY^BIEXPRT3(BIFMT,.BIDE,.BIMMRF,,,,.BINF)
  1. ;**********
  1. ;
  1. ;---> Export data.
  1. D WRITE^BIEXPRT4(BIOUT,BIFMT,$G(BIFLNM),$G(BIPATH),,1)
  1. ;
  1. ;---> If Data Element array was built for ImmServe, kill it.
  1. K:BIFMT=3 BIDE
  1. ;
  1. ;---> Return to calling routine.
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. INIT ;EP
  1. ;---> Initialization.
  1. K ^BITMP($J)
  1. D SETVARS^BIUTL5
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. BIDE(BIDE) ;EP
  1. ;---> Build local array of ALL Data Elements (for cases when
  1. ;---> user selects all data elements).
  1. ;
  1. N N S N=0
  1. F S N=$O(^BIEXPDD(N)) Q:'N S BIDE(N)=""
  1. Q