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

ECXALAR.m

Go to the documentation of this file.
  1. ECXALAR ;ALB/TMD-LAR Extract Report of Untranslatable Results ;7/14/15 16:18
  1. ;;3.0;DSS EXTRACTS;**46,51,112,132,136,149,154**;Dec 22, 1997;Build 13
  1. ;
  1. EN ; entry point
  1. N X,Y,DATE,ECRUN,ECXOPT,ECXDESC,ECXSAVE,ECXTL,ECTHLD,ECSD,ECSD1,ECSTART,ECED,ECEND,ECXERR,QFLG,PG,ECXPORT,RCNT ;149,154
  1. S QFLG=0,ECXTL="LAR"
  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. D SETUP^ECXLABR I ECFILE="" Q
  1. I '$D(ECNODE) S ECNODE=7
  1. I $P($G(^ECX(728,1,ECNODE+.1)),U,ECPIECE)]"" D Q
  1. .W !!,$C(7),ECPACK," extract is already scheduled to run. Try later",!!
  1. D BEGIN Q:QFLG
  1. S ECXPORT=$$EXPORT^ECXUTL1 Q:ECXPORT=-1 I $G(ECXPORT) D Q ;149 Section added
  1. .S RCNT=1
  1. .D PROCESS
  1. .S ^TMP($J,"ECXPORT",0)="PATIENT NAME^SSN^DATE/TIME COLLECTED^TEST CODE^TEST NAME^RESULT"
  1. .D EXPDISP^ECXUTL1
  1. .D AUDIT^ECXKILL
  1. S ECXDESC=ECXTL_" Extract Report of Untranslatable Results"
  1. S ECXSAVE("EC*")=""
  1. D EN^XUTMDEVQ("PROCESS^ECXALAR",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,!,"This report prints a listing of results that are not translatable i.e. have",!,"no entry in the Lab Results Translation File (#727.7)."
  1. W !!,"This report is a pre-extract type audit report and should be run prior to the",!,"generation of the actual extract. Running this report has no effect on the",!,"actual extract."
  1. W !!,"**WARNING: This report can take a long time to process. You are encouraged",!,"to queue this report for processing during the evening if possible.**" ;136
  1. W !!,"Enter the date range for which you would like to scan the ",ECXTL," 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 $P(^ECX(728,1,ECNODE+.1),U,ECPIECE)="R"
  1. S ECXERR=0 D EN^ECXALAR2 S $P(^ECX(728,1,ECNODE+.1),U,ECPIECE)="" Q:ECXERR
  1. S QFLG=0 D PRINT
  1. Q
  1. ;
  1. PRINT ; process temp file and print report
  1. N X,CNT,LN,REC,ECXDFN,ECXSSN,ECXPNM,ECRS,ECTC,ECFMDT,ECDTM,ECXTNM
  1. U IO
  1. I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
  1. S (PG,QFLG,GTOT)=0,$P(LN,"-",80)=""
  1. I '$G(ECXPORT) D HEADER Q:QFLG ;149
  1. S COUNT=0,CNT="" F S CNT=$O(^TMP($J,"ECXALAR2",CNT)) Q:CNT=""!QFLG S REC=^(CNT) D
  1. .S ECXDFN=$P(REC,U),ECTC=$P(REC,U,4),ECRS=$P(REC,U,5)
  1. .S ECFMDT=$P(REC,U,2)_"."_$P(REC,U,3),ECDTM=$$FMTE^XLFDT(ECFMDT,2)
  1. .S (ECXPNM,ECXSSN)=""
  1. .K ECXPAT S OK=$$PAT^ECXUTL3(ECXDFN,,"1;",.ECXPAT)
  1. .I OK S ECXPNM=ECXPAT("NAME"),ECXSSN=ECXPAT("SSN")
  1. .S ECXTNM=$O(^ECX(727.29,"AC",+$G(ECTC),0)),ECXTNM=$P(^ECX(727.29,+$G(ECXTNM),0),U,3)
  1. .I $G(ECXPORT) S ^TMP($J,"ECXPORT",RCNT)=ECXPNM_U_ECXSSN_U_ECDTM_U_ECTC_U_ECXTNM_U_ECRS,RCNT=RCNT+1 Q ;149
  1. .I $Y+3>IOSL D HEADER
  1. .W !,ECXPNM,?5,ECXSSN,?17,ECDTM,?32,$J(ECTC,4),?38,$E(ECXTNM,1,20),?60,$S($L(ECRS)>20:$E(ECRS,1,19)_"+",1:ECRS) ;154 Print result if 20 or less, otherwise print first 19 characters and +
  1. .S COUNT=COUNT+1
  1. I $G(ECXPORT) Q ;149
  1. Q:QFLG
  1. I COUNT=0 W !!,?8,"No untranslatable results 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 !,ECXTL_" Extract Untranslatable Results Audit Report",?71,"Page: "_PG
  1. W !,"Start Date: ",ECSTART
  1. W !,"End Date: ",ECEND,?49,"Report Run Date: "_ECRUN
  1. W !!,"Pat.",?5,"SSN",?17,"Date/Time",?32,"Test",?38,"Test Name",?60,"Result"
  1. W !,"Name",?17,"Collected",?32,"Code"
  1. W !,LN,!
  1. Q
  1. ;