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

TIUPRPN7.m

Go to the documentation of this file.
  1. TIUPRPN7 ;SLC/MJC - Progress Notes Outpt Batch Prt ;6/26/01
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**45,100,121**;Jun 20, 1997
  1. ;
  1. BATCH ;batch print outpatient progress notes sorted by terminal digit
  1. ;if you wish to exlude a particular hospital location from this
  1. ;print option that can be specified in the
  1. ;EXCLUDE FROM BATCH PRINTING field of file 8925.93
  1. ;[TIU PRINT PN BATCH INTERACTIVE]
  1. ;
  1. N Y,TIUQT,TIUSTART,TIUDIV,ANS,LAST,DIV
  1. D SETUP^TIUPRPN3("Batch Print Outpatient Progress Notes by Terminal Digit")
  1. W !!?5,"Notes will be printed in terminal digit order."
  1. W !!?5,"This option may also be scheduled to run non-interactively"
  1. W !?5,"in file #19.2 OPTION SCHEDULING FILE.",!!
  1. ;
  1. I $D(^TIU(8925.94,0))'=1 W $C(7),$C(7),!?5,"Before using this option "
  1. I W "you must enter the divisions for your site in"
  1. I W !?5,"file #8925.94 - TIU DIVISION PRINT PARAMETERS FILE." Q
  1. ;
  1. S DIC=8925.94,DIC(0)="AEQMNZ",DIC("A")="Select DIVISION: "
  1. S DIC("B")=$P($G(^DG(40.8,+$G(^DISV(DUZ,"^TIU(8925.94,")),0),""),U)
  1. D ^DIC K DIC Q:Y<0
  1. S TIUDIV=+Y(0)_U_+Y_U_Y(0,0)
  1. ;ien medical center div^ien tiu param^external division
  1. S LAST=$P($G(^TIU(8925.94,+$P(TIUDIV,U,2),1)),U)
  1. I LAST']"" S TIUSTART=$$DATE^TIUPRPN4() Q:TIUSTART']""
  1. I LAST]"" D Q:$D(TIUQT)
  1. .W !!,"Notes were last printed for '"_$P(TIUDIV,U,3)_"' "
  1. .W $$FMTE^XLFDT(LAST,"1P"),!
  1. .S ANS=$$READ^TIUU("YA","Print from this DATE/TIME on? ","YES","D HELP^TIUPRPN5")
  1. .I $D(DIRUT) S TIUQT=1 Q
  1. .I +$G(ANS) S TIUSTART=LAST Q
  1. .D 3^TIUPRPN5 S TIUSTART=$$DATE^TIUPRPN4() I TIUSTART']"" S TIUQT=1 Q
  1. DEV S %ZIS("B")=$P($G(^%ZIS(1,+$P($G(^TIU(8925.94,$P(TIUDIV,U,2),1)),U,2),0),""),U) ;brings up default prter from 8925.94 param file
  1. W ! S %ZIS="Q" D ^%ZIS I POP K POP G EXIT
  1. I $E(IOST)="C" W $C(7),$C(7),!?5,"You must select a printer for this "
  1. I W "option!!" G DEV
  1. S TIUDIV=+$P(TIUDIV,U,2)
  1. I $D(IO("Q")) K IO("Q") D G EXIT
  1. .S ZTRTN="PRINT^TIUPRPN7",ZTSAVE("TIUSTART")="",ZTSAVE("TIUDIV")=""
  1. .S ZTDESC="TIU BATCH PRT PNS OUTPT DIV"
  1. .D ^%ZTLOAD W !,$S($D(ZTSK):"Request Queued!",1:"Request Canceled!")
  1. .K ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,STSAVE,%ZIS,TIUSTART,TIUDIV
  1. .D HOME^%ZIS
  1. U IO D PRINT,^%ZISC
  1. Q
  1. PRINT ;entry point for non-interactive tasked job
  1. ;requires TIUDIV set to the division you want notes for
  1. ;if queued non-interactively, file 8925.94- field #1.02 will need
  1. ;to contain the start time of the batch
  1. ;[TIU PRINT PN BATCH SCHEDULED]- entry point if called from file #19.2
  1. ;
  1. I '$D(TIUDIV) D TROUBLE G EXIT
  1. N DATE,LOC,IFN,SSN,DFN,STOP,DIV
  1. K ^TMP("TIUREPLACE",$J),^TMP("TIUPR",$J),^TMP("TIULQ",$J)
  1. S STOP=$$NOW^XLFDT
  1. I '$D(TIUSTART) S TIUSTART=$P($G(^TIU(8925.94,TIUDIV,1)),U)
  1. Q:TIUSTART']"" ;date not passed/no date in field 1.01 file #8925.94
  1. S DIV=+$P($G(^TIU(8925.94,TIUDIV,0)),U)
  1. S LOC=0
  1. F S LOC=$O(^TIU(8925,"ALOCP",LOC)) Q:'LOC D
  1. .Q:+$$LOC(LOC,DIV) S DATE=TIUSTART
  1. .F S DATE=$O(^TIU(8925,"ALOCP",LOC,DATE)) Q:'DATE!(DATE>STOP) D
  1. ..S IFN=0 F S IFN=$O(^TIU(8925,"ALOCP",LOC,DATE,IFN)) Q:'IFN D
  1. ...D REPLACE^TIUPRPN3(IFN,DATE,1501)
  1. S IFN=0 F S IFN=$O(^TMP("TIUREPLACE",$J,IFN)) Q:'IFN D
  1. .S DFN=$P(^TIU(8925,IFN,0),U,2),SSN=$P(^DPT(DFN,0),U,9)
  1. .S SSN=$E(SSN,8,9)_$E(SSN,6,7)_$E(SSN,4,5)_$E(SSN,1,3)
  1. .S DATE=^TMP("TIUREPLACE",$J,IFN,"DT")
  1. .S ^TMP("TIUPR",$J,SSN_";"_DFN,DATE,IFN)="Vice SF 509"
  1. I '$D(^TMP("TIUPR",$J)) D TROUBLE G EXIT
  1. D PRINT^TIUPRPN1(1,1)
  1. S $P(^TIU(8925.94,TIUDIV,1),U)=STOP
  1. EXIT K ^TIU("TIUPR",$J),^TMP("TIULQ",$J),^TMP("TIUREPLACE",$J)
  1. Q
  1. LOC(LOC,DIV) ;checks if this location should be batch prted
  1. N IEN
  1. S IEN=$O(^TIU(8925.93,"B",LOC,0))
  1. Q $S($P($G(^SC(LOC,0)),U,3)="W":1,$P($G(^SC(LOC,0)),U,15)'=DIV:1,'$D(^TIU(8925.93,+IEN,0)):"",+$G(^TIU(8925.93,IEN,3)):1,1:"")
  1. ;
  1. TROUBLE ;message to print if no output
  1. W !!,"The option [TIU PRINT PN BATCH OUTPT] ran to completion at "
  1. W !,$$FMTE^XLFDT($$NOW^XLFDT,"1P")," but did not find any notes."
  1. W !!,"If you were expecting notes to print review the following:"
  1. ;
  1. W !!,"INTERACTIVE"
  1. W !,"-----------"
  1. W !,"1. Very little can go wrong- the required criteria is screened"
  1. W !,"while the user is manually queueing the job."
  1. W !!,"2. This option prints all the outpatient progress notes, in"
  1. W !,"terminal digit order, for the selected date range for ALL CLINICS"
  1. W !,"for the selected DIVISION. Verify that you have signed progress"
  1. W !,"notes satisfying this criteria.",!
  1. ;
  1. W !!,"NON-INTERACTIVE (job set to run in OPTION SCHEDULING FILE (#19.2)"
  1. W !,"-----------------------------------------------------------------"
  1. W !,"1. DIVISION must be defined in file #8925.94 (TIU DIVISION PRINT"
  1. W !,"PRINT PARAMETERS FILE)."
  1. W !!,"2. The variable TIUDIV must be defined in the VARIABLE NAME "
  1. W !,"multiple of the OPTION SCHEDULING FILE (#19.2). TIUDIV should"
  1. W !,"be set to the IEN of an entry in the TIU DIVISION PRINT PARAMETERS"
  1. W !,"FILE (#8925.94)."
  1. W !!,"3. This option must find a valid date in field #1.01 of"
  1. W !,"file #8925.94 to start looping on. If a valid date is not "
  1. W !,"found, the option will terminate with this message."
  1. W !!,"4. To assist in troubleshooting, if no notes are found, the"
  1. W !,"DATE/TIME field (#1.01) of file #8925.94 will not be re-set"
  1. W !,"to the new value (which is NOW) when the option begins "
  1. W "calculating."
  1. Q