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

PXRMETCO.m

Go to the documentation of this file.
  1. PXRMETCO ; SLC/PJH - QUERI Extract Compliance Report ;06/09/2009
  1. ;;2.0;CLINICAL REMINDERS;**6,12**;Feb 04, 2005;Build 73
  1. ;
  1. ;
  1. ADHOC(IEN,PXRMSTRT,PXRMSTOP) ;Ad Hoc Conformance Report
  1. D DUMMY1^PXRMRUTL
  1. Q
  1. ;
  1. D JOB
  1. Q
  1. ;
  1. ;BOOKMARK - cloned from PXRMETX, needs modifying to avoid patient list
  1. ;update. Build ^TMP("PXRMETX",$J) for report
  1. ;
  1. REPORT ;Initialise
  1. K ^TMP("PXRMETX",$J)
  1. ;Workfile node for ^TMP
  1. S PXRMNODE="PXRMRULE"
  1. ;Get details from parameter file
  1. N DATA,DATES,LIST,NAME,PARTYPE,TEXT
  1. ;N PERIOD,TEXT,YEAR
  1. S DATA=$G(^PXRM(810.2,IEN,0))
  1. ;
  1. ;Determine Extract Name and period
  1. S NAME=$P(DATA,U),PARTYPE=$P(DATA,U,2)
  1. ;S YEAR=$P(NEXT,"/",2),PERIOD=$P(NEXT,"/")
  1. ;Calculate report period start and end dates
  1. ;D CALC^PXRMEUT(NEXT,.PXRMSTRT,.PXRMSTOP)
  1. ;Determine output name for patient list and extract summary
  1. S DATES=$$FMTE^XLFDT(PXRMSTRT)_" - "_$$FMTE^XLFDT(PXRMSTOP)
  1. ;
  1. ;Bookmark - Needs inventive patient list names
  1. S LIST=NAME_" REPORT "_DATES
  1. ;Process (single) Denominator rule into patient list
  1. N INDP,INTP,SEQ,SUB,SUFFIX
  1. S SEQ=""
  1. F S SEQ=$O(^PXRM(810.2,IEN,10,"B",SEQ)) Q:'SEQ D
  1. .S SUB=$O(^PXRM(810.2,IEN,10,"B",SEQ,"")) Q:'SUB
  1. .S DATA=$G(^PXRM(810.2,IEN,10,SUB,0)) Q:DATA=""
  1. .S PXRMRULE=$P(DATA,U,2) Q:'PXRMRULE
  1. .S SUFFIX=$P(DATA,U,3)
  1. .I SUFFIX="" S SUFFIX="DENOMINATOR "_SEQ
  1. .S INDP=+$P(DATA,U,4)
  1. .S INTP=+$P(DATA,U,5)
  1. .;Create new patient list
  1. .S PXRMLIST=$$CRLST^PXRMRUL1(LIST_" "_SUFFIX) Q:'PXRMLIST
  1. .D START^PXRMRULE(PXRMRULE,PXRMLIST,PXRMNODE,PXRMSTRT,PXRMSTOP,IEN,INDP,INTP)
  1. .;Clear ^TMP lists created for rule
  1. .D CLEAR^PXRMRULE(PXRMRULE,PXRMNODE)
  1. .;Process reminders
  1. .D REM^PXRMETXR(SUB,PXRMLIST)
  1. ;
  1. ;Bookmark - Report stuff goes here
  1. ;Update totals section
  1. N APPL,CNT,DUE,DATA,ETYP,EVAL
  1. N FAPPL,FCNT,FDATA,FDUE,FEVAL,FGNAM,FIND,FNAPPL,FNDUE,FSEQ
  1. N NAPPL,NDUE,PXRMLIST,RCNT,RIEN,RSEQ,SEQ
  1. S SEQ=0,CNT=1
  1. F S SEQ=$O(^TMP("PXRMETX",$J,SEQ)) Q:'SEQ D
  1. .S RCNT=0,RSEQ=0
  1. .F S RCNT=$O(^TMP("PXRMETX",$J,SEQ,RCNT)) Q:'RCNT D
  1. ..S DATA=$G(^TMP("PXRMETX",$J,SEQ,RCNT)) Q:'DATA
  1. ..S RIEN=$P(DATA,U),PXRMLIST=$P(DATA,U,5)
  1. ..S EVAL=$P(DATA,U,2),APPL=$P(DATA,U,3),DUE=$P(DATA,U,4)
  1. ..S NAPPL=EVAL-APPL,NDUE=APPL-DUE
  1. ..S CNT=CNT+1,RSEQ=RSEQ+1
  1. ..;bookmark - write patient line
  1. ..;For each count type
  1. ..S ETYP="",FCNT=CNT
  1. ..F S ETYP=$O(^TMP("PXRMETX",$J,SEQ,RCNT,ETYP)) Q:ETYP="" D
  1. ...;For each term
  1. ...S FIND=0,FSEQ=0
  1. ...F S FIND=$O(^TMP("PXRMETX",$J,SEQ,RCNT,ETYP,FIND)) Q:FIND="" D
  1. ....;Update finding totals
  1. ....S FDATA=$G(^TMP("PXRMETX",$J,SEQ,RCNT,ETYP,FIND)),FCNT=FCNT+1
  1. ....S FEVAL=$P(FDATA,U,2),FAPPL=$P(FDATA,U,3),FDUE=$P(FDATA,U,4)
  1. ....S FNAPPL=FEVAL-FAPPL,FNDUE=FAPPL-FDUE
  1. ....S FSEQ=FSEQ+1,FGNAM=$P(DATA,U,9)
  1. ....;Bookmark - write finding line
  1. ..;Update CNT
  1. ..S CNT=FCNT
  1. Q
  1. ;
  1. ;Determine whether the report should be queued.
  1. JOB ;
  1. N DBDUZ,PXRMQUE
  1. N %ZIS,ZTDESC,ZTSAVE,ZTRTN,ZTSK
  1. S DBDUZ=DUZ
  1. D SAVE^PXRMXQUE
  1. S %ZIS="Q"
  1. S ZTDESC="QUERI Compliance Report - print"
  1. S ZTRTN="REPORT^PXRMETCO"
  1. S ZTSK=1
  1. S PXRMQUE=0
  1. S PXRMQUE=$$DEVICE^PXRMXQUE(ZTRTN,ZTDESC,.ZTSAVE,.%ZIS,.ZTSK)
  1. I PXRMQUE=1 G EXIT
  1. I PXRMQUE>0 S ^XTMP(PXRMXTMP,"PRZTSK")=PXRMQUE
  1. Q
  1. ;
  1. EXIT ;Clean things up.
  1. D ^%ZISC
  1. D HOME^%ZIS
  1. K IO("Q")
  1. K DIRUT,DTOUT,DUOUT,POP,ZTREQ
  1. I $D(ZTSK) D KILL^%ZTLOAD
  1. K ZTSK,ZTQUEUED
  1. K ^TMP("PXRMXTR",$J)
  1. Q
  1. ;
  1. SAVE ;Save the variables for queing.
  1. S ZTSAVE("IEN")=""
  1. S ZTSAVE("PXRMSTRT")=""
  1. S ZTSAVE("PXRMSTOP")=""
  1. Q
  1. ;
  1. ;
  1. QUE ;BOOKMARK - NOT USED
  1. ;Queue the MST synchronization job.
  1. N DIR,DTOUT,DUOUT,MINDT,SDTIME,STIME,X,Y
  1. S MINDT=$$NOW^XLFDT
  1. W !,"Queue the Clinical Reminders MST synchronization."
  1. S DIR("A",1)="Enter the date and time you want the job to start."
  1. S DIR("A",2)="It must be after "_$$FMTE^XLFDT(MINDT,"5Z")
  1. S DIR("A")="Start the task at: "
  1. S DIR(0)="DAU"_U_MINDT_"::RSX"
  1. D ^DIR
  1. I $D(DTOUT)!$D(DUOUT) Q
  1. S SDTIME=Y
  1. K DIR
  1. S DIR(0)="YA"
  1. S DIR("A")="Do you want to run the MST synchronization at the same time every day? "
  1. S DIR("B")="Y"
  1. D ^DIR
  1. I $D(DTOUT)!$D(DUOUT) Q
  1. I Y S STIME="1."_$P(SDTIME,".",2)
  1. E S STIME=-1
  1. ;
  1. ;Put the task into the queue.
  1. K ZTSAVE
  1. ;S ZTSAVE("START")=SDTIME
  1. S ZTSAVE("STIME")=STIME
  1. S ZTRTN="SYNCH^PXRMMST"
  1. S ZTDESC="Clinical Reminders MST synchronization job"
  1. S ZTDTH=SDTIME
  1. S ZTIO=""
  1. D ^%ZTLOAD
  1. W !,"Task number ",ZTSK," queued."
  1. Q