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

PXEDIEL.m

Go to the documentation of this file.
  1. PXEDIEL ;ISL/PKR - PCE device interface error listing utilities. ;6/7/96
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;;Aug 12, 1996
  1. ;
  1. ;=======================================================================
  1. ARRAY(PXCAEIEN) ;Restores the local array PXCA from the error file.
  1. ;;This comes from pcazfix.
  1. K PXCA
  1. N PXCAINDX,PXCAVAR
  1. S PXCAINDX=0
  1. F S PXCAINDX=$O(^PX(839.01,PXCAEIEN,2,PXCAINDX)) Q:PXCAINDX'>0 D
  1. . S PXCAVAR=^PX(839.01,PXCAEIEN,2,PXCAINDX,0)
  1. . S @PXCAVAR=$TR(^PX(839.01,PXCAEIEN,2,PXCAINDX,2),"~","^")
  1. Q
  1. ;
  1. ;=======================================================================
  1. ENC(ERRNUM) ;Try to return the encounter information for the error array.
  1. N IND,DONE,ENCNTER,TEMP
  1. S ENCNTER=""
  1. S (DONE,IND)=0
  1. F S IND=$O(^PX(839.01,ERRNUM,2,IND)) Q:('IND)!(DONE) D
  1. . I ^PX(839.01,ERRNUM,2,IND,0)="PXCA(""ENCOUNTER"")" D
  1. .. S ENCNTER=^PX(839.01,ERRNUM,2,IND,2)
  1. .. S DONE=1
  1. ;
  1. Q ENCNTER
  1. ;
  1. ;=======================================================================
  1. ERRLST ;Write out the error list.
  1. N AFTER,BEFORE,C1S,DFN,EM,ENCDATE,ENCNTER,ENTRY,ENUM,ERRMSG,EVAR
  1. N IEN,FIELD,FIELDNAM,FILE,FILENAM,FILENUM,HLOCIEN,HLOCNAM,INDENT,NODE
  1. N PATIENT,PXERR,TEMP,TEXT
  1. ;
  1. S INDENT=3
  1. S C1S=INDENT+3
  1. ;
  1. ;Setup the correspondence between abbreviations and file numbers.
  1. S FILENUM("CPT")=9000010.18,FILENUM("HF")=9000010.23
  1. S FILENUM("IMM")=9000010.11,FILENUM("PED")=9000010.16
  1. S FILENUM("POV")=9000010.07,FILENUM("PRV")=9000010.06
  1. S FILENUM("SK")=9000010.12,FILENUM("TRT")=9000010.15
  1. S FILENUM("XAM")=9000010.13,FILENUM("VST")=9000010
  1. ;
  1. S ENUM=0
  1. ;Build the error array.
  1. F S ENUM=$O(^TMP("PXEDI",$J,TYPE,PATDFN,ENUM)) Q:(ENUM="")!(DONE) D
  1. .;Check for a user request to stop the task.
  1. . I $$S^%ZTLOAD S ZTSTOP=1,DONE=1 Q
  1. .;
  1. . S EM=^TMP("PXEDI",$J,TYPE,PATDFN,ENUM)
  1. . S ENCNTER=$$ENC(ENUM)
  1. . I ENCNTER>0 S ENCDATE=$P(ENCNTER,"~",1)
  1. . E S ENCDATE=""
  1. . S HLOCIEN=$P(ENCNTER,"~",3)
  1. .;This is the same usage as in PXRRECSE. It should fall under the same
  1. .;DBIA.
  1. . I HLOCIEN>0 S HLOCNAM=$P(^SC(HLOCIEN,0),U,1)
  1. . E S HLOCNAM="Missing"
  1. . S DFN=$P(EM,U,2)
  1. . D DEM^VADPT
  1. . I $D(VADM(1)) S PATIENT=VADM(1)_" "_$P(VADM(2),U,2)
  1. . E S PATIENT="Missing"
  1. . D ARRAY(ENUM)
  1. . I $Y>(IOSL-8) D PAGE^PXEDIP
  1. . I DONE Q
  1. . W !,"------------------------------------------------------------------------"
  1. . W !,"Error Number: ",ENUM
  1. . W !,?INDENT,"Patient: ",PATIENT
  1. . W !,?INDENT,"Hospital Location: ",HLOCNAM
  1. . W !,?INDENT,"Encounter date: "
  1. . I +ENCDATE>0 W $$FMTE^XLFDT(ENCDATE)
  1. . E W "Missing"
  1. . W !,?INDENT,"Processing date: ",$$FMTE^XLFDT($P(EM,U,1))
  1. .;
  1. . S EVAR=0
  1. . F S EVAR=$O(^PX(839.01,ENUM,1,EVAR)) Q:(EVAR="")!(DONE) D
  1. .. S PXERR=$P($G(^PX(839.01,ENUM,1,1,0)),"(",2)
  1. .. S TEXT=$G(^PX(839.01,ENUM,1,1,1))
  1. .. S FILE=$P(PXERR,",",1),FILE=$TR(FILE,"""","")
  1. .. S ENTRY=$P(PXERR,",",2)
  1. .. S IEN=$P(PXERR,",",3)
  1. .. I $L(IEN)=0 S IEN="Missing"
  1. .. S FIELD=$P(PXERR,",",4),FIELD=$TR(FIELD,")","")
  1. .. S FILENO=$G(FILENUM(FILE))
  1. .. S NODE=""
  1. .. I ($L(FILE)>0)&($L(ENTRY)>0) D
  1. ... S NODE=$O(^TMP("PXCA",$J,FILE,ENTRY,NODE))
  1. .. I $L(NODE)>0 D
  1. ... S AFTER=$G(^TMP("PXCA",$J,FILE,ENTRY,NODE,"AFTER"))
  1. ... S BEFORE=$G(^TMP("PXCA",$J,FILE,ENTRY,NODE,"BEFORE"))
  1. .. E S (AFTER,BEFORE,NODE)="Missing"
  1. .. I FILENO>0 S FILENAM=$$GET1^DID(FILENO,"","","NAME","TEMP","ERRMSG")
  1. .. E S FILENAM="Missing"
  1. .. I $Y>(IOSL-8) D PAGE^PXEDIP
  1. .. I DONE Q
  1. .. W !!,?INDENT,"File: ",FILENO," (",FILENAM,")"
  1. .. W " IEN: ",IEN
  1. ..;If FIELD=0 then the error applies to the entire entry, not just a
  1. ..;field.
  1. .. I FIELD>0 D
  1. ... S FIELDNAM=$$GET1^DID(FILENO,FIELD,"","LABEL","TEMP","ERRMSG")
  1. ... W " Field ",FIELD," (",FIELDNAM,")"
  1. .. W !,?INDENT,"Error message: ",TEXT
  1. .. W !,?INDENT,"Node: ",NODE
  1. .. W !,?C1S,"Original: ",BEFORE
  1. .. W !,?C1S," Updated: ",AFTER
  1. D KVA^VADPT
  1. K PXCA
  1. K ^TMP("PXCA",$J)
  1. Q
  1. ;