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

ECXUSUR.m

Go to the documentation of this file.
  1. ECXUSUR ;ALB/TJL-Surgery Pre-Extract Unusual Volume Report ;6/1/17 15:30
  1. ;;3.0;DSS EXTRACTS;**49,71,84,93,105,148,149,161,166,184,185**;Dec 22, 1997;Build 134
  1. ;
  1. EN ; entry point
  1. N X,Y,DATE,ECRUN,ECXDESC,ECXSAVE,ECXTL,ECTHLD,ECXPORT,CNT ;149
  1. N ECSD,ECSD1,ECSTART,ECED,ECEND,ECXERR,QFLG,ECXFLAG
  1. K ^TMP($J)
  1. S QFLG=0,ECTHLD="",ECXFLAG=$G(FLAG)
  1. ; get today's date
  1. D NOW^%DTC S DATE=X,Y=$E(%,1,12) D DD^%DT S ECRUN=$P(Y,"@") K %DT
  1. I 'ECXFLAG D BEGIN Q:QFLG
  1. D SELECT Q:QFLG
  1. S ECXPORT=$$EXPORT^ECXUTL1 Q:ECXPORT=-1 I $G(ECXPORT) D Q ;149 Section added
  1. .K ^TMP($J,"ECXPORT"),^TMP("ECXPORT",$J)
  1. .S ^TMP("ECXPORT",$J,0)="PRODUCTION DIVISION^PRODUCTION DIVISION NAME^"
  1. .S ^TMP("ECXPORT",$J,0)=^TMP("ECXPORT",$J,0)_"NAME^SSN^DAY^CASE #^ENCOUNTER #^PT HOLDING TIME^ANESTHESIA TIME^PATIENT TIME^OPERATION TIME^PACU TIME^OR CLEAN TIME^CANC/ABORT^PRINCIPAL PROCEDURE",CNT=1 ;184 Added Production Division
  1. .D PROCESS
  1. .M ^TMP($J,"ECXPORT")=^TMP("ECXPORT",$J) ;149 Move results to TMP for printing
  1. .D EXPDISP^ECXUTL1
  1. .D AUDIT^ECXKILL K ^TMP("ECXPORT",$J)
  1. S ECXDESC=$S(ECXFLAG:"Surgery Pre-Extract Volume Report",1:"Surgery Pre-Extract Unusual Volume Report") ;tjl 166 - Changed report title
  1. S ECXSAVE("EC*")=""
  1. W !!,"This report requires 132-column format."
  1. D EN^XUTMDEVQ("PROCESS^ECXUSUR",ECXDESC,.ECXSAVE)
  1. I POP W !!,"No device selected...exiting.",! Q
  1. I IO'=IO(0) D ^%ZISC
  1. D HOME^%ZIS
  1. D AUDIT^ECXKILL
  1. Q
  1. ;
  1. BEGIN ; display report description
  1. W @IOF
  1. W !,"This report prints a listing of unusual volumes that would be"
  1. W !,"generated by the Surgery extract (SUR) as determined by a"
  1. W !,"user-defined threshold value. It should be run prior to the"
  1. W !,"generation of the actual extract(s) to identify and fix, as"
  1. W !,"necessary, any volumes determined to be erroneous."
  1. W !!,"Unusual volumes are those where either the Operation Time,"
  1. W !,"Patient Time, Anesthesia Time, Recovery Room Time, OR Clean Time"
  1. W !,"or Pt Holding Time field is greater than the threshold value."
  1. W !!,"Note: The threshold can be set after a report is selected."
  1. W !!,"Run times for this report will vary depending upon the size of"
  1. W !,"the extract and could take as long as 30 minutes or more to"
  1. W !,"complete. This report has no effect on the actual extracts and"
  1. W !,"can be run as needed."
  1. W !!,"The report is sorted by descending Volume and Case Number."
  1. S DIR(0)="E" W ! D ^DIR K DIR I 'Y S QFLG=1 Q
  1. W:$Y!($E(IOST)="C") @IOF,!!
  1. Q
  1. ;
  1. SELECT ; user inputs for threshold volume and date range
  1. N DONE,OUT
  1. ; allow user to set threshold volume
  1. I 'ECXFLAG D
  1. .S ECTHLD=25
  1. .W !!,"The default threshold volume for the Surgery extract is "_ECTHLD_"."
  1. .W !,"The default threshold volume ("_ECTHLD_") equates to 6 hours."
  1. .S DIR(0)="Y",DIR("A")="Would you like to change the threshold?",DIR("B")="NO" D ^DIR K DIR I X["^" S QFLG=1 Q
  1. .I Y D
  1. ..W !!,"Volume > threshold"
  1. ..S DIR(0)="N^0:99",DIR("A")="Enter the new threshold volume" D ^DIR K DIR S ECTHLD=Y I X["^" S QFLG=1 Q
  1. ; get date range from user
  1. Q:QFLG
  1. W !!,"Enter the date range for which you would like to scan the"
  1. W !,"Surgery Extract records.",!
  1. S DONE=0 F S (ECED,ECSD)="" D Q:QFLG!DONE
  1. .K %DT S %DT="AEX",%DT("A")="Starting with Date: ",%DT(0)=-DATE D ^%DT
  1. .I Y<0 S QFLG=1 Q
  1. .S ECSD=Y,ECSD1=ECSD-.1
  1. .D DD^%DT S ECSTART=Y
  1. .K %DT S %DT="AEX",%DT("A")="Ending with Date: ",%DT(0)=-DATE D ^%DT
  1. .I Y<0 S QFLG=1 Q
  1. .I Y<ECSD D Q
  1. ..W !!,"The ending date cannot be earlier than the starting date."
  1. ..W !,"Please try again.",!!
  1. .I $E(Y,1,5)'=$E(ECSD,1,5) D Q
  1. ..W !!,"Beginning and ending dates must be in the same month and year"
  1. ..W !,"Please try again.",!!
  1. .S ECED=Y
  1. .D DD^%DT S ECEND=Y
  1. .S DONE=1
  1. Q
  1. ;
  1. PROCESS ; entry point for queued report
  1. S ZTREQ="@"
  1. S ECXERR=0 D EN^ECXUSUR1 Q:ECXERR
  1. S QFLG=0 D PRINT
  1. Q
  1. ;
  1. PRINT ; process temp file and print report
  1. N PG,QFLG,GTOT,LN,COUNT,VOL,SUB,REC,PIECE,COL ;149,161
  1. N PDIV,PDIVNM,PPDIV ;184,185
  1. U IO
  1. I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
  1. S (PG,QFLG,GTOT,COUNT)=0,$P(LN,"-",132)="-" ;161
  1. I '$G(ECXPORT) D HEADER Q:QFLG ;149
  1. S PDIV="" ;184
  1. S PPDIV="" ;185
  1. F S PDIV=$O(^TMP($J,PDIV)) Q:PDIV="" D
  1. . I '$G(ECXPORT) W:PPDIV'="" ! W !,?31," PRODUCTION DIVISION: ",$P(PDIV,"~"),! ;184,185
  1. . S PPDIV=PDIV
  1. . S VOL=-999999 F S VOL=$O(^TMP($J,PDIV,VOL)) Q:VOL=""!QFLG D
  1. ..S SUB="" F S SUB=$O(^TMP($J,PDIV,VOL,SUB)) Q:SUB=""!QFLG S REC=^(SUB) D ;185 - Add a dot "." in the following code block
  1. ...I $G(ECXPORT) F PIECE=1:1:5,7,11,9,10,6,8,14,13 S ^TMP("ECXPORT",$J,CNT)=$G(^TMP("ECXPORT",$J,CNT))_$P(REC,U,PIECE)_$S(PIECE'=13:"^",1:"") ;S:PIECE=13 CNT=CNT+1 ;149,184 - Update CNT below
  1. ...I $G(ECXPORT) S ^TMP("ECXPORT",$J,CNT)=$P(PDIV,"~")_U_$P(PDIV,"~",2)_U_$G(^TMP("ECXPORT",$J,CNT)),CNT=CNT+1 ;184 - Added Production Division and name to export format,185 - Get the division and division name from 2nd subscript
  1. ...I $G(ECXPORT) Q ;149
  1. ...S COUNT=COUNT+1
  1. ...I $Y+3>IOSL D HEADER W !?31," PRODUCTION DIVISION: ",$P(PDIV,"~"),! Q:QFLG ;184 - Added PDIV,185
  1. ...W !,$P(REC,U),?8,$P(REC,U,2),?15,$P(REC,U,3),?24,$P(REC,U,4) ;161, 184 - only display the last 4 of SSN
  1. ...W ?31,$P(REC,U,5) ;161
  1. ...S COL=$S($P(REC,U,7):52,1:49) W ?COL,$$RJ^XLFSTR($P(REC,U,7),4) ;161
  1. ...S COL=$S($P(REC,U,11):63,1:60) W ?COL,$$RJ^XLFSTR($P(REC,U,11),4) ;161
  1. ...S COL=$S($P(REC,U,9):73,1:71) W ?COL,$$RJ^XLFSTR($P(REC,U,9),4) ;161
  1. ...S COL=$S($P(REC,U,10):84,1:81) W ?COL,$$RJ^XLFSTR($P(REC,U,10),4) ;161
  1. ...W ?91,$$RJ^XLFSTR($P(REC,U,6),4) ;161
  1. ...S COL=$S($P(REC,U,8):103,1:101) W ?COL,$$RJ^XLFSTR($P(REC,U,8),4),?113,$P(REC,U,14) ;161
  1. ...W ?117,$P(REC,U,13)
  1. I $G(ECXPORT) Q ;149
  1. Q:QFLG
  1. I COUNT=0 W !!,?8,$S(ECXFLAG=1:"No surgery volumes to report for this extract",1:"No unusual volumes to report for this extract")
  1. CLOSE ;
  1. I $E(IOST)="C",'QFLG D
  1. .S SS=22-$Y F JJ=1:1:SS W !
  1. .S DIR(0)="E" W ! D ^DIR K DIR
  1. Q
  1. ;
  1. N SS,JJ
  1. I $E(IOST)="C" D
  1. .S SS=22-$Y F JJ=1:1:SS W !
  1. .I PG>0 S DIR(0)="E" W ! D ^DIR K DIR S:'Y QFLG=1
  1. Q:QFLG
  1. W:$Y!($E(IOST)="C") @IOF S PG=PG+1
  1. W !,$S(ECXFLAG:"Surgery Pre-Extract Volume Report",1:"Surgery Pre-Extract Unusual Volume Report"),?124,"Page: "_PG ;tjl 166 - Changed report title
  1. W !,"Start Date: ",ECSTART,?97,"Report Run Date/Time: "_ECRUN
  1. W !," End Date: ",ECEND I 'ECXFLAG W ?97," Threshold Value: ",ECTHLD
  1. W !!,?25,"Case",?35,"Encounter",?49,"Pt Holding",?60,"Anesthesia",?71,"Patient",?81,"Operation",?91,"PACU",?101,"OR Clean",?111,"Canc/",?121,"Principal" ;161
  1. W !,"Name",?8,"SSN",?17,"Day",?24,"Number",?37,"Number" ;161
  1. W ?51,"Time",?63,"Time",?73,"Time",?84,"Time",?91,"Time",?104,"Time" ;161
  1. W ?111,"Abort",?121,"Procedure"
  1. W !,LN ;185 Removed blank line
  1. Q
  1. ;