MPIFP76 ;;BIR/CKN-MPI VISTA POST-INIT MPIF*1.0*76 ; 10/29/20 2:25pm
;;1.0;MASTER PATIENT INDEX VISTA;**76**;30 Apr 99;Build 1
;
POST ;
D BMES^XPDUTL("Post-init will populate the new Full ICN fields.")
;
N QUEDUZ,ZTDESC,ZTIO,ZTREQ,ZTRTN,ZTSAVE,ZTDTH
;
I $G(^XTMP("MPIFP76","CURRENT STATUS"))["FINISHED" D BMES^XPDUTL("Post-init already run... Done") Q
;
S QUEDUZ=$S($G(DUZ)="":.5,1:DUZ)
S ZTSAVE("QUEDUZ")="",ZTRTN="DQ^MPIFP76",ZTDESC="MPI/PD - Populate new Full ICN fields",ZTIO="",ZTDTH=$$NOW^XLFDT D ^%ZTLOAD
I $D(ZTSK) D BMES^XPDUTL("Job was queued as Task #"_ZTSK_".")
S ^XTMP("MPIFP76",0)=$$FMADD^XLFDT(DT,90)_"^"_DT_"^MPIF*1.0*76 POST-INIT"
S ^XTMP("MPIFP76","CURRENT STATUS")="QUEUED TASK #"_ZTSK
;
K ZTSK S:$D(ZTQUEUED) ZTREQ="@"
;
Q
;
DQ ;entry point for background job
;
N CNT,DFN,MPINODE,ICN,CKSUM,FULLICN,DIE,DA,DR,HISX,HISZ,QUIT,X,Y
;
S ^XTMP("MPIFP76","START")=$$NOW^XLFDT()
S ^XTMP("MPIFP76","CURRENT STATUS")="RUNNING AT "_$$NOW^XLFDT
S DFN=+$G(^XTMP("MPIFP76","LAST DFN"))
S CNT=+$G(^XTMP("MPIFP76","COUNT"))
;
F S DFN=$O(^DPT(DFN)) Q:'DFN D
. ;
. ;Q:DFN>5
. ;
. ; populate FULL ICN field
. S MPINODE=$G(^DPT(DFN,"MPI"))
. S ICN=$P(MPINODE,"^"),CKSUM=$P(MPINODE,"^",2),FULLICN=$P(MPINODE,"^",10)
. I ICN,CKSUM,((FULLICN="")!(FULLICN'=(ICN_"V"_CKSUM))) D
.. S FULLICN=ICN_"V"_CKSUM
.. S DIE="^DPT(",DA=DFN,DR="991.1///^S X=FULLICN" D ^DIE
.. S CNT=CNT+1,^XTMP("MPIFP76","COUNT")=CNT
. ;
. ; populate the FULL ICN HISTORY multiple
. S HISX=0 F S HISX=$O(^DPT(DFN,"MPIFHIS",HISX)) Q:'HISX D
.. S HISZ=$G(^DPT(DFN,"MPIFHIS",HISX,0))
.. S ICN=$P(HISZ,"^"),CKSUM=$P(HISZ,"^",2)
.. I ICN,CKSUM D
... S FULLICN=ICN_"V"_CKSUM
... ;
... ; lets double check it isn't here already
... S (X,QUIT)=0 F S X=$O(^DPT(DFN,"MPIFICNHIS",X)) Q:'X!(QUIT) I ^DPT(DFN,"MPIFICNHIS",X,0)=FULLICN S QUIT=1
... Q:QUIT
... ;
... ; file it
... S X=FULLICN
... S DIC="^DPT("_DFN_",""MPIFICNHIS"",",DIC(0)="L"
... S DA(1)=DFN
... D ^DIC
. ;
. ; ok all done with this patient
. S ^XTMP("MPIFP76","LAST DFN")=DFN
;
;STOP TIME
S ^XTMP("MPIFP76","STOP")=$$NOW^XLFDT()
; send e-mail to user who queued job and Dev members
N XMDUZ,XMSUB,MPI,XMY,XMTEXT,ST,STN
S ST=$$SITE^VASITE(),STN=$P(ST,"^",3)_" ("_$P(ST,"^",2)_")"
S XMDUZ="MPI PACKAGE"
S XMSUB="MPIF*1.0*76 Post Init Complete - "_STN
S XMY("Christine.Chesney@domain.ext")="",XMY("John.Williams30ec0c@domain.ext")="",XMY("Chintan.Naik@domain.ext")=""
S XMY(QUEDUZ)="",XMTEXT="MPI(1,"
S MPI(1,1)="Post Init for patch MPIF*1.0*76 has run to completion."
S MPI(1,2)="Start Time: "_$$FMTE^XLFDT($G(^XTMP("MPIFP76","START")))
S MPI(1,3)=" Stop Time: "_$$FMTE^XLFDT($G(^XTMP("MPIFP76","STOP")))
S MPI(1,4)="Total Records updated: "_+$G(^XTMP("MPIFP76","COUNT"))
S MPI(1,5)="You may now delete routine ^MPIFP76."
D ^XMD
;
S ^XTMP("MPIFP76","CURRENT STATUS")="FINISHED AT "_$$NOW^XLFDT
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMPIFP76 2979 printed Dec 13, 2024@02:11:23 Page 2
MPIFP76 ;;BIR/CKN-MPI VISTA POST-INIT MPIF*1.0*76 ; 10/29/20 2:25pm
+1 ;;1.0;MASTER PATIENT INDEX VISTA;**76**;30 Apr 99;Build 1
+2 ;
POST ;
+1 DO BMES^XPDUTL("Post-init will populate the new Full ICN fields.")
+2 ;
+3 NEW QUEDUZ,ZTDESC,ZTIO,ZTREQ,ZTRTN,ZTSAVE,ZTDTH
+4 ;
+5 IF $GET(^XTMP("MPIFP76","CURRENT STATUS"))["FINISHED"
DO BMES^XPDUTL("Post-init already run... Done")
QUIT
+6 ;
+7 SET QUEDUZ=$SELECT($GET(DUZ)="":.5,1:DUZ)
+8 SET ZTSAVE("QUEDUZ")=""
SET ZTRTN="DQ^MPIFP76"
SET ZTDESC="MPI/PD - Populate new Full ICN fields"
SET ZTIO=""
SET ZTDTH=$$NOW^XLFDT
DO ^%ZTLOAD
+9 IF $DATA(ZTSK)
DO BMES^XPDUTL("Job was queued as Task #"_ZTSK_".")
+10 SET ^XTMP("MPIFP76",0)=$$FMADD^XLFDT(DT,90)_"^"_DT_"^MPIF*1.0*76 POST-INIT"
+11 SET ^XTMP("MPIFP76","CURRENT STATUS")="QUEUED TASK #"_ZTSK
+12 ;
+13 KILL ZTSK
if $DATA(ZTQUEUED)
SET ZTREQ="@"
+14 ;
+15 QUIT
+16 ;
DQ ;entry point for background job
+1 ;
+2 NEW CNT,DFN,MPINODE,ICN,CKSUM,FULLICN,DIE,DA,DR,HISX,HISZ,QUIT,X,Y
+3 ;
+4 SET ^XTMP("MPIFP76","START")=$$NOW^XLFDT()
+5 SET ^XTMP("MPIFP76","CURRENT STATUS")="RUNNING AT "_$$NOW^XLFDT
+6 SET DFN=+$GET(^XTMP("MPIFP76","LAST DFN"))
+7 SET CNT=+$GET(^XTMP("MPIFP76","COUNT"))
+8 ;
+9 FOR
SET DFN=$ORDER(^DPT(DFN))
if 'DFN
QUIT
Begin DoDot:1
+10 ;
+11 ;Q:DFN>5
+12 ;
+13 ; populate FULL ICN field
+14 SET MPINODE=$GET(^DPT(DFN,"MPI"))
+15 SET ICN=$PIECE(MPINODE,"^")
SET CKSUM=$PIECE(MPINODE,"^",2)
SET FULLICN=$PIECE(MPINODE,"^",10)
+16 IF ICN
IF CKSUM
IF ((FULLICN="")!(FULLICN'=(ICN_"V"_CKSUM)))
Begin DoDot:2
+17 SET FULLICN=ICN_"V"_CKSUM
+18 SET DIE="^DPT("
SET DA=DFN
SET DR="991.1///^S X=FULLICN"
DO ^DIE
+19 SET CNT=CNT+1
SET ^XTMP("MPIFP76","COUNT")=CNT
End DoDot:2
+20 ;
+21 ; populate the FULL ICN HISTORY multiple
+22 SET HISX=0
FOR
SET HISX=$ORDER(^DPT(DFN,"MPIFHIS",HISX))
if 'HISX
QUIT
Begin DoDot:2
+23 SET HISZ=$GET(^DPT(DFN,"MPIFHIS",HISX,0))
+24 SET ICN=$PIECE(HISZ,"^")
SET CKSUM=$PIECE(HISZ,"^",2)
+25 IF ICN
IF CKSUM
Begin DoDot:3
+26 SET FULLICN=ICN_"V"_CKSUM
+27 ;
+28 ; lets double check it isn't here already
+29 SET (X,QUIT)=0
FOR
SET X=$ORDER(^DPT(DFN,"MPIFICNHIS",X))
if 'X!(QUIT)
QUIT
IF ^DPT(DFN,"MPIFICNHIS",X,0)=FULLICN
SET QUIT=1
+30 if QUIT
QUIT
+31 ;
+32 ; file it
+33 SET X=FULLICN
+34 SET DIC="^DPT("_DFN_",""MPIFICNHIS"","
SET DIC(0)="L"
+35 SET DA(1)=DFN
+36 DO ^DIC
End DoDot:3
End DoDot:2
+37 ;
+38 ; ok all done with this patient
+39 SET ^XTMP("MPIFP76","LAST DFN")=DFN
End DoDot:1
+40 ;
+41 ;STOP TIME
+42 SET ^XTMP("MPIFP76","STOP")=$$NOW^XLFDT()
+43 ; send e-mail to user who queued job and Dev members
+44 NEW XMDUZ,XMSUB,MPI,XMY,XMTEXT,ST,STN
+45 SET ST=$$SITE^VASITE()
SET STN=$PIECE(ST,"^",3)_" ("_$PIECE(ST,"^",2)_")"
+46 SET XMDUZ="MPI PACKAGE"
+47 SET XMSUB="MPIF*1.0*76 Post Init Complete - "_STN
+48 SET XMY("Christine.Chesney@domain.ext")=""
SET XMY("John.Williams30ec0c@domain.ext")=""
SET XMY("Chintan.Naik@domain.ext")=""
+49 SET XMY(QUEDUZ)=""
SET XMTEXT="MPI(1,"
+50 SET MPI(1,1)="Post Init for patch MPIF*1.0*76 has run to completion."
+51 SET MPI(1,2)="Start Time: "_$$FMTE^XLFDT($GET(^XTMP("MPIFP76","START")))
+52 SET MPI(1,3)=" Stop Time: "_$$FMTE^XLFDT($GET(^XTMP("MPIFP76","STOP")))
+53 SET MPI(1,4)="Total Records updated: "_+$GET(^XTMP("MPIFP76","COUNT"))
+54 SET MPI(1,5)="You may now delete routine ^MPIFP76."
+55 DO ^XMD
+56 ;
+57 SET ^XTMP("MPIFP76","CURRENT STATUS")="FINISHED AT "_$$NOW^XLFDT
+58 ;
+59 QUIT