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

PXICLN17.m

Go to the documentation of this file.
PXICLN17 ;ISL/JVS - Cleanup routine for PX*1.0*17 ;11/8/96
 ;;1.0;PCE PATIENT CARE ENCOUNTER;**17**;Aug 12, 1996
 ;
 ;
LOCK ;--SAVE FOR LOCKING GLOBALS
 ;
QUE ; Queue job to change 90731 to 90746 cpt code.
 N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSK,ZTSAVE,ZTCPU,ZTUCI
 D BMES^XPDUTL("Job to convert V-CPT file entries.")
 S ZTRTN="TASKED^PXICLN17"
 S ZTIO=""
 S ZTDESC="PX*1.0*17 tasked cleanup job"
 S ZTDTH=$H
 S ZTSAVE("DUZ")=DUZ,ZTSAVE("DUZ(")=""
 D ^%ZTLOAD
 I $D(ZTSK) D MES^XPDUTL("The job is task # "_ZTSK)
 I '$D(ZTSK) D MES^XPDUTL("Could not start the task job.")
 Q
 ;
TASKED ;
 D MAPPING
 D CLEANUP
 D MAIL
 K PXICOUNT,PXICNT,DA,DIK,DIK(1)
 Q
 ;
MAIL ;Send mail messge that job is done.
 N XMY,XMSUB,PXTEXT,XMTEXT
 S XMY(DUZ)=""
 S XMY("G.PCEINSTAL@ISC-SLC.DOMAIN.EXT")=""
 S XMSUB="PX*1.0*17 Cleanup is finished"
 S PXTEXT(1)="PX*1.0*17 job to convert 90731 to 90746 is done."
 S:$D(ZTQUEUED) PXTEXT(2)="The task job number "_ZTQUEUED_" is finished."
 S PXTEXT(3)=" "
 S PXTEXT(4)="Visit ID for this site is:  "_$P($G(^VSIT(150.2,+$P($G(^DIC(150.9,1,4)),"^",2),0)),"^",2)
 S PXTEXT(5)=$G(PXICOUNT)_" entries were changed at this site"
 S PXTEXT(6)=$G(PXICNT)_" entries were NOT changed at this site"
 S XMTEXT="PXTEXT("
 D ^XMD
 Q
 ;
CLEANUP ;---SUBROUTINE TO CLEAN UP CPT'S
 N PXIACTV,PXIVSTDT,PXIEN,PXIVSIT
 ;--GET ACTIVATION DATE
 S PXIEN=0 F  S PXIEN=$O(^SD(409.72,"C",90746,PXIEN)) Q:PXIEN'>0  D
 .I $P($G(^SD(409.72,PXIEN,0)),"^",5)>0 D
 ..S PXIACTV=$P($G(^SD(409.72,PXIEN,0)),"^",1)
 ;--GET ENTRIES IN V-CPT
 S PXICNT=0,PXICOUNT=0
 S PXIEN="" F  S PXIEN=$O(^AUPNVCPT("B",90731,PXIEN),-1) Q:PXIEN'>0  D
 .S PXIVSIT=$P(^AUPNVCPT(PXIEN,0),"^",3)
 .Q:'$D(^AUPNVSIT(PXIVSIT,0))
 .S PXIVSTDT=+$G(^AUPNVSIT(PXIVSIT,0))
 .I PXIVSTDT'<PXIACTV S PXICOUNT=PXICOUNT+1 D CHANGE
 .I PXIVSTDT'>PXIACTV S PXICNT=PXICNT+1
 Q
 ;
CHANGE ;
 ; PXIEN=V FILE ENTRY
 ; PXIVSIT=VISIT IEN
 N PXICLN17,PXI0,PXI12,PXI812,PXIPKG,PXISOR,VAR
 S PXI0=$G(^AUPNVCPT(PXIEN,0))
 S PXI12=$G(^AUPNVCPT(PXIEN,12))
 S PXI812=$G(^AUPNVCPT(PXIEN,812))
 S PXIPKG=$S($P($G(PXI812),"^",2)>0:$P($G(PXI812),"^",2),1:$$PKG2IEN^VSIT("PX"))
 S PXISOR=$S($P($G(PXI812),"^",3)>0:$P(^PX(839.7,$P($G(PXI812),"^",3),0),"^",1),1:"PX*1.0*17")
 ;
 I $P(PXI12,"^",4)']"" D
 .N FLAG
 .S FLAG=1
 .S $P(PXI12,"^",4)=$O(^VA(200,10))
 .;
 .S DIK="^AUPNVCPT(",DA=PXIEN D ^DIK
 .;
 .S ^TMP("PXICLN17",$J,"PROCEDURE",1,"PROCEDURE")=$P(PXI0,"^",1)
 .S ^TMP("PXICLN17",$J,"PROCEDURE",1,"QTY")=$P(PXI0,"^",16)
 .S ^TMP("PXICLN17",$J,"PROCEDURE",1,"DIAGNOISIS")=$P(PXI0,"^",5)
 .S ^TMP("PXICLN17",$J,"PROCEDURE",1,"ENC PROVIDER")=$P(PXI12,"^",4)
 .S ^TMP("PXICLN17",$J,"PROCEDURE",1,"EVENT D/T")=$P(PXI12,"^",1)
 .;
 .S VAR=$$DATA2PCE^PXAPI("^TMP(""PXICLN17"",$J)",$G(PXIPKG),$G(PXISOR),$G(PXIVSIT),"","")
 .K ^TMP("PXICLN17",$J)
 ;
 ;
 S ^TMP("PXICLN17",$J,"PROCEDURE",1,"PROCEDURE")=$P(PXI0,"^",1)
 S ^TMP("PXICLN17",$J,"PROCEDURE",1,"QTY")=$P(PXI0,"^",16)
 S ^TMP("PXICLN17",$J,"PROCEDURE",1,"DIAGNOISIS")=$P(PXI0,"^",5)
 S ^TMP("PXICLN17",$J,"PROCEDURE",1,"ENC PROVIDER")=$P(PXI12,"^",4)
 S ^TMP("PXICLN17",$J,"PROCEDURE",1,"EVENT D/T")=$P(PXI12,"^",1)
 S ^TMP("PXICLN17",$J,"PROCEDURE",1,"DELETE")=1
 ;
 I $G(FLAG) S ^TMP("PXICLN17",$J,"PROVIDER",3,"NAME")=$P($G(PXI12),"^",4)
 I $G(FLAG) S ^TMP("PXICLN17",$J,"PROVIDER",3,"DELETE")=1
 ;
 S ^TMP("PXICLN17",$J,"PROCEDURE",2,"PROCEDURE")=90746
 S ^TMP("PXICLN17",$J,"PROCEDURE",2,"QTY")=$P(PXI0,"^",16)
 S ^TMP("PXICLN17",$J,"PROCEDURE",2,"DIAGNOISIS")=$P(PXI0,"^",5)
 S ^TMP("PXICLN17",$J,"PROCEDURE",2,"ENC PROVIDER")=$P(PXI12,"^",4)
 S ^TMP("PXICLN17",$J,"PROCEDURE",2,"EVENT D/T")=$P(PXI12,"^",1)
 ;
 ;
 S VAR=$$DATA2PCE^PXAPI("^TMP(""PXICLN17"",$J)",$G(PXIPKG),$G(PXISOR),$G(PXIVSIT),"","")
 ;
 ;
 K ^TMP("PXICLN17",$J)
 Q
 ;
MAPPING ;--CLEAN UP DATA MAPPING FILE
 N PXQX,PXQY
 S PXQX=0
 S PXQX=$O(^PXD(811.1,"B","10;AUTTIMM(",PXQX))
 S $P(^PXD(811.1,PXQX,0),"^",5)=0
 S PXQX=$O(^PXD(811.1,"B","90731;ICPT(",PXQX))
 S $P(^PXD(811.1,PXQX,0),"^",5)=0
 ;--REINDEX FILE
 ;
 S DIK="^PXD(811.1,",DIK(1)=.05 D ENALL^DIK
 ;
 S ^PXD(811.1,84,0)="10;AUTTIMM(^90746;ICPT(^IMM^CPT^1"
 S ^PXD(811.1,85,0)="90746;ICPT(^10;AUTTIMM(^CPT^IMM^1"
 S DIK="^PXD(811.1,",DA=84 D EN^DIK
 S DIK="^PXD(811.1,",DA=85 D EN^DIK
 Q