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

BIOUTPT2.m

Go to the documentation of this file.
  1. BIOUTPT2 ;IHS/CMI/MWR - PROMPTS FOR REPORTS.; MAY 10, 2010
  1. ;;8.5;IMMUNIZATION;;SEP 01,2011
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; PROMPTS FOR REPORT PARAMETERS.
  1. ;
  1. ;
  1. ;----------
  1. SVDATE(BISVDT,BIPG,BIRTN) ;EP
  1. ;---> Select Survey Date. Called by Protocol BI EXPORT SURVEY DATE.
  1. ;---> Parameters:
  1. ; 1 - BISVDT (ret) Survey Date, Fileman format.
  1. ; (opt) Default Date.
  1. ; 2 - BIPG (req) Patient Group being surveyed.
  1. ; 3 - BIRTN (req) Calling routine for reset.
  1. ;
  1. I $G(BIRTN)="" D ERRCD^BIUTL2(621,,1) Q
  1. I $G(BIPG)="" D ERRCD^BIUTL2(639,,1),@("RESET^"_BIRTN) Q
  1. ;
  1. ;
  1. SVDATE1 ;EP
  1. S:$G(BISVDT)="" BISVDT=DT
  1. N BIDFLT,DIR S BIDFLT=$$TXDT^BIUTL5(BISVDT)
  1. S DIR(0)="DA^::PEX"
  1. S DIR("A")=" Please enter a Survey Date: ",DIR("B")=BIDFLT
  1. D FULL^VALM1
  1. D TITLE^BIUTL5("SELECT SURVEY DATE")
  1. D TEXT1 D:BIPG'=9 TEXT2,HELP2
  1. D ^DIR W !
  1. I $D(DIRUT) D RESET^BIDU Q
  1. S BISVDT=$P(Y,".")
  1. I BISVDT>DT D G SVDATE1
  1. .W !?5,"The date may not be in the future. "
  1. .W "It must be today or in the past."
  1. .K BISVDT D DIRZ^BIUTL3()
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT1 ;EP
  1. ;;Please select a Survey Date (no future dates).
  1. ;;
  1. ;;If the Survey Date is in the past, patient age(s) will be calculated
  1. ;;for that date, and immunizations given after that Survey Date will
  1. ;;not be included.
  1. ;;
  1. D PRINTX("TEXT1")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT2 ;EP
  1. ;;If you specify Age Range or Active Status, these will be calculated
  1. ;;based on the Survey Date you select here.
  1. ;;
  1. ;;If you specify a Patient Group based on visits, only visits up to
  1. ;;and including the Survey Date will be examined.
  1. ;;
  1. ;;Enter a "?" for further explanation.
  1. ;;
  1. D PRINTX("TEXT2")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. HELP2 ;EP
  1. ;;If you select a specific Age Range and a Survey Date in the past,
  1. ;;only patients whose ages fell within the Age Range on Survey Date
  1. ;;will be included in the export.
  1. ;;
  1. ;;If you select a group of patients based on Active Status, only
  1. ;;those patients who were Active on the Survey Date will be included.
  1. ;;Patients who became Inactive prior to the Survey Date will not be
  1. ;;included.
  1. ;;
  1. ;;If you select for all patients who have had immunizations, only
  1. ;;patients who have had immunizations on or before the Survey Date
  1. ;;will be included.
  1. D HELPTX("HELP2")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. PATIENT(BIPAT,BIRTN) ;EP
  1. ;---> Select Patient. Called by Protocol BI EXPORT PATIENT.
  1. ;---> Parameters:
  1. ; 1 - BIPAT (ret) Local array of Patient DFNs.
  1. ; 2 - BIRTN (req) Calling routine for reset.
  1. ;
  1. I $G(BIRTN)="" D ERRCD^BIUTL2(621,,1) Q
  1. ;
  1. ;---> Select one or more Patients.
  1. ;---> Display Identifiers: Sex, DOB, Chart#.
  1. N BIID S BIID="2;S X=$P(BI0,U,2)_"" ""_$$DOBF^BIUTL1(BIIEN,,1)"
  1. S BIID=BIID_"_"" ""_$$HRCN^BIUTL1(BIIEN,$G(DUZ(2)));40"
  1. N BIABBR S BIABBR=$$LOCABBR^BIUTL6($G(DUZ(2)))
  1. S:BIABBR="" BIABBR=$E($$INSTTX^BIUTL6($G(DUZ(2))),1,11)
  1. N BICOL S BICOL=" # Patient Sex DOB"
  1. S BICOL=BICOL_" Chart# at "_BIABBR
  1. D SEL^BISELECT(9000001,"BIPAT","Patient",,,,BIID,BICOL,.BIPOP,1)
  1. I $D(BIPAT("ALL")) D Q
  1. .D FULL^VALM1,TITLE^BIUTL5("SELECTING PATIENTS"),TEXT7
  1. .K BIPAT D DIRZ^BIUTL3()
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT7 ;EP
  1. ;;
  1. ;;You have selected ALL patients. In order to work with a group of
  1. ;;this size, other information is needed (such as Active Status, Age
  1. ;;Range, Communities, etc.).
  1. ;;
  1. ;;Please begin this export process again. The very first question
  1. ;;asks if you wish to select patients INDIVIDUALLY or by GROUP.
  1. ;;Choose "2) Select patients by GROUP", and proceed from there.
  1. ;;
  1. D PRINTX("TEXT7")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. DATAEL(BIDE,BIRTN) ;EP
  1. ;---> Select Data Elements.
  1. ;---> Called by Protocol BI OUTPUT DATA ELEMENTS.
  1. ;---> Parameters:
  1. ; 1 - BIDE (ret) Local array of Lot Number IENs.
  1. ; 2 - BIRTN (req) Calling routine for reset.
  1. ;
  1. I $G(BIRTN)="" D ERRCD^BIUTL2(621,,1) Q
  1. ;
  1. D FULL^VALM1 N BIPOP
  1. D TITLE^BIUTL5("SELECT DATA ELEMENTS"),TEXT3
  1. D DIRZ^BIUTL3(.BIPOP)
  1. I $G(BIPOP) D @("RESET^"_BIRTN) Q
  1. ;
  1. ;---> Screen: only Data Elements for Immunizations or All.
  1. N BIIT S BIIT="Data Element"
  1. N BISCR S BISCR="I ""AI""[$P(^BIEXPDD(Y,0),U,4)"
  1. N BICOL S BICOL=" # Data Element Synonym"
  1. D SEL^BISELECT(9002084.91,"BIDE",BIIT,BISCR,,,"3;;40",BICOL,.BIPOP,1)
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT3 ;EP
  1. ;;
  1. ;; NOTES
  1. ;; -------
  1. ;;Data Element selection only pertains to exports with ASCII Format.
  1. ;;(ImmServe Data Elements are predetermined.)
  1. ;;
  1. ;;The very first (or top) record will list, by title, the selected
  1. ;;Data Elements in the order in which they occur in the following
  1. ;;records.
  1. ;;
  1. D PRINTX("TEXT3")
  1. Q
  1. ;;(HL7 and ImmServe Data Elements are predetermined.)
  1. ;;
  1. ;;If you intend to export in HL7 or ImmServe formats, disregard this
  1. ;;Data Element selection.
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. FORMAT(BIFMT,BIRTN) ;EP
  1. ;---> Select Format for record export.
  1. ;---> Called by Protocol BI EXPORT FORMAT.
  1. ;---> Parameters:
  1. ; 1 - BIFMT (ret) File Format (1=ASCII,2=HL7,3=ImmServe).
  1. ; 2 - BIRTN (req) Calling routine for reset.
  1. ;
  1. I $G(BIRTN)="" D ERRCD^BIUTL2(621,,1) Q
  1. ;
  1. D FULL^VALM1
  1. D TITLE^BIUTL5("SELECT EXPORT FORMAT"),TEXT4
  1. N Y S:'$G(BIFMT) BIFMT=1
  1. S A=" Please select a Format: "
  1. ;
  1. ;---> Remove HL7, at least for now.
  1. ;D DIR^BIFMAN("SM^1:ASCII;2:HL7;3:ImmServe",.Y,.BIPOP,A,"ASCII")
  1. D DIR^BIFMAN("SM^1:ASCII;3:ImmServe",.Y,.BIPOP,A,"ASCII")
  1. S:Y BIFMT=Y
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT4 ;EP
  1. ;;You may export records in either ASCII or ImmServe format.
  1. ;;
  1. ;;ASCII format will produce the Data Elements you specify for each
  1. ;;immunization on a separate line or record. Data Elements will be
  1. ;;separated by quote-comma-quote (known as a CSV file).
  1. ;;
  1. ;;ImmServe is a commercial, vendor-specific format of use only to
  1. ;;programmers working with this software.
  1. D PRINTX("TEXT4")
  1. Q
  1. ;;---> Removed from above, for now at least.
  1. ;;HL7 will produce Immunization records according to the HL7 standard.
  1. ;
  1. ;
  1. ;----------
  1. OUTPUT(BIOUT,BIFLNM,BIPATH,BIRTN) ;EP
  1. ;---> Select Output Device for Export Data.
  1. ;---> Called by Protocol BI EXPORT OUTPUT DEVICE.
  1. ;---> Parameters:
  1. ; 1 - BIOUT (ret) 0=Screen, 1=File.
  1. ; 2 - BIFLNM (ret) File name given by the user.
  1. ; 3 - BIPATH (ret) Path name set in Site Parameters.
  1. ; 4 - BIRTN (req) Calling routine for reset.
  1. ;
  1. I $G(BIRTN)="" D ERRCD^BIUTL2(621,,1) Q
  1. ;
  1. D FULL^VALM1
  1. D TITLE^BIUTL5("SELECT OUTPUT DEVICE"),TEXT5
  1. N BIPOP,Y S:'$D(BIOUT) BIOUT=0
  1. ;
  1. N A,B S A=" Select SCREEN or FILE: "
  1. S B=$S(BIOUT:"FILE",1:"SCREEN")
  1. D DIR^BIFMAN("SAM^0:SCREEN;1:FILE",.Y,.BIPOP,A,B)
  1. ;
  1. ;---> If user chose Screen, or ^out, quit.
  1. S BIOUT=Y
  1. I 'BIOUT!($G(BIPOP)) D @("RESET^"_BIRTN) Q
  1. ;
  1. ;---> Enter file name, if required.
  1. D TITLE^BIUTL5("ENTER OUTPUT FILE NAME")
  1. F D Q:BIPOP Q:BIFLNM]""
  1. .N Q,Z D TEXT6
  1. .S Q=" Contact your site manager for assistance."
  1. .S Z=" Enter the file name without any path "
  1. .S Z=Z_"--just the file name itself."
  1. .D DIR^BIFMAN("FA",.BIFLNM,.BIPOP," Enter file name: ","",Q,Z)
  1. .Q:BIPOP
  1. .I BIFLNM["\"!(BIFLNM["/")!(BIFLNM[":")!(BIFLNM[";")!(BIFLNM[" ") D
  1. ..W !!?5,"File name must not contain ""\"", ""/"", "":"" or spaces."
  1. ..S BIFLNM=""
  1. ;
  1. ;---> Quit if user up-arrowed out.
  1. I BIFLNM["^" S BIFLNM="" D @("RESET^"_BIRTN) Q
  1. ;
  1. ;---> Return path, open Host File and test access and close it.
  1. D HFS^BIEXPRT8(BIFLNM,.BIPATH,0,.BIPOP)
  1. I $G(BIPOP) D @("RESET^"_BIRTN) Q
  1. ;
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT5 ;EP
  1. ;;There are two methods of exporting the data.
  1. ;;
  1. ;;You may either:
  1. ;;
  1. ;; * Select SCREEN to send the data to your screen. If you are using
  1. ;; a PC, this method will allow you to capture the output of data to
  1. ;; your screen and then save it as a file. However, you must refer
  1. ;; to your PC software documentation for help with this procedure.
  1. ;;or
  1. ;;
  1. ;; * Select FILE, to send the exported data to a host file.
  1. ;; If your data is sent to a host file, it can then be copied to
  1. ;; a floppy or transmitted to another computer for processing.
  1. ;; See your sitemanager for help with this procedure.
  1. ;;
  1. D PRINTX("TEXT5")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT6 ;EP
  1. ;;
  1. ;;Enter a name for the file you are exporting. The file name must
  1. ;;conform the filenaming conventions of your operating system.
  1. ;;Do not include any slashes, colons, or spaces in the file name.
  1. ;;
  1. ;;The Export File will have a path name prepended to the filename you
  1. ;;enter here. The path is set in the Site Parameters (MGR-->ESP) by
  1. ;;your Site Manager or Package Manager.
  1. ;;
  1. D PRINTX("TEXT6")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. PRINTX(BILINL,BITAB) ;EP
  1. Q:$G(BILINL)=""
  1. N I,T,X S T="" S:'$D(BITAB) BITAB=5 F I=1:1:BITAB S T=T_" "
  1. F I=1:1 S X=$T(@BILINL+I) Q:X'[";;" W !,T,$P(X,";;",2)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. HELPTX(BILINL,BITAB) ;EP
  1. N I,T,X S T="" S:'$D(BITAB) BITAB=5 F I=1:1:BITAB S T=T_" "
  1. F I=1:1 S X=$T(@BILINL+I) Q:X'[";;" S DIR("?",I)=T_$P(X,";;",2)
  1. S DIR("?")=DIR("?",I-1) K DIR("?",I-1)
  1. Q