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

BIOUTPT3.m

Go to the documentation of this file.
  1. BIOUTPT3 ;IHS/CMI/MWR - PROMPTS FOR REPORTS.; MAY 10, 2010
  1. ;;8.5;IMMUNIZATION;**9**;OCT 01,2014
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; PROMPTS FOR REPORT PARAMETERS.
  1. ;; PATCH 1: Clarify Date Range on Imms Received with added prompt. IMMRCV+20
  1. ;; PATCH 2: Add two more questions, U19 and DELIM.
  1. ;; PATCH 9: Corrected spelling and setting of parameter BIMMRF. IMMRCV+0
  1. ;
  1. ;
  1. ;----------
  1. MINDAYS(BIMD,BIPOP) ;EP
  1. ;---> Select Minimum Number of days since last letter sent.
  1. ;---> Called by routine BIDUPLT.
  1. ;---> Parameters:
  1. ; 1 - BIMD (ret) Minimum Days since Last Letter.
  1. ; 2 - BIPOP (ret) BIPOP=1 if DTOUT or DUOUT
  1. ;
  1. D FULL^VALM1
  1. D TITLE^BIUTL5("SELECT MINIMUM DAYS SINCE LAST LETTER")
  1. W !!?3,"Please specify the minimum number of days between a patient's"
  1. W !?3,"previous letter and today's letter."
  1. W !?3,"Type ""?"" (no quotes) for further explanation.",!!
  1. N DIR,DIRUT D HELP2
  1. S DIR(0)="NOA^0:9999:0"
  1. S DIR("A")=" Enter Number of Days: "
  1. S DIR("B")=$$MINDAYS^BIUTL2(DUZ(2))
  1. D FULL^VALM1
  1. D ^DIR
  1. I $D(DIRUT) S BIPOP=1 Q
  1. S BIMD=+Y S:BIMD<0 BIMD=$$MINDAYS^BIUTL2(DUZ(2))
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. HELP2 ;EP
  1. ;;The Minimum Days Since Last Letter is the least number of days that
  1. ;;must elapse--after a letter has been sent to a patient--before the
  1. ;;software will automatically send another letter to that same patient.
  1. ;;
  1. ;;For example, if a patient received a letter 2 weeks ago and
  1. ;;the Minimum Days Last Letter is 60 days, then this software will
  1. ;;not generate a new letter for that patient today, even if the patient
  1. ;;fits the other criteria you have selected for Age, Community,
  1. ;;Immunizations Due, etc.
  1. D HELPTX("HELP2")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. LOTNUM(BILOT,BIRTN) ;EP
  1. ;---> Select Lot Numbers.
  1. ;---> Called by Protocol BI OUTPUT LOT NUMBER.
  1. ;---> Parameters:
  1. ; 1 - BILOT (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. ;---> Select cases for one or more LOT NUMBERS (OR ALL).
  1. N BIID S BIID="2;I $G(X) S:$D(^AUTTIMAN(X,0)) X=$P(^(0),U);17"
  1. N BICOL S BICOL=" # Lot Number Manufacturer"
  1. D SEL^BISELECT(9999999.41,"BILOT","Lot Number",,,,BIID,BICOL,.BIPOP)
  1. ;
  1. ;
  1. D:('$D(BILOT("ALL")))
  1. .D TITLE^BIUTL5("FULL OR LIMITED HISTORY")
  1. .D TEXT7
  1. .S B=$S($D(BI):"Yes",1:"No")
  1. .D DIR^BIFMAN("YAO",.Y,," Limit histories to selected lot numbers? (Yes/No): ",B)
  1. .I 'Y K BIMMLF Q
  1. .N N S N=0
  1. .F S N=$O(BILOT(N)) Q:'N D
  1. ..N M S M=$$LOTTX^BIUTL6(N)
  1. ..S:M BIMMLF(M)=""
  1. ;
  1. ;
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. PGROUP2(BIPG,BIRTN) ;EP
  1. ;---> Selecting Patient Group (instead of individually).
  1. ;---> Called by Protocol BI OUTPUT IMMUNIZATION DUE.
  1. ;---> Parameters:
  1. ; 1 - BIPG (ret) Patient Group.
  1. ; 2 - BIRTN (req) Calling routine for reset.
  1. ;
  1. I $G(BIRTN)="" D ERRCD^BIUTL2(621,,1) Q
  1. ;
  1. ;---> Select group of patients to be exported.
  1. S:'$G(BIPG) BIPG=1
  1. N DIR,X
  1. D FULL^VALM1
  1. D TITLE^BIUTL5("SELECT PATIENT GROUP"),TEXT1,HELP1
  1. S X="SO^1:Active only;2:Active + Inactive"
  1. S X=X_";3:All who have had an Immunization Visit"
  1. S DIR(0)=X,DIR("B")=BIPG
  1. D ^DIR
  1. S:'$D(DIRUT) BIPG=+Y
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT1 ;EP
  1. ;;Please select a Patient Group from the following:
  1. ;;
  1. ;; 1) Only patients who were ACTIVE in the Immunization Register on
  1. ;; the Survey Date.
  1. ;;
  1. ;; 2) BOTH Active and Inactive patients in the Immunization Register.
  1. ;;
  1. ;; 3) ALL patients who have had an Immunization at the selected
  1. ;; facility(s), including those NOT in the Immunization Register.
  1. ;;
  1. D PRINTX("TEXT1",3)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. HELP1 ;EP
  1. ;;
  1. ;;
  1. ;;Choose a number 1-3 that represents the group of Patients whose
  1. ;;data you wish to export.
  1. ;;
  1. ;;NOTE: This group will be subject to the other selections you make
  1. ;; regarding Age Range, Community, Health Care Facility, etc.
  1. ;;
  1. D HELPTX("HELP1")
  1. Q
  1. ;
  1. ;
  1. ;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
  1. ;---> Corrected spelling and setting of parameter BIMMRF below.
  1. ;----------
  1. IMMRCV(BIMMR,BIRDT,BIMMRF,BIRTN) ;EP
  1. ;---> Select Immunizations Received.
  1. ;---> Called by Protocol BI OUTPUT IMMUNIZATION RECEIVED.
  1. ;---> Parameters:
  1. ; 1 - BIMMR (ret) Local array of Vaccine IENs.
  1. ; 2 - BIRDT (ret) Date Range for Imms received: BeginDate_":"_EndDate
  1. ; 3 - BIMMRF (ret) Local array of Vaccine IENs to be filtered.
  1. ; 4 - BIRTN (req) Calling routine for reset.
  1. ;
  1. I $G(BIRTN)="" D ERRCD^BIUTL2(621,,1) Q
  1. ;
  1. ;---> Select cases for one or more IMMUNIZATIONS RECEIVED (OR ALL).
  1. N BICOL S BICOL=" # Vaccine Received HL7 Code"
  1. D SEL^BISELECT(9999999.14,"BIMMR","Vaccine",,,2,"3;;24",BICOL,.BIPOP)
  1. ;
  1. D:'$G(BIPOP)
  1. .N BIBEGDT,BIENDDT,BIBEGDF,BIENDDF,X
  1. .S X=$G(BIRDT) S BIBEGDF=$P(X,":"),BIENDDF=$P(X,":",2)
  1. .S:'BIBEGDF BIBEGDF=2000101 S:'BIENDDF BIENDDF=$G(DT)
  1. .D TITLE^BIUTL5("SELECT IMMUNIZATION RECEIVED DATE RANGE")
  1. .D TEXT4
  1. .;
  1. .W !!," Do you wish to specify a date range for immunizations received?"
  1. .N DIR S DIR("?")=" Enter YES to specify a date range; NO to ignore dates."
  1. .S DIR(0)="Y",DIR("A")=" Enter Yes or No",DIR("B")="NO"
  1. .D ^DIR W !
  1. .I ($D(DIRUT)!'$G(Y)) S BIRDT="" Q
  1. .;
  1. .D TITLE^BIUTL5("SELECT IMMUNIZATION RECEIVED DATE RANGE")
  1. .D TEXT5
  1. .D ASKDATES^BIUTL3(.BIBEGDT,.BIENDDT,.BIPOP,BIBEGDF,BIENDDF)
  1. .Q:$G(BIPOP)
  1. .S:'BIBEGDT BIBEGDT=2000101 S:'BIENDDT BIENDDT=$G(DT)
  1. .S BIRDT=BIBEGDT_":"_BIENDDT
  1. ;
  1. D:('$D(BIMMR("ALL")))
  1. .D TITLE^BIUTL5("FULL OR LIMITED HISTORY")
  1. .D TEXT6
  1. .S B=$S($D(BI):"Yes",1:"No")
  1. .D DIR^BIFMAN("YAO",.Y,," Limit histories to selected vaccines? (Yes/No): ",B)
  1. .I 'Y K BIMMRF S BIMMRF("ALL")="" Q
  1. .K BIMMRF("ALL")
  1. .N N S N=0
  1. .F S N=$O(BIMMR(N)) Q:'N D
  1. ..S BIMMRF(N)=""
  1. ;**********
  1. ;
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT4 ;EP
  1. ;;You may limit this list to patients who have received the vaccines
  1. ;;you selected within a specific date range. This date range will
  1. ;;apply to your list, whether you have chosen just one vaccine or
  1. ;;several vaccines or all vaccines.
  1. ;;
  1. ;;NOTE: If you selected "ALL" vaccines and do NOT specify a date range,
  1. ;;then this filter becomes essentially inactive and will have no effect
  1. ;;on your list (patients will not be excluded on the basis of immunizations
  1. ;;received, even if they have never received any immunization).
  1. ;;
  1. ;;However, if you selected "ALL" vaccines and you DO specify a date range,
  1. ;;then only patients who have received AT LEAST ONE immunization during
  1. ;;your date range will be included. (Patients who did not receive ANY
  1. ;;immunizations during your date range will be excluded from the report.)
  1. ;;
  1. D PRINTX("TEXT4")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT5 ;EP
  1. ;;By default, the date range is from 1/1/1900 to today (essentially
  1. ;;not limited by date). However, you can specify a different date
  1. ;;range below. Only patients who have received the specified vaccines
  1. ;;within the date range you select will be included in the list.
  1. ;;
  1. D PRINTX("TEXT5")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT6 ;EP
  1. ;;You have limited your list to patients who have received one or more
  1. ;;of the specific vaccines you selected.
  1. ;;
  1. ;;If you print/export their immunization histories in a list, would you
  1. ;;like to include the history of ONLY the vaccines you selected?
  1. ;;
  1. ;;Or would you like to include the ENTIRE patient histories?
  1. ;;
  1. ;;NOTE: If you have limited your export to patients who have received
  1. ;;one or more vaccines WITHIN A DATE RANGE, but you also elect to include
  1. ;;their entire immunization histories, then some immunizations outside the
  1. ;;date range will most likely be included in the export.
  1. ;;
  1. ;;THIS IS NOT AN ERROR. It is merely a consequence of including the entire
  1. ;;histories of patients who have already been filtered for the specific
  1. ;;vaccine within the date range.
  1. ;;
  1. D PRINTX("TEXT6")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT7 ;EP
  1. ;;You have limited your list to patients who have received one or more
  1. ;;specific lot numbers.
  1. ;;
  1. ;;If you print their immunization histories in a list, would you like
  1. ;;to display only the history of the lot numbers you selected?
  1. ;;
  1. D PRINTX("TEXT7")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. IMMDUE(BIMMD,BIRTN) ;EP
  1. ;---> Select Immunizations Due.
  1. ;---> Called by Protocol BI OUTPUT IMMUNIZATION DUE.
  1. ;---> Parameters:
  1. ; 1 - BIMMD (ret) Local array of Vaccine IENs.
  1. ; 2 - BIRTN (req) Calling routine for reset.
  1. ;
  1. I $G(BIRTN)="" D ERRCD^BIUTL2(621,,1) Q
  1. ;
  1. ;---> Select cases for one or more IMMUNIZATIONS DUE (OR ALL).
  1. N BICOL S BICOL=" # Vaccine Due HL7 Code"
  1. D SEL^BISELECT(9999999.14,"BIMMD","Vaccine",,,2,"3;;19",BICOL,.BIPOP)
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. HISTORC(BIHIST,BIRTN) ;EP
  1. ;---> Select whether to include Historical Visits.
  1. ;---> Called by Protocol BI OUTPUT HISTORICAL.
  1. ;---> Parameters:
  1. ; 1 - BIHIST (ret) Include Historical (1=yes,0=no).
  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("INCLUDE HISTORICAL VISITS"),TEXT2
  1. N A,B,Y S:'$G(BIHIST) BIHIST=1
  1. S A=" Include Historical Visits (Yes/No): "
  1. S B=$S(BIHIST:"YES",1:"NO")
  1. D DIR^BIFMAN("YA",.Y,,A,B)
  1. S BIHIST=+Y
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT2 ;EP
  1. ;;Should Historical Visits be included in this report?
  1. ;;
  1. ;;"Historical" refers to the Category field of a Visit as displayed and
  1. ;;edited on the ADD/EDIT IMMUNIZATION Screen for Immunization Visits.
  1. ;;
  1. ;;A Visit may be given a Category of "Historical Event" rather than
  1. ;;"Ambulatory" or "Inpatient" for a variety of reasons, for example:
  1. ;;An immunization that was not administered at the current clinic but
  1. ;;merely added to the record for completeness might be "Historical".
  1. ;;Immunizations not intended to be picked up by Billing could be
  1. ;;given a Category of "Historical".
  1. ;;
  1. ;;Please select whether to include Historical Visits in this report.
  1. ;;
  1. D PRINTX("TEXT2")
  1. Q
  1. ;
  1. ;
  1. U19(BIU19,BIRTN) ;EP
  1. ;---> Select whether to limit Elig Report to patients <19 yrs of age.
  1. ;---> Called by Protocol BI OUTPUT INCLUDE ADULTS.
  1. ;---> Parameters:
  1. ; 1 - BIU19 (ret) Include Adults (1=yes,0=no).
  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("INCLUDE ADULTS"),TEXT8
  1. N A,B,Y S:($G(BIU19)="") BIU19=0
  1. S A=" Include Adult visits (Yes/No): "
  1. S B=$S(BIU19:"YES",1:"NO")
  1. D DIR^BIFMAN("YA",.Y,,A,B)
  1. S BIU19=+Y
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT8 ;EP
  1. ;;Should immunizations be included that were given when the patient
  1. ;;was 19 years of age or older?
  1. ;;
  1. ;;If you are primarily interested in a Vaccine For Children (VFC)
  1. ;;Eligibility report, then answer "No."
  1. ;;
  1. ;;If you are interested in an Eligibility report that covers adults
  1. ;;as well as children, then answer "Yes."
  1. ;;
  1. D PRINTX("TEXT8")
  1. Q
  1. ;
  1. ;
  1. DELIM(BIDELIM,BIRTN) ;EP
  1. ;---> Select which Delimiter to use, "2 spaces" or "^".
  1. ;---> Called by Protocol BI OUTPUT DILIMITER.
  1. ;---> Parameters:
  1. ; 1 - BIDELIM (ret) Delimiter (1="^", 2="2 spaces").
  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 DELIMITER"),TEXT9
  1. ;
  1. N DIR,Y
  1. S DIR("A")=" Select 1 for ""caret ^"" or 2 for ""2 spaces"": "
  1. S DIR("B")=$S($G(BIDELIM)=1:"caret",1:"2 spaces")
  1. S DIR(0)="SAM^1:caret;2:2 spaces"
  1. D ^DIR K DIR
  1. D
  1. .I Y=1 S BIDELIM=1 Q
  1. .S BIDELIM=2
  1. ;
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT9 ;EP
  1. ;;This report displays six data fields of each immunizatioin in
  1. ;;six columns. They are:
  1. ;;
  1. ;;(1)Date 2)Last,First Name (3)DOB (4)Eligibility (5)Vaccine (6)Lot#
  1. ;;
  1. ;;In the display, these six fields will be separated from each other by
  1. ;;a "delimiter." The delimiter can be either a caret "^" or "2 spaces".
  1. ;;
  1. ;;The default delimiter is "2 spaces". However, when the intention is
  1. ;;to print or copy the report to a text file for the purpose of importing
  1. ;;it into Excel or some other spreadsheet, use of the caret "^" is
  1. ;;preferable and recommended. (Spaces in the data itself might sometimes
  1. ;;be confused with spaces in the delimiter and/or spaces used to make the
  1. ;;columns line up.)
  1. ;;
  1. D PRINTX("TEXT9")
  1. Q
  1. ;
  1. ;
  1. DISBLOT(BIDLOT,BIRTN) ;EP
  1. ;---> Select whether to display VAC Report by Lot Number.
  1. ;---> Called by Protocol BI OUTPUT DISPLAY BY LOT NUMBER.
  1. ;---> Parameters:
  1. ; 1 - BIDLOT (req) Display by Lot Number (1=yes,0=no).
  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("DISPLAY REPORT BY LOT NUMBERS"),TEXT3
  1. N A,B,Y S:'$G(BIDLOT) BIDLOT=0
  1. S A=" Display by Lot Numbers (Yes/No): "
  1. S B=$S(BIDLOT:"YES",1:"NO")
  1. D DIR^BIFMAN("YA",.Y,,A,B)
  1. S BIDLOT=+Y
  1. D @("RESET^"_BIRTN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT3 ;EP
  1. ;;Should the vaccines in this report to be displayed by lot number?
  1. ;;
  1. ;;By default, this report lists the statistics by age for each vaccine.
  1. ;;However, you may elect to display the statistics for each separate
  1. ;;lot number under each vaccine. The totals for all lot numbers of
  1. ;;each vaccine will also be displayed.
  1. ;;
  1. ;;Please select whether to display the report by Lot Numbers.
  1. ;;
  1. D PRINTX("TEXT3")
  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