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

EDPRPT13.m

Go to the documentation of this file.
  1. EDPRPT13 ;SLC/BWF - Removed in Error Report ;4/25/13 3:15pm
  1. ;;2.0;EMERGENCY DEPARTMENT;**6**;May 2, 2012;Build 200
  1. ;
  1. Q
  1. ; INPUT:
  1. ; BEG - Beginning Date
  1. ; END - Ending Date
  1. EN(BEG,END,CSV) ; Get report of patients removed in error
  1. N CHKDT,LOG,ROW,TAB,X0,X1,X3,CNT,I,LOGH,FOUND,X
  1. S CNT("ALL")=0 ; set counter to 0
  1. D:'$G(CSV) XML^EDPX("<removedInErrorEntries>") I $G(CSV) D ;headers
  1. . S TAB=$C(9)
  1. . S X="ED IEN"_TAB_"Time In"_TAB_"Time Out"_TAB_"Restored to Board"_TAB_"Restored Date/Time"_TAB_"Restored By"_TAB_"Closed By"_TAB_"Closed Date/Time" ;_TAB_"ER Spec Visit"
  1. . D ADD^EDPCSV(X)
  1. S CHKDT=$G(BEG)-.000001
  1. F S CHKDT=$O(^EDP(230,"ARIE",CHKDT)) Q:'CHKDT!(CHKDT>END) D
  1. .S LOG=0 F S LOG=$O(^EDP(230,"ARIE",CHKDT,LOG)) Q:'LOG D
  1. ..S X0=^EDP(230,LOG,0),X1=$G(^(1)),X3=$G(^(3))
  1. ..;***pij change "ID" due to undef error 4/24/2013
  1. ..;N ROW S ROW("ID")=LOG
  1. ..N ROW S ROW("id")=LOG
  1. ..;***
  1. ..S ROW("patientName")=$$GET1^DIQ(2,$P(X0,U,6),.01)
  1. ..S ROW("timeInED")=$P(X0,U,8)
  1. ..S ROW("timeOutED")=$p(X0,U,9)
  1. ..S ROW("restored")=$P(X0,U,17)
  1. ..S ROW("restoredDateTime")=$P(X0,U,19)
  1. ..S ROW("restoredBy")=$$GET1^DIQ(200,$P(X0,U,18),.01)
  1. ..; initialize closedby and closedDateTime
  1. ..S (ROW("closedBy"),ROW("closedDateTime"))=""
  1. ..; look at the appropriate log history entry to get who closed this record
  1. ..S FOUND=0
  1. ..S LOGH="A" F S LOGH=$O(^EDP(230.1,"B",LOG,LOGH),-1) Q:'LOGH!(FOUND) D
  1. ...S X3=$G(^EDP(230.1,LOGH,3))
  1. ...I $P(X3,U,9) D
  1. ....S ROW("closedBy")=$$GET1^DIQ(200,$P(X3,U,11),.01),ROW("closedDateTime")=$P(X3,U,10)
  1. ....S FOUND=1
  1. ..;S ROW("closedBy")=$$GET1^DIQ(200,$P(X0,U,16),.01)
  1. ..;S ROW("closedDateTime")=$P(X0,U,15)
  1. ..S ROW("ssn")=$S($P(X0,U,5):$P(X0,U,5),'$P(X0,U,5):$$SSN^DPTLK1($P(X0,U,6)),1:"")
  1. ..I '$G(CSV) S X=$$XMLA^EDPX("log",.ROW) D XML^EDPX(X) Q
  1. ..S X=ROW("id")
  1. ..F I="patientName","timeInED","timeOutED","restored","restoredDateTime","restoredBy","closedBy","closedDateTime" D
  1. ...S X=X_$C(9)_$G(ROW(I)) D ADD^EDPCSV(X)
  1. D:'$G(CSV) XML^EDPX("</removedInErrorEntries>")
  1. Q
  1. ;
  1. INIT ;
  1. Q