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

BIDUPLT.m

Go to the documentation of this file.
  1. BIDUPLT ;IHS/CMI/MWR - BI PRINT LETTERS.; MAY 10, 2010
  1. ;;8.5;IMMUNIZATION;;SEP 01,2011
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; PRINT PATIENT LETTERS.
  1. ;
  1. ;
  1. ;----------
  1. PRINTDUE ;EP
  1. ;---> Print Immunization Due letters.
  1. ;---> Called by Protocol BI DUE LETTERS PRINT.
  1. ;---> Variables:
  1. ; 1 - BIAG (req) Age Range in months.
  1. ; 2 - BIPG (req) 0=Due, >0=Number of months Past Due.
  1. ; 3 - BICC (req) Current Community array.
  1. ; 4 - BICM (req) Case Manager array.
  1. ; 5 - BIDPRV (req) Designated Provider array.
  1. ; 6 - BIFDT (req) Forecast date.
  1. ; 7 - BIMMD (req) Immunization Due array.
  1. ; 8 - BIHCF (req) Health Care Facility array.
  1. ; 9 - BILOT (req) Lot Number array.
  1. ; 10 - BIORD (req) Order of listing.
  1. ; 11 - BIRDT (opt) Date Range for Received Imms (form BEGDATE:ENDDATE).
  1. ; 12 - BIBEN (req) Beneficiary Type array: either BIBEN(1) or BIBEN("ALL").
  1. ;
  1. ;---> Check for required Variables.
  1. I '$D(BIAG) D ERROR(613) Q
  1. I '$D(BIPG) D ERROR(620) Q
  1. I '$D(BICC) D ERROR(614) Q
  1. I '$D(BICM) D ERROR(615) Q
  1. I '$D(BIDPRV) D ERROR(680) Q
  1. I '$G(BIFDT) D ERROR(616) Q
  1. I '$D(BIMMD) D ERROR(638) Q
  1. I '$D(BIHCF) D ERROR(625) Q
  1. I '$D(BILOT) D ERROR(630) Q
  1. I '$G(BIORD) D ERROR(618) Q
  1. I '$D(BIBEN) S BIBEN(1)=""
  1. ;
  1. S BIPOP=0
  1. ;
  1. ;---> Select Form Letter.
  1. D FULL^VALM1,TITLE^BIUTL5("SELECT FORM LETTER")
  1. D DEFLET(.BIDFLT,DUZ(2))
  1. D ASKLET^BILETPR(.BILET,.BIDLOC,.BIPOP,BIDFLT)
  1. I BIPOP D RESET^BIDU Q
  1. ;
  1. ;---> Specify Minimum Interval days since last letter.
  1. D MINDAYS^BIOUTPT3(.BIMD,.BIPOP)
  1. I BIPOP D RESET^BIDU Q
  1. ;
  1. D DEVICE
  1. I BIPOP D RESET^BIDU Q
  1. ;
  1. ;
  1. ;---> Retrieve patients for this batch of letters.
  1. D RETRIEVE(.BIT,.BIERR)
  1. I $G(BIERR) D ERROR(BIERR),EXIT,RESET^BIDU Q
  1. ;
  1. ;---> Print letters for patients retrieved.
  1. D PRINT^BIDUPLT1(BILET,$G(BIDLOC),ION,BIFDT)
  1. D ^%ZISC
  1. D EXIT,RESET^BIDU
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. RETRIEVE(BIT,BIERR) ;EP
  1. ;---> Retrieve patients according to parameters set.
  1. ;---> Parameters:
  1. ; 1 - BIT (ret) Total Patients retrieved.
  1. ; 2 - BIERR (ret) If error, return Error#.
  1. ;
  1. ; vvv83
  1. D R^BIDUR(BIAG,BIPG,BIFDT,.BICC,.BICM,.BIMMR,.BIMMD,.BILOT,BIMD,BIORD,$G(BIRDT),,.BIT,.BIHCF,.BIDPRV,.BIERR,.BIBEN)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. DEVICE ;EP
  1. ;---> Get Device and possibly queue to Taskman.
  1. D FULL^VALM1
  1. K %ZIS,IOP
  1. S ZTRTN="DEQUEUE^BIDUPLT"
  1. D ZSAVES^BIUTL3
  1. D ZIS^BIUTL2(.BIPOP,1)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. DEQUEUE ;EP
  1. ;---> Retrieve patients for this batch of letters.
  1. D RETRIEVE(.BIT,.BIPOP)
  1. I BIPOP D EXIT Q
  1. ;
  1. ;---> Print letters for patients retrieved.
  1. D PRINT^BIDUPLT1(BILET,$G(BIDLOC),ION,BIFDT)
  1. D ^%ZISC
  1. D EXIT,KILLALL^BIUTL8(1)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. DEFLET(BILET,BISITE) ;EP
  1. ;---> Retrieve Immunizations Due Letter from Site Parameter file
  1. ;---> as the default letter for Immunizations Due.
  1. ;---> Parameters:
  1. ; 1 - BILET (ret) IEN of Imms Due Letter in BI LETTER File.
  1. ; 2 - BISITE (req) Site under which user is logged in.
  1. ;
  1. S BILET=""
  1. I '$D(^BISITE(BISITE,0)) D ERRCD^BIUTL2(103,,1) Q
  1. S BILET=$$DEFLET^BIUTL2(BISITE)
  1. I 'BILET D Q
  1. .D TEXT1 W !?22,$$INSTTX^BIUTL6(BISITE)
  1. .D DIRZ^BIUTL3(""," Press ENTER/RETURN to continue")
  1. .W !?5,"Returning to Print Due Letters...",!
  1. I '$D(^BILET(BILET,0)) D ERRCD^BIUTL2(108,,1) S BILET="" Q
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. TEXT1 ;EP
  1. ;;An Immunizations Due default letter has not been chosen for this
  1. ;;site. If you wish to have a default letter appear at this prompt,
  1. ;;you must use the "Edit Site Parameters" option under the "Manager
  1. ;;Menu" and select an "IMMUNIZATION DUE LETTER" in the Site Parameters
  1. ;;for this site:
  1. D PRINTX("TEXT1",5)
  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. ERROR(BIERR) ;EP
  1. ;---> Report error, reset Listman screen and quit.
  1. ;---> Parameters:
  1. ; 1 - BIERR (ret) Text of Error Code if any, otherwise null.
  1. ;
  1. S:'$G(BIERR) BIERR=999
  1. D ERRCD^BIUTL2(BIERR,,1) D RESET^BIDU Q
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. EXIT ;EP
  1. ;---> Cleanup and Quit.
  1. K ^TMP("BIDUL",$J)
  1. Q