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

EDPQPCE.m

Go to the documentation of this file.
  1. EDPQPCE ;SLC/KCM - Retrieve PCE information for ED Visits ; 9/20/21 11:53am
  1. ;;2.0;EMERGENCY DEPARTMENT;**6,2,16**;Feb 24, 2012;Build 6
  1. ;
  1. DXPRI(AREA,LOG) ; return primary diagnosis
  1. N DXLST
  1. D DXALL(AREA,LOG,.DXLST)
  1. Q $G(DXLST(1)) ;$P( ,U,2)
  1. ;
  1. DXALL(AREA,LOG,DXLST) ; build list of diagnoses for a visit
  1. N EDPVISIT S EDPVISIT=$P(^EDP(230,LOG,0),U,12)
  1. I EDPVISIT,$P($G(^EDPB(231.9,AREA,1)),U,2) D DXPCE(EDPVISIT,.DXLST) I 1
  1. E D DXFREE(LOG,.DXLST)
  1. Q
  1. DXPCE(EDPVISIT,DXLST) ; return a list of diagnoses from PCE
  1. ; DRP 04062012 ADD ICD10 API CALLS EDP*2.0*2 Begin
  1. N I,X,CODE,NAME,DX,EDPLVDT,EDPLCIEN,EDPLCTYPE
  1. K ^TMP("PXKENC",$J)
  1. D ENCEVENT^PXAPI(EDPVISIT)
  1. S I=0,DX=0 F S I=$O(^TMP("PXKENC",$J,EDPVISIT,"POV",I)) Q:'I D
  1. . S X=^TMP("PXKENC",$J,EDPVISIT,"POV",I,0)
  1. . S EDPLVDT=$P($G(^TMP("PXKENC",$J,EDPVISIT,"VST",EDPVISIT,0)),U,1)
  1. . S EDPLCTYPE=$$VER^EDPLEX($$CSYS^EDPLEX(EDPLVDT))
  1. . S EDPLCIEN=$P(X,U)
  1. . S CODE=$P($$ICDDATA^EDPLEX("DIAG",EDPLCIEN,EDPLVDT),U,2) ; DRP
  1. . ;DRP end EDP*2.0*2 changes
  1. . S NAME=$G(^AUTNPOV($P(X,U,4),0))
  1. . I 'NAME S NAME=$$LD^ICDEX(80,EDPLCIEN,EDPLCTYPE) ; *16
  1. . S:NAME'[EDPLCTYPE NAME=NAME_" ("_$G(EDPLCTYPE)_" "_CODE_")"
  1. . S DX=DX+1,DX($S($P(X,U,12)="P":DX,1:DX*10000))=CODE_U_NAME_U_EDPLCTYPE
  1. S X="",DXLST=DX F I=1:1 S X=$O(DX(X)) Q:X="" S DXLST(I)=DX(X)
  1. Q
  1. DXFREE(LOG,DXLST) ; return free text diagnoses from ED LOG file
  1. N I,CODE,NAME,X4,DX,EDPLVDT,EDPLCIEN,EDPLCTYPE
  1. S I=0,DX=0 F S I=$O(^EDP(230,LOG,4,I)) Q:'I D
  1. . S X4=^EDP(230,LOG,4,I,0)
  1. . ; DRP 04062012 ADD ICD10 API CALLS EDP*2.0*2 Begin
  1. . S EDPLVDT=$P(^EDP(230,LOG,0),U,8) ;added this line DRP
  1. . S EDPLCIEN=$P(X4,U,2) S:EDPLCIEN CODE=$P($$ICDDATA^EDPLEX("DIAG",EDPLCIEN,EDPLVDT),U,2)
  1. . S:$G(CODE)'="" EDPLCTYPE=$$VER^EDPLEX($$CSYS^EDPLEX(EDPLVDT))
  1. . S NAME=$P(X4,U,1)
  1. . S:NAME'[$G(EDPLCTYPE) NAME=NAME_" ("_$G(EDPLCTYPE)_" "_$G(CODE)_")" ; drp added this line
  1. . S DX=DX+1,DX($S(+$P(X4,U,3):DX,1:DX*10000))=$G(CODE)_U_NAME_U_$G(EDPLCTYPE)
  1. . ;DRP end EDP*2.0*2 changes
  1. S X="",DXLST=DX F I=1:1 S X=$O(DX(X)) Q:X="" S DXLST(I)=DX(X)
  1. Q
  1. DXFREE2(LOG,DXLST) ; return ONLY the free text diagnosis
  1. N I,CODE,NAME,X4,DX
  1. S I=0,DX=0 F S I=$O(^EDP(230,LOG,4,I)) Q:'I D
  1. . S X4=^EDP(230,LOG,4,I,0)
  1. . S NAME=$P(X4,U,1)
  1. . S DX=DX+1,DX($S(+$P(X4,U,3):DX,1:DX*10000))=NAME
  1. S X="",DXLST=DX F I=1:1 S X=$O(DX(X)) Q:X="" S DXLST(I)=DX(X)
  1. Q