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

TIUPRPN5.m

Go to the documentation of this file.
  1. TIUPRPN5 ;SLC/MJC-Sort PNs for Prting by Location;6/26/01
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**100,121**;Jun 20, 1997
  1. ;
  1. LOC ;sorts PNs for prting by CLINIC location
  1. ;these notes are chartable contiguous or separate
  1. ;this option is screened to exclude WARDs
  1. ;sites should use the [TIU PRINT PN WARD] option which sorts
  1. ;by BED NUMBER for current inpts on that ward for INPT notes
  1. ;[TIU PRINT PN OUTPT LOC]
  1. ;
  1. N DIC,Y,TIUQT,TIULOC
  1. D SETUP^TIUPRPN3("Print Progress Notes for OUTPATIENT LOCATION")
  1. DIC F D Q:$D(TIUQT)
  1. .S DIC=8925.93,DIC(0)="AEQMNZ",DIC("A")="Select OUTPATIENT location: "
  1. .S DIC("S")="I $P($G(^SC(+$P($G(^TIU(8925.93,+Y,0)),U),0)),U,3)'=""W"""
  1. .W ! D ^DIC K DIC("S") I Y<0 S TIUQT=1 Q
  1. .S TIULOC=+Y(0)_U_+Y_U_Y(0,0)
  1. .I '$D(^TIU(8925,"ALOCP",+TIULOC)) D Q
  1. ..W !,$C(7),"There are no signed Progress Notes for this location!!"
  1. .D NOTES(TIULOC)
  1. Q
  1. ;
  1. NOTES(TIULOC) ;returns date/time;ien of last note prted
  1. N OLD,NEW,Y,BEG,IFN,TIUSPG,CTR,TIULAST,ANS,MSG,TIUQT,DFN,SORT
  1. K ^TMP("TIUREPLACE",$J)
  1. S MSG=1,TIULAST=$P($G(^TIU(8925.93,+$P(TIULOC,U,2),1)),U,2)
  1. I TIULAST]"" D Q:$D(TIUQT)
  1. .I '+$G(TIULAST)!'$P(TIULAST,";",2)!('$D(^TIU(8925,"ALOCP",+TIULOC,+TIULAST,+$P(TIULAST,";",2)))) S $P(^TIU(8925.93,+$P(TIULOC,U,2),1),U,2)="",MSG=2 Q
  1. .S BEG=+TIULAST
  1. .W !!,"The last note printed for this location using this option was "
  1. .W !,"signed ",$$FMTE^XLFDT(BEG,"1P"),!!
  1. .S ANS=$$READ^TIUU("YA","Print from this point on? ","YES","^D HELP^TIUPRPN5")
  1. .I $D(DIRUT) S TIUQT=1 Q
  1. .I +$G(ANS) S IFN=$P(TIULAST,U,2) Q
  1. .S $P(^TIU(8925.93,+$P(TIULOC,U,2),1),U,2)="",MSG=3
  1. I $P($G(^TIU(8925.93,+$P(TIULOC,U,2),1)),U,2)']"" D Q:$D(TIUQT)
  1. .D @MSG ;writes message to explain date selection
  1. RANGE .S OLD=$O(^TIU(8925,"ALOCP",+TIULOC,0))
  1. .S NEW=$O(^TIU(8925,"ALOCP",+TIULOC,9999999),-1)
  1. .W !," The OLDEST note was signed: ",$$FMTE^XLFDT(OLD,"1P")
  1. .W !,"The MOST RECENT note was signed: ",$$FMTE^XLFDT(NEW,"1P"),!
  1. .W !,"Select a date and I will print all signed notes for "
  1. .W !,$P(TIULOC,U,3)," from this date until NOW.",!
  1. DATE .S %DT="AEPX",%DT(0)="-NOW",%DT("A")="Print Notes Beginning: "
  1. .D ^%DT K %DT I $D(DTOUT)!(Y<0) S TIUQT=1 Q
  1. .I Y>NEW W $C(7),!?5,"Pick a date between the OLDEST and the MOST "
  1. .I W "RECENT." G DATE
  1. .S BEG=Y
  1. S CTR=0 F S BEG=$O(^TIU(8925,"ALOCP",+TIULOC,BEG)) Q:'BEG D
  1. .I '$D(IFN) S IFN=0
  1. .F S IFN=$O(^TIU(8925,"ALOCP",+TIULOC,BEG,IFN)) Q:'IFN D
  1. ..W "." D REPLACE^TIUPRPN3(IFN,BEG,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),SORT=$P(^DPT(DFN,0),U)_";"_DFN
  1. .S BEG=^TMP("TIUREPLACE",$J,IFN,"DT")
  1. .S ^TMP("TIUPR",$J,SORT,BEG,IFN)="Vice SF 509"
  1. .S TIULAST=BEG_";"_IFN
  1. S CTR=+$G(^TMP("TIUREPLACE",$J))
  1. I CTR=0 W $C(7),!!,"No notes have been signed for this location since "
  1. I W $$FMTE^XLFDT(+TIULAST,"1P") G NOTESX
  1. W !,">> "_CTR_" note"_$S(CTR>1:"s",1:"")_" found for "_$P(TIULOC,U,3)
  1. I CTR'>1 S TIUSPG=1
  1. E S TIUSPG=$$PAGE^TIUPRPN3 G:TIUSPG']"" NOTESX S TIUSPG=$S(+$G(TIUSPG):0,1:1)
  1. DEV S %ZIS("B")=$P($G(^%ZIS(1,+$P($G(^TIU(8925.93,$P(TIULOC,U,2),1)),U,3),0),""),U) ;brings up default prter from 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 "
  1. I W "printer for this option!!" G DEV
  1. S $P(^TIU(8925.93,$P(TIULOC,U,2),0),U,4)=""
  1. I $D(IO("Q")) K IO("Q") D G EXIT
  1. .S ZTRTN="PRINT^TIUPRPN5",ZTSAVE("^TMP(""TIUPR"",$J,")=""
  1. .S ZTSAVE("TIUSPG")="",ZTSAVE("TIULAST")="",ZTSAVE("TIULOC")=""
  1. .S ZTDESC="TIU PRT PNS BY LOCATION"
  1. .D ^%ZTLOAD W !,$S($D(ZTSK):"Request Queued!",1:"Request Canceled!")
  1. .K ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,%ZIS,TIULAST,TIUSPG,TIULOC
  1. .D HOME^%ZIS
  1. U IO D PRINT,^%ZISC
  1. NOTESX ;
  1. K ^TMP("TIUREPLACE",$J)
  1. Q
  1. PRINT ;
  1. K ^TMP("TIULQ",$J)
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. D PRINT^TIUPRPN1(1,$G(TIUSPG))
  1. S $P(^TIU(8925.93,$P(TIULOC,U,2),1),U,2)=TIULAST
  1. EXIT K ^TMP("TIULQ",$J),^TMP("TIUPR",$J),^TMP("TIUREPLACE",$J)
  1. Q
  1. ;
  1. 1 W !!,"I don't seem to have any record of you having used this option "
  1. W !,"to print progress notes for this location.",!
  1. Q
  1. 2 W !!,"I could not determine what the last note printed for this "
  1. W !,"location was."
  1. W !!,"Please select a date and all notes from that date to NOW will be"
  1. W !,"printed. The last note printed will become the new base date.",!
  1. Q
  1. 3 W !!,"OK- then select a different date.",!
  1. Q
  1. HELP ; help for continue from this point prompt
  1. W !!,"Every note that has been signed since this date (last time this"
  1. W !,"notes were printed using this option) until NOW will be printed."
  1. Q