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

PXICLN27.m

Go to the documentation of this file.
  1. PXICLN27 ;ISL/dee - Cleanup providers, routine for PX*1.0*27 ;3/26/97
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**27**;Aug 12, 1996
  1. ENV N PXIPRVLR,PXIPC1,PXIPC2,PXACTIVE,PXIPAT9
  1. S PXIPAT9=$P($G(^PX(815,1,"PATCH")),"^",1)
  1. I $O(^AUPNVSIT(PXIPAT9),-1)>0!'(+PXIPAT9) D
  1. . S XPDABORT=2
  1. . W !!,"It looks like the cleanup routine in PCE patch PX*1.0*9 did not finish."
  1. . W !,"The cleanup in patch 9 needs to be restarted so that it can finish."
  1. . W !,"To restart, enter D QUE^PXICLN9 from the programmers prompt."
  1. S PXIPRVLR=+$G(^LAB(69.9,1,12))
  1. I PXIPRVLR<1 D Q
  1. . S XPDABORT=2
  1. . W !!,"The default Lab provider that was added in Lab patch LR*5.2*158"
  1. . W !,"has not been set up. This provider must be setup before installing"
  1. . W !,"this patch."
  1. S PXIPC1=$$GET^XUA4A72(+PXIPRVLR,DT)
  1. S PXIPC2=$$GET^XUA4A72(+PXIPRVLR,2961001)
  1. S PXACTIVE=$P(^VA(200,+PXIPRVLR,0),"^",11)
  1. I PXIPC1<1!(PXIPC2<1)!(PXACTIVE'="") D
  1. . S XPDABORT=2
  1. . W !!,"The default Lab provider that was added in Lab patch LR*5.2*158"
  1. . W !,"is not a valid provider. Either they have been terminated or"
  1. . W !,"they do not have a valid person class from 10/1/96 through now."
  1. Q
  1. ;
  1. QUE ; Queue job to cleanup Lab Providers.
  1. N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSK,ZTSAVE,ZTCPU,ZTUCI
  1. D BMES^XPDUTL("Job to cleanup Lab and other Providers.")
  1. S ZTRTN="TASKED^PXICLN27"
  1. S ZTIO=""
  1. S ZTDESC="PX*1.0*27 tasked cleanup job"
  1. S ZTDTH=$H
  1. S ZTSAVE("DUZ")=DUZ,ZTSAVE("DUZ(")=""
  1. D ^%ZTLOAD
  1. I $D(ZTSK) D MES^XPDUTL("The job is task # "_ZTSK)
  1. I '$D(ZTSK) D MES^XPDUTL("Could not start the task job.") D BMES^XPDUTL("You should start it by doing: D QUE^PXICLN27 at the programmers prompt.")
  1. Q
  1. ;
  1. TASKED ;
  1. D CLEANUP
  1. D MAIL
  1. Q
  1. ;
  1. MAIL ;Send mail messge that job is done.
  1. N XMY,XMSUB,PXTEXT,XMTEXT
  1. S XMY(DUZ)=""
  1. ;S XMY("G.PCEINSTAL@ISC-SLC.DOMAIN.EXT")=""
  1. S XMSUB="PX*1.0*27 Cleanup is finished"
  1. S PXTEXT(1)="PX*1.0*27 job to cleanup Lab Providers is done."
  1. S:$D(ZTQUEUED) PXTEXT(2)="The task job number "_ZTQUEUED_" is finished."
  1. S PXTEXT(3)=" "
  1. S PXTEXT(4)="Visit ID for this site is: "_$P($G(^VSIT(150.2,+$P($G(^DIC(150.9,1,4)),"^",2),0)),"^",2)
  1. S XMTEXT="PXTEXT("
  1. D ^XMD
  1. Q
  1. ;
  1. REPORT ;Send mail messge of what was done.
  1. N XMY,XMSUB,XMTEXT
  1. S XMY(DUZ)=""
  1. S PXIPART=PXIPART+1
  1. S XMSUB="PX*1.0*27 Cleanup Results Part "_PXIPART
  1. S ^TMP("PXTEXT",$J,1)="PX*1.0*27 job to cleanup Lab Providers."
  1. S:$D(ZTQUEUED) ^TMP("PXTEXT",$J,2)="The task job number "_ZTQUEUED
  1. S ^TMP("PXTEXT",$J,3)=" "
  1. S ^TMP("PXTEXT",$J,4)="IEN Patient Encounter Date/Time"
  1. S ^TMP("PXTEXT",$J,5)=" Provider What was done or found."
  1. S ^TMP("PXTEXT",$J,6)=" "
  1. S ^TMP("PXTEXT",$J,7)=" * in front of the IEN means was not able to cleanup."
  1. S ^TMP("PXTEXT",$J,8)=" "
  1. S XMTEXT="^TMP(""PXTEXT"",$J,"
  1. D ^XMD
  1. K ^TMP("PXTEXT",$J)
  1. Q
  1. ;
  1. CLEANUP ;
  1. N PXIVSIT,PXIVSTDT,PXIPRV,PXICOUNT
  1. N PXISORLR,PXIPKGLR,PXIPRVLR,PXILRNAM
  1. N PXISORPX,PXIPKGPX,PXIPC
  1. N PXACTIVE,PXIPRV0,PXI,PXISOR,PXIPKG
  1. N PXIFDA,PXIDIERR,PXICPT,PXICPTC
  1. N PXIMSG,PXIVSIT0,PXIPART
  1. ;
  1. ;Set up report mail message
  1. S PXIPART=0
  1. S PXIMSG=8
  1. K ^TMP("PXTEXT",$J)
  1. ;
  1. ;Set up package and source for PCE and Lab
  1. ;S PXISORLR=$$SOURCE^PXAPIUTL("LAB DATA")
  1. S PXIPKGLR=$$PKG2IEN^VSIT("LR")
  1. S PXISORPX=$$SOURCE^PXAPIUTL("CLEANUP IN PCE PATCH 27")
  1. S PXIPKGPX=$$PKG2IEN^VSIT("PX")
  1. ;
  1. ;get Provider for lab data
  1. S PXIPRVLR=+$G(^LAB(69.9,1,12))
  1. S PXILRNAM=$P($G(^VA(200,+PXIPRVLR,0)),"^",1)
  1. ;
  1. ;Where to start?
  1. S PXIVSTDT=$P($G(^PX(815,1,"PATCH")),"^",2)
  1. ;
  1. ;*R "Visit ien: ",PXIVSIT ;*
  1. ;*S PXIVSTDT=+^AUPNVSIT(PXIVSIT,0)
  1. ;*D ;*
  1. ;*.D ;*
  1. F S PXIVSTDT=$O(^AUPNVSIT("B",PXIVSTDT),-1) Q:'PXIVSTDT!(PXIVSTDT<2961001) D
  1. . S PXIVSIT=0
  1. . F S PXIVSIT=$O(^AUPNVSIT("B",PXIVSTDT,PXIVSIT)) Q:'PXIVSIT D
  1. .. K PXISOR,PXIPKG,PXI
  1. .. S PXICOUNT=0
  1. .. S PXIPRV=0
  1. .. F S PXIPRV=$O(^AUPNVPRV("AD",PXIVSIT,PXIPRV)) Q:'PXIPRV D
  1. ... S PXIPRV0=$G(^AUPNVPRV(PXIPRV,0))
  1. ... S PXIPC=$$GET^XUA4A72(+PXIPRV0,PXIVSTDT)
  1. ... S PXACTIVE=$P(^VA(200,+PXIPRV0,0),"^",11)
  1. ... I $P($G(^AUPNVPRV(PXIPRV,812)),"^",2)=PXIPKGLR D
  1. .... ;Lab
  1. .... I $P(PXIPRV0,"^",6)>0,(PXACTIVE=""!(PXACTIVE>PXIVSTDT)) Q ;this one is ok
  1. .... I +PXIPC>0,'$P(PXIPRV0,"^",6),(PXACTIVE=""!(PXACTIVE>PXIVSTDT)) D
  1. ..... ;This one need the Person class added
  1. ..... S PXICOUNT=PXICOUNT+1
  1. ..... S PXI("PROVIDER",PXICOUNT,"NAME")=$P(PXIPRV0,"^",1)
  1. ..... S PXIVSIT0=$G(^AUPNVSIT(PXIVSIT,0))
  1. ..... S PXIMSG=PXIMSG+1
  1. ..... S ^TMP("PXTEXT",$J,PXIMSG)=PXIVSIT_" "_$P($G(^DPT($P(PXIVSIT0,"^",5),0)),"^")_" "_$$FDTTM^VALM1(+PXIVSIT0)
  1. ..... S PXIMSG=PXIMSG+1
  1. ..... S ^TMP("PXTEXT",$J,PXIMSG)=" "_$P($G(^VA(200,+PXIPRV0,0)),"^",1)_" "_"Added person class"
  1. ..... I '$D(PXIPKG) D
  1. ...... S PXIPKG=$P($G(^AUPNVPRV(+PXIPRV,812)),"^",2)
  1. ...... S PXISOR=$P($G(^AUPNVPRV(+PXIPRV,812)),"^",3)
  1. .... E D
  1. ..... ;This one needs replaced.
  1. ..... ;Delete this one
  1. ..... S PXICOUNT=PXICOUNT+1
  1. ..... S PXI("PROVIDER",PXICOUNT,"NAME")=$P(PXIPRV0,"^",1)
  1. ..... S PXI("PROVIDER",PXICOUNT,"DELETE")=1
  1. ..... ;Add default one
  1. ..... S PXICOUNT=PXICOUNT+1
  1. ..... S PXI("PROVIDER",PXICOUNT,"NAME")=PXIPRVLR
  1. ..... S PXI("PROVIDER",PXICOUNT,"PRIMARY")=1
  1. ..... S PXIVSIT0=$G(^AUPNVSIT(PXIVSIT,0))
  1. ..... S PXIMSG=PXIMSG+1
  1. ..... S ^TMP("PXTEXT",$J,PXIMSG)=PXIVSIT_" "_$P($G(^DPT($P(PXIVSIT0,"^",5),0)),"^")_" "_$$FDTTM^VALM1(+PXIVSIT0)
  1. ..... S PXIMSG=PXIMSG+1
  1. ..... S ^TMP("PXTEXT",$J,PXIMSG)=" Change Provider "_$P($G(^VA(200,+PXIPRV0,0)),"^",1)_" to Provider "_PXILRNAM
  1. ..... I '$D(PXIPKG) D
  1. ...... S PXIPKG=$P($G(^AUPNVPRV(+PXIPRV,812)),"^",2)
  1. ...... S PXISOR=$P($G(^AUPNVPRV(+PXIPRV,812)),"^",3)
  1. ..... ;Fix all V CPT that have this as the encounter provider
  1. ..... S PXICPT=0
  1. ..... F S PXICPT=$O(^AUPNVCPT("AD",PXIVSIT,PXICPT)) Q:'PXICPT D
  1. ...... I $P($G(^AUPNVCPT(PXICPT,12)),"^",4)=+PXIPRV0 D
  1. ....... K PXIFDA,PXIDIERR
  1. ....... S PXICPTC=PXICPT_","
  1. ....... S PXIFDA(9000010.18,PXICPTC,1204)=PXIPRVLR
  1. ....... D FILE^DIE("","PXIFDA","PXIDIERR")
  1. ... E D
  1. .... ;not lab
  1. .... I '$P(PXIPRV0,"^",6) D
  1. ..... I +PXIPC>0 D
  1. ...... ;Need to add Person Class
  1. ...... S PXICOUNT=PXICOUNT+1
  1. ...... S PXI("PROVIDER",PXICOUNT,"NAME")=$P(PXIPRV0,"^",1)
  1. ...... S PXIVSIT0=$G(^AUPNVSIT(PXIVSIT,0))
  1. ...... S PXIMSG=PXIMSG+1
  1. ...... S ^TMP("PXTEXT",$J,PXIMSG)=PXIVSIT_" "_$P($G(^DPT($P(PXIVSIT0,"^",5),0)),"^")_" "_$$FDTTM^VALM1(+PXIVSIT0)
  1. ...... S PXIMSG=PXIMSG+1
  1. ...... S ^TMP("PXTEXT",$J,PXIMSG)=" "_$P($G(^VA(200,+PXIPRV0,0)),"^",1)_" "_"Added person class"
  1. ...... I '$D(PXIPKG) D
  1. ....... S PXIPKG=$P($G(^AUPNVPRV(+PXIPRV,812)),"^",2)
  1. ....... S PXISOR=$P($G(^AUPNVPRV(+PXIPRV,812)),"^",3)
  1. ..... E D
  1. ...... ;Needs Person Class but none to add
  1. ...... S PXIVSIT0=$G(^AUPNVSIT(PXIVSIT,0))
  1. ...... S PXIMSG=PXIMSG+1
  1. ...... S ^TMP("PXTEXT",$J,PXIMSG)="*"_PXIVSIT_" "_$P($G(^DPT($P(PXIVSIT0,"^",5),0)),"^")_" "_$$FDTTM^VALM1(+PXIVSIT0)
  1. ...... S PXIMSG=PXIMSG+1
  1. ...... S ^TMP("PXTEXT",$J,PXIMSG)=" "_$P($G(^VA(200,+PXIPRV0,0)),"^",1)_" "_"STILL NEEDS A PERSON CLASS"
  1. .. ;
  1. .. I $D(PXI) D
  1. ... ;Process
  1. ... I $G(PXIPKG)<1 S PXIPKG=PXIPKGPX
  1. ... I $G(PXISOR)<1 S PXISOR=PXISORPX
  1. ... I $$DATA2PCE^PXAPI("PXI",PXIPKG,PXISOR,PXIVSIT)
  1. .. I PXIMSG>2000 D REPORT S PXIMSG=8
  1. . ;
  1. . S $P(^PX(815,1,"PATCH"),"^",2)=PXIVSTDT
  1. I PXIMSG>8 D REPORT
  1. Q
  1. ;