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

BIOUTPT5.m

Go to the documentation of this file.
  1. BIOUTPT5 ;IHS/CMI/MWR - WRITE SUBHEADERS.; AUG 10,2010
  1. ;;8.5;IMMUNIZATION;;SEP 01,2011
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; WRITE SUBHEADER LINES TO ^TMP FOR REPORTS.
  1. ;; v8.4 PATCH 1: Manage subheader Items more than 20. SUBH+35
  1. ;
  1. ;
  1. ;----------
  1. SUBH(BIAR,BITEM,BITEMS,BIGBL,BILINE,BIERR,BIPC,BITM,BIAPP) ;EP
  1. ;---> If specific Items were selected (not ALL), then list them
  1. ;---> in a subheader at the top of the report.
  1. ;---> Parameters:
  1. ; 1 - BIAR (req) Array of Item IENs to be displayed.
  1. ; 2 - BITEM (req) Categoric name of Items being displayed.
  1. ; 3 - BITEMS (opt) Plural form of Categoric Item name.
  1. ; Provide this only if it's an exception.
  1. ; 4 - BIGBL (req) Item global OR File#-Field# for Set of Codes.
  1. ; 5 - BILINE (ret) Line number in ^TMP Listman array.
  1. ; 6 - BIERR (ret) Error Code returned, if any.
  1. ; 7 - BIPC (opt) Piece of Zero node to display as Item Name;
  1. ; default=1.
  1. ; 8 - BITM (opt) Top Margin.
  1. ; 9 - BIAPP (opt) Any text to be appended to the list, such as
  1. ; a date range.
  1. ;
  1. ;---> EXAMPLE:
  1. ; D SUBH^BIOUTPT5("BICC","Community",,"^AUTTCOM(",.BILINE,.BIERR)
  1. ;
  1. ;
  1. ;---> Check/set required variables.
  1. S BIERR=""
  1. Q:$$CHECK(.BIERR)
  1. S:'$G(BITM) BITM=12
  1. ;
  1. ;---> Quit and don't write subheader if "ALL" Items were selected
  1. ;---> (or if NO Items were selected).
  1. Q:$O(@(BIAR_"(0)"))=""
  1. Q:$D(@(BIAR_"(""ALL"")"))
  1. ;
  1. ;---> Check/set plural form of Item Name.
  1. I $G(BITEMS)="" D PLURAL^BISELECT(BITEM,.BITEMS)
  1. ;
  1. ;
  1. ;********** PATCH 1, v8.4, AUG 01,2010, IHS/CMI/MWR
  1. ;---> If more than 20 subheader items and list is to the screen, simply
  1. ;---> state that and quit.
  1. N M,N S (M,N)=0
  1. F S N=$O(@(BIAR_"(N)")) Q:'N S M=M+1
  1. I M>20 I $G(IOSL)<25 D Q
  1. .N X S X=" "_BITEMS_": More than 20; Print report or review "_BITEM_" parameter."
  1. .D WH^BIW(.BILINE,X)
  1. .D WH^BIW(.BILINE,$$SP^BIUTL5(79,"-"))
  1. ;**********
  1. ;
  1. ;
  1. ;---> If too much subheader text for screen, return error.
  1. I (BILINE>BITM)&($G(IOSL)<25) S BIERR=668 Q
  1. ;
  1. ;---> Alphabetize list.
  1. N BIAR1
  1. D
  1. .I +BIGBL D Q
  1. ..;---> Set of Codes.
  1. ..N BISET S BISET=$P($G(^DD($P(BIGBL,"-"),$P(BIGBL,"-",2),0)),U,3)
  1. ..N N S N=0
  1. ..F S N=$O(@(BIAR_"(N)")) Q:N="" D
  1. ...S BIAR1($P($P(BISET,N_":",2),";"))=""
  1. .;
  1. .;---> Entries from a File.
  1. .S:'$G(BIPC) BIPC=1
  1. .N N S N=0
  1. .F S N=$O(@(BIAR_"(N)")) Q:'N D
  1. ..S BIAR1($$NAME(N,BIGBL,BIPC))=""
  1. ;
  1. ;---> Set X=string of Items, pieced by "; " (or Z).
  1. N BIHEAD,I,N,Y,Z
  1. S N=0,X="",Z="; "
  1. F I=1:1 S N=$O(BIAR1(N)) Q:N="" D
  1. .S:I>1 X=X_Z S X=X_N
  1. ;---> Append any text such as date range.
  1. S:$G(BIAPP)]"" X=X_BIAPP
  1. S BIHEAD=" "_$S(I>2:BITEMS,1:BITEM)_": "
  1. ;
  1. ;---> Now write each line with as many Items as will fit on a line
  1. ;---> (hanging indent under the header "Item Name:").
  1. S N=1
  1. F D Q:$P(X,Z,I)="" Q:$G(BIERR)
  1. .F I=N:1 S Y=$P(X,Z,N,I) Q:$L(Y)>63 Q:$P(X,Z,I)=""
  1. .I N>1 S BIHEAD=$$SP^BIUTL5($L(BIHEAD))
  1. .I (BILINE>BITM)&($G(IOSL)<25) S BIERR=668 Q
  1. .D WH^BIW(.BILINE,BIHEAD_$P(X,Z,N,I-1))
  1. .S N=I
  1. ;
  1. D WH^BIW(.BILINE,$$SP^BIUTL5(79,"-"))
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. NAME(BIIEN,BIGBL,BIPC) ;EP
  1. ;---> Return the .01 for this IEN in BIGBL.
  1. ;---> Parameters:
  1. ; 1 - BIIEN (req) IEN of Item.
  1. ; 2 - BIGBL (req) Item global.
  1. ; 3 - BIPC (opt) Piece of Zero node to display (default=1).
  1. ;
  1. Q:'$G(BIIEN) 0 Q:$G(BIGBL)="" 0
  1. N X S:'$G(BIPC) BIPC=1
  1. S X=$P(@(BIGBL_BIIEN_",0)"),U,BIPC)
  1. Q:X="" 0
  1. Q X
  1. ;
  1. ;
  1. ;---> First, build array sorted by ItemName.
  1. N BIIEN S BIIEN=0
  1. F S BIIEN=$O(@(BIARR1_"(BIIEN)")) Q:'BIIEN D
  1. .;
  1. .;---> If IEN passed does not really exist in the File,
  1. .;---> remove it from the Selection Array.
  1. .I '$D(@(BIGBL_"BIIEN,0)")) K @(BIARR1_"(BIIEN)") Q
  1. .;
  1. .;---> If (previously stored) IEN does not pass the screen,
  1. .;---> then remove it from the Selection Array.
  1. .I BISCRN]"" N Y S Y=BIIEN X BISCRN I '$T K @(BIARR1_"(BIIEN)") Q
  1. .;
  1. .N BI0,BINAME,BIIDTX
  1. .S BI0=@(BIGBL_"BIIEN,0)")
  1. .S BINAME=$P(BI0,U,BIPIECE)
  1. .Q:BINAME=""
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. CHECK(BIERR) ;EP
  1. ;---> Check required variables.
  1. ;---> Parameters:
  1. ; 1 - BIERR (ret) Error Code returned, if any.
  1. ;
  1. ;---> Check that Subheader Array name is present.
  1. I $G(BIAR)="" S BIERR=656 Q 1
  1. ;
  1. ;---> Check that Categoric Item name is present.
  1. I $G(BITEM)="" S BIERR=657 Q 1
  1. ;
  1. ;---> Check Item global.
  1. I $G(BIGBL)="" S BIERR=658 Q 1
  1. ;
  1. ;---> Check that the Global or Set of Codes is legitimate.
  1. S BIERR=""
  1. D Q:BIERR 1
  1. .I +BIGBL D Q
  1. ..;---> Test for Set of Codes.
  1. ..N X,Y S X=$P(BIGBL,"-"),Y=$P(BIGBL,"-",2)
  1. ..I 'Y S BIERR=665 Q
  1. ..I '$D(^DD(X,Y,0)) S BIERR=665 Q
  1. .;
  1. .;---> Test for global (entries from a file).
  1. .I '$D(@(BIGBL_"0)")) S BIERR=659 Q
  1. ;
  1. Q 0
  1. ;
  1. ;
  1. ;----------
  1. RYEAR(BIYEAR,BIRTN) ;EP
  1. ;---> Ask the Report Year.
  1. ;---> Called by Protocol BI OUTPUT REPORT YEAR.
  1. ;---> Parameters:
  1. ; 1 - BIYEAR (ret) Report Year in yyyy format.
  1. ; (opt) Default Year.
  1. ; 2 - BIRTN (req) Calling routine for reset.
  1. ;
  1. I $G(BIRTN)="" D ERRCD^BIUTL2(621,,1) Q
  1. ;
  1. N DIR,DIRA,DIRB,DIRQ,DIRNOW,BIPOP
  1. S:$G(BIYEAR) DIRB=+BIYEAR
  1. D
  1. .I '$G(DT) S DIRNOW=2050 Q
  1. .S DIRNOW=1700+$E(DT,1,3)
  1. S DIRA=" Please enter a Report Year: "
  1. S:$G(BIYEAR) DIRB=+BIYEAR
  1. S DIRQ=" Enter a year between 1950 and the present, in the form yyyy"
  1. D FULL^VALM1
  1. D TITLE^BIUTL5("SELECT REPORT YEAR")
  1. D TEXT1 W !
  1. D DIR^BIFMAN("NAO^1950:"_DIRNOW,.Y,.BIPOP,DIRA,DIRB,DIRQ)
  1. I $G(BIPOP) D @("RESET^"_BIRTN) Q
  1. S BIYEAR=+Y
  1. I Y<1 D @("RESET^"_BIRTN) Q
  1. ;
  1. N DIR
  1. W !!?3,"You may select an End Date of either December 31, ",+BIYEAR
  1. W " or March 31, ",(+BIYEAR)+1,".",!
  1. S DIR("A")=" Select December or March: "
  1. S DIR("B")=$S($P(BIYEAR,U,2)="m":"March",1:"December")
  1. S DIR(0)="SAM^d:December;m:March"
  1. D ^DIR K DIR
  1. I Y=-1!($D(DIRUT)) D @("RESET^"_BIRTN) Q
  1. ;---> If Y="m" concate to BIYEAR to signify End Date of March 31. Otherwise,
  1. ;---> default is 2nd "^"-piece of BIYEAR=""--which is End Date of Dec 31.
  1. I Y="m" S BIYEAR=BIYEAR_U_"m"
  1. ;
  1. D @("RESET^"_BIRTN)
  1. ;
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT1 ;EP
  1. ;;The "Report Year" represents the start of a particular influenza
  1. ;;season. So, for example, 2011 will cover the influenza season from
  1. ;;September 1, 2011 until December 31, 2011 (or until March 31, 2012,
  1. ;;if that End Date is chosen).
  1. ;;
  1. ;;The patient ages in the report will be calculated as of 12/31 of the
  1. ;;Report Year you select (12/31/2011 in the above example).
  1. ;;
  1. D PRINTX("TEXT1")
  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. TEXT11(BITEXT) ;EP
  1. ;;In producing lists and letters, you may select the group of patients
  1. ;;you wish to include by specifying attributes of this screen, such as
  1. ;;"DUE" or "ACTIVE." These attributes may also be used in various
  1. ;;combinations in order to further specify your patient group.
  1. ;;(This group may be further limited by the other criteria you select
  1. ;;on the main IMMUNIZATION LISTS & LETTERS Main Screen, such as Age Range,
  1. ;;Communities, Lot Numbers, etc.)
  1. ;;
  1. ;; DUE
  1. ;; -----
  1. ;;"DUE" will list all Active patients who are DUE for immunizations,
  1. ;;subject to any other limitations on the Lists & Letters Main Screen,
  1. ;;such as Age Range, Community, etc.. "DUE" will also necessarily include
  1. ;;any patients who are "PAST DUE." By default, "DUE" will only include
  1. ;;patients who are "ACTIVE" unless you specify "INACTIVE" as one of the
  1. ;;attributes.
  1. ;;
  1. ;; PAST DUE
  1. ;; ----------
  1. ;;"PAST DUE" will only include patients who are past their due dates
  1. ;;for one or more immunizations. If you select this attribute, you
  1. ;;will be given the opportunity to specify how many months past due
  1. ;;you wish to check for. By default, "PAST DUE" will only include
  1. ;;patients who are "ACTIVE" unless you specify "INACTIVE" as one of the
  1. ;;attributes.
  1. ;;
  1. ;; ACTIVE and INACTIVE
  1. ;; ---------------------
  1. ;;The choices of "ACTIVE" and "INACTIVE" will simply list patients in the
  1. ;;Immunization Database who have the Statuses of Active or Inactive.
  1. ;;"ACTIVE" and "INACTIVE" may also be used together to produce a list
  1. ;;of all patients in the Immunization database.
  1. ;;
  1. ;;
  1. ;; AUTOMATICALLY ACTIVATED
  1. ;; -------------------------
  1. ;;"AUTOMATICALLY ACTIVATED" will restrict the list to only those patients
  1. ;;who were Automatically Activated in the Immunization database. You may
  1. ;;combine it with other attributes, such as ACTIVE or DUE, to produce a
  1. ;;list that is more specific. For example, you could produce a list of
  1. ;;patients who were AUTOMATICALLY ACTIVATED and are now PAST DUE.
  1. ;;
  1. ;;
  1. ;; REFUSALS
  1. ;; ----------
  1. ;;"REFUSALS" will restrict the list to only those patients who at some
  1. ;;point refused an immunization (either the patient or the parent).
  1. ;;You may combine REFUSALS with other attributes in order to produce a
  1. ;;list that is more specific. For example, you could produce a list of
  1. ;;patients who were both INACTIVE and had REFUSALS on record.
  1. ;;
  1. ;;
  1. ;; FEMALES ONLY
  1. ;; --------------
  1. ;;"FEMALES ONLY" will restrict the list to female patients only.
  1. ;;NOTE: The list will include both "ACTIVE" and "INACTIVE" female
  1. ;;patients unless you have specifically chosen Active or Inactive.
  1. ;;
  1. ;;
  1. ;; SEARCH TEMPLATES
  1. ;; ------------------
  1. ;;SEARCH TEMPLATEs are groups of individual patients that have been
  1. ;;produced and stored by other software, usually QMAN, and saved under
  1. ;;a Template Name. If you choose this attribute, you will be asked to
  1. ;;select from a file of existing Search Templates.
  1. ;;
  1. ;;NOTE: A SEARCH TEMPLATE is a pre-defined group of patients and cannot
  1. ;;be combined with any of the other attributes.
  1. ;;For more information about Search Templates and how to create your
  1. ;;own, contact your computer support people for training.
  1. ;;
  1. ;;
  1. ;;Final note: The implications of combining too many restrictive attributes
  1. ;;can be difficult to predict and may produce few or no results.
  1. ;;It is best to limit a list to two or three combined attributes.
  1. ;;
  1. D LOADTX("TEXT11",,.BITEXT)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. LOADTX(BILINL,BITAB,BITEXT) ;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'[";;" S BITEXT(I)=T_$P(X,";;",2)
  1. Q