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

PXQPPUTILR.m

Go to the documentation of this file.
  1. PXQPPUTILR ;SLS/PKR - Utility for primary provider, report. ;08/14/2020
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
  1. ;
  1. ;===============
  1. REPORT ;Report what was done.
  1. N FMTSTR,IENS,JND,NL,NOUT,NUM,OUTPUT,PROVIDER,PROVNAME
  1. N REPEND,REPSTART,TEMP,TEXT
  1. N VISIT,VISITID,VISITIEN,X
  1. S REPSTART=^TMP("PXQPPR",$J,"REPSTART")
  1. S REPEND=$$NOW^XLFDT
  1. S TEXT(1)="Primary Provider repair utility started "_$$FMTE^XLFDT(REPSTART)_"."
  1. S TEXT(2)="Finished "_$$FMTE^XLFDT(REPEND)_"."
  1. S TEXT(3)="Elapsed time "_$$FMDIFF^XLFDT(REPEND,REPSTART,3)_"."
  1. S TEXT(4)=""
  1. S TEXT(5)="Encounter start date: "_$$FMTE^XLFDT(^TMP("PXQPPR",$J,"STARTDATE"))
  1. S TEXT(6)="Encounter end date: "_$$FMTE^XLFDT(^TMP("PXQPPR",$J,"ENDDATE"))
  1. S TEXT(7)=" "
  1. S NL=7
  1. ;
  1. ;Lab encounters.
  1. I $D(^TMP("PXQPPR",$J,"LAB")) D
  1. . S NL=NL+1,TEXT(NL)=" "
  1. . S NL=NL+1,TEXT(NL)="Lab Encounter Results:"
  1. . I $D(^TMP("PXQPPR",$J,"LAB","SETP")) D
  1. .. S FMTSTR="25L2^44L2^7L"
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)="List of Ordering Providers Made Primary"
  1. .. S TEMP="Visit^Primary Provider^Result"
  1. .. D COLFMT^PXRMTEXT(FMTSTR,TEMP," ",.NOUT,.OUTPUT)
  1. .. S NL=NL+1,TEXT(NL)=OUTPUT(1)
  1. .. S NUM=0,VISITIEN=""
  1. .. F S VISITIEN=$O(^TMP("PXQPPR",$J,"LAB","SETP",VISITIEN)) Q:VISITIEN="" D
  1. ... S VISIT=$P(^AUPNVSIT(VISITIEN,0),U,1)
  1. ... S VISITID=$P(^AUPNVSIT(VISITIEN,150),U,1)
  1. ... S VISIT=$$FMTE^XLFDT(VISIT)_" ("_VISITID_")"
  1. ... S PROVIDER=$O(^TMP("PXQPPR",$J,"LAB","SETP",VISITIEN,""))
  1. ... S PROVNAME=$P(^VA(200,PROVIDER,0),U,1)_" ("_PROVIDER_")"
  1. ... S RESULT=^TMP("PXQPPR",$J,"LAB","SETP",VISITIEN,PROVIDER)
  1. ... I RESULT="SUCCESS" S NUM=NUM+1
  1. ... S TEMP=VISIT_"^"_PROVNAME_"^"_RESULT
  1. ... D COLFMT^PXRMTEXT(FMTSTR,TEMP," ",.NOUT,.OUTPUT)
  1. ... F JND=1:1:NOUT S NL=NL+1,TEXT(NL)=OUTPUT(JND)
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)=NUM_" lab encounters had a primary provider automatically set."
  1. . I $D(^TMP("PXQPPR",$J,"LAB","OPEN")) D
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)="Lab Encounters Opened For Editing"
  1. .. S NUM=0,VISITIEN=""
  1. .. F S VISITIEN=$O(^TMP("PXQPPR",$J,"LAB","OPEN",VISITIEN)) Q:VISITIEN="" D
  1. ... S VISIT=$P(^AUPNVSIT(VISITIEN,0),U,1)
  1. ... S VISITID=$P(^AUPNVSIT(VISITIEN,150),U,1)
  1. ... S VISIT=$$FMTE^XLFDT(VISIT)_" ("_VISITID_")"
  1. ... S NL=NL+1,TEXT(NL)=VISIT
  1. ... S NUM=NUM+1
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)=NUM_" lab encounters were opened for editing."
  1. S NL=NL+1,TEXT(NL)=" "
  1. ;
  1. ;Radiology encounters.
  1. I $D(^TMP("PXQPPR",$J,"RAD")) D
  1. . S NL=NL+1,TEXT(NL)=" "
  1. . S NL=NL+1,TEXT(NL)="Radiology Encounter Results:"
  1. . I $D(^TMP("PXQPPR",$J,"RAD","SETP")) D
  1. .. S FMTSTR="25L2^44L2^7L"
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)="List of Encounter Providers Made Primary"
  1. .. S TEMP="Visit^Primary Provider^Result"
  1. .. D COLFMT^PXRMTEXT(FMTSTR,TEMP," ",.NOUT,.OUTPUT)
  1. .. S NL=NL+1,TEXT(NL)=OUTPUT(1)
  1. .. S NUM=0,VISITIEN=""
  1. .. F S VISITIEN=$O(^TMP("PXQPPR",$J,"RAD","SETP",VISITIEN)) Q:VISITIEN="" D
  1. ... S VISIT=$P(^AUPNVSIT(VISITIEN,0),U,1)
  1. ... S VISITID=$P(^AUPNVSIT(VISITIEN,150),U,1)
  1. ... S VISIT=$$FMTE^XLFDT(VISIT)_" ("_VISITID_")"
  1. ... S PROVIDER=$O(^TMP("PXQPPR",$J,"RAD","SETP",VISITIEN,""))
  1. ... S PROVNAME=$P(^VA(200,PROVIDER,0),U,1)_" ("_PROVIDER_")"
  1. ... S RESULT=^TMP("PXQPPR",$J,"RAD","SETP",VISITIEN,PROVIDER)
  1. ... I RESULT="SUCCESS" S NUM=NUM+1
  1. ... S TEMP=VISIT_"^"_PROVNAME_"^"_RESULT
  1. ... D COLFMT^PXRMTEXT(FMTSTR,TEMP," ",.NOUT,.OUTPUT)
  1. ... F JND=1:1:NOUT S NL=NL+1,TEXT(NL)=OUTPUT(JND)
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)=NUM_" radiology encounters had a primary provider automatically set."
  1. .;
  1. . I $D(^TMP("PXQPPR",$J,"RAD","NO EXAM")) D
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)="No Radiology Exams are linked to the following encounters."
  1. .. S NUM=0,VISITIEN=""
  1. .. F S VISITIEN=$O(^TMP("PXQPPR",$J,"RAD","NO EXAM",VISITIEN)) Q:VISITIEN="" D
  1. ... S VISIT=$P(^AUPNVSIT(VISITIEN,0),U,1)
  1. ... S VISITID=$P(^AUPNVSIT(VISITIEN,150),U,1)
  1. ... S VISIT=$$FMTE^XLFDT(VISIT)_" ("_VISITID_")"
  1. ... S NUM=NUM+1
  1. ... S NL=NL+1,TEXT(NL)=VISIT
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)=NUM_" radiology encounters could not be linked to an exam."
  1. .;
  1. . I $D(^TMP("PXQPPR",$J,"RAD","VISIT")) D
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)="The following Radiology Exams were linked to an encounter."
  1. .. S FMTSTR="30L2^35L"
  1. .. S TEMP="Exam IENS^Visit"
  1. .. D COLFMT^PXRMTEXT(FMTSTR,TEMP," ",.NOUT,.OUTPUT)
  1. .. S NL=NL+1,TEXT(NL)=OUTPUT(1)
  1. .. S NUM=0,VISITIEN=""
  1. .. F S VISITIEN=$O(^TMP("PXQPPR",$J,"RAD","VISIT",VISITIEN)) Q:VISITIEN="" D
  1. ... S NUM=NUM+1
  1. ... S VISIT=$P(^AUPNVSIT(VISITIEN,0),U,1)
  1. ... S VISITID=$P(^AUPNVSIT(VISITIEN,150),U,1)
  1. ... S VISIT=$$FMTE^XLFDT(VISIT)_" ("_VISITID_")"
  1. ... S IENS=^TMP("PXQPPR",$J,"RAD","VISIT",VISITIEN)
  1. ... S TEMP=IENS_"^"_VISIT
  1. ... D COLFMT^PXRMTEXT(FMTSTR,TEMP," ",.NOUT,.OUTPUT)
  1. ... S NL=NL+1,TEXT(NL)=OUTPUT(1)
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)=NUM_" Exams were linked to a Visit."
  1. .;
  1. . I $D(^TMP("PXQPPR",$J,"RAD","PROXY")) D
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)="Encounters with RADIOLOGY,OUTSIDE SERVICE as Primary Provider Opened For Editing"
  1. .. S NUM=0,VISITIEN=""
  1. .. F S VISITIEN=$O(^TMP("PXQPPR",$J,"RAD","PROXY",VISITIEN)) Q:VISITIEN="" D
  1. ... S VISIT=$P(^AUPNVSIT(VISITIEN,0),U,1)
  1. ... S VISITID=$P(^AUPNVSIT(VISITIEN,150),U,1)
  1. ... S VISIT=$$FMTE^XLFDT(VISIT)_" ("_VISITID_")"
  1. ... S NL=NL+1,TEXT(NL)=VISIT
  1. ... S NUM=NUM+1
  1. .. S NL=NL+1,TEXT(NL)=" "
  1. .. S NL=NL+1,TEXT(NL)=NUM_" radiology encounters were opened for editing."
  1. S NL=NL+1,TEXT(NL)=" "
  1. ;
  1. ;Show the results.
  1. S X="IORESET"
  1. D ENDR^%ZISS
  1. D BROWSE^DDBR("TEXT","NR","Primary Provider Repair Utility Report")
  1. W IORESET
  1. D KILL^%ZISS
  1. K ^TMP("PXQPPR",$J)
  1. Q
  1. ;