MPIFQUE3 ;SF/TNV-Generate Batch message for comparison of CMOR score ;FEB 27, 1998
;;1.0; MASTER PATIENT INDEX VISTA ;**1,3**;30 Apr 99
;
COMP ; Create a batch CMOR request for comparing the CMOR score with the owner
; of this patient. This will be for ALL CMOR SITES. (NOT ONE SITE)
;
N DIRUT
S DIR("A")="This process will take a while to complete. Are you sure? "
S DIR("B")="NO",DIR(0)="YAO" D ^DIR K DIR Q:$D(DIRUT)
I Y=0 K DIR Q ; no go
I $P($G(^RGSITE(991.8,1,"COMP")),"^")'="" S $P(^("COMP"),"^")=""
TASK ; Task this job to run
S ZTIO="",ZTRTN="EN^MPIFQUE3",ZTSAVE("DUZ")=""
S ZTDESC="GENERATE CMOR COMPARISON PROCESS"
D ^%ZTLOAD
I $D(ZTSK) W " Task#, ",ZTSK," queued" S $P(^RGSITE(991.8,1,"COMP"),U,5)=ZTSK
;
KILL ; Clean up the partition
K DIR,ZTSK,Y,ZTIO,ZTRTN,ZTDESC,ZTSAVE
Q
;
EN ; Entry point for CMOR Batch comparison. This should only be run after
; the initialization to the MPI has been completed.
N U,SITE,NODE,MPI,MTIEN,MPILOOP,DTNOW,MSGCOUNT,LINCOUNT,RGLOG
S U="^",(MPILOOP,SITE)="",MPISTOP=0
D START^RGHLLOG()
N X,Y,DIC
S DIC="^VA(200,",DIC(0)="MZO",X="`"_+DUZ
D ^DIC
I $G(Y)<1 S MPINAME=""
I $G(Y)>0 S MPINAME=$G(Y(0,0))
; If the job has manually stopped status it should restart at where
; it left off
I $P($G(^RGSITE(991.8,1,"COMP")),U,4)="MS" D
. I $P($G(^RGSITE(991.8,1,"COMP")),U)="" S $P(^("COMP"),U,4)="C" Q ; Not logical restart from the top
. S NODE=$$MPINODE^MPIFAPI(+$P(^RGSITE(991.8,1,"COMP"),U))
. S CMOR=$P(NODE,U,3) ; CMOR of the last patient
. I +CMOR>0 S SITE=$O(^DPT("ACMOR",CMOR),-1) ; Back up one level
. I +CMOR>0 S MPILOOP=+$P(^RGSITE(991.8,1,"COMP"),U) ; Marked the last patient
. I +CMOR<1 S (SITE,MPILOOP)=0
. K CMOR
; If the job has completed status it should restart at the top
I $P($G(^RGSITE(991.8,1,"COMP")),U,4)="C" S $P(^("COMP"),U)=""
; Start the job
S ^XTMP("RGVCCMR","@@@@","DFNCOUNT")=0 ; set for counter in CALC^RGVCCMR2
D NOW^%DTC S Y=X X ^DD("DD") S DTNOW=Y ; get current date and time
S $P(^RGSITE(991.8,1,"COMP"),U,2)=% ; timestamp the job
S $P(^RGSITE(991.8,1,"COMP"),U,4)="R" ; mark the status as running
S $P(^RGSITE(991.8,1,"COMP"),U,6)="N" ; reset the flag
N RGDFN,CALDT,NODE
F S SITE=$O(^DPT("ACMOR",SITE)) Q:SITE="" D ; Get the site CMOR on file
. Q:MPISTOP=1 ; Trouble occured, user wanted to stop
. I +SITE=+$$SITE^VASITE() Q ; Don't process your own
. D HDR ; Create batch for each site
. F S MPILOOP=$O(^DPT("ACMOR",+SITE,MPILOOP)) Q:MPILOOP="" D Q:MPISTOP=1 ; Start with DFN and go
. . S DFN=+MPILOOP Q:DFN<0
. . S NODE=$$MPINODE^MPIFAPI(DFN) Q:+NODE<1 ; Was not CIRN'ed
. . I $G(^DPT(DFN,.35)),$P($G(^DPT(DFN,.35)),"^")'="" Q ; Death patient
. . I $P(NODE,"^")="" D LOG Q ; Log exception if no ICN
. . S CALDT=$P(NODE,"^",7) ; current calc date
. . I CALDT="" S CALDT=0
. . S X="T-90" D ^%DT
. . I CALDT<Y S RGDFN=DFN D CALC^RGVCCMR2 ; score is older than 90 days
. . S $P(^RGSITE(991.8,1,"COMP"),U)=+DFN ; mark that patient as done
. . D INDV
. . I MSGCOUNT>99 D SEND D HDR ; send out if over 100 messages
. . I $P($G(^RGSITE(991.8,1,"COMP")),U,6)="Y" S MPISTOP=1 D SEND Q
. I $O(^TMP("HLS",$J,0)) D SEND ;**3
;
; if user asked to stop set flag = yes and status to MS
; if naturally stop set status to SN
I MPISTOP=1 S $P(^RGSITE(991.8,1,"COMP"),U,6)="Y",$P(^("COMP"),U,4)="MS"
E S $P(^RGSITE(991.8,1,"COMP"),U,4)="C"
D NOW^%DTC S $P(^RGSITE(991.8,1,"COMP"),U,3)=% ; timestamp when it stop
D CLEAN
D STOP^RGHLLOG()
Q
;
HDR ; Create HL7 batch HEADER message to each of the CMOR site
K ^TMP("HLS",$J)
D INIT^HLFNC2("MPIF CMOR COMPARISON SERVER",.HL)
I $D(HL)=1 D EXC^RGHLLOG(220,"Error Returned in INIT^HLFNC2") K HL S MPISTOP=1 Q
D CREATE^HLTF(.HLMID,.MTIEN,.HLDT,.HLDT1)
I $D(MTIEN)="" D EXC^RGHLLOG(220,"Error Returned in CREATE^HLTF") K HLMID,HLDT,HLDT1 S MPISTOP=1 Q
S LINCOUNT=0 ; Set line counter
S MSGCOUNT=1 ; Set counter for 100 message per batch
Q
;
INDV ; Create individual message of the HL7 ADT-A31 batch message
; EVN segment = event, date, CMOR score, requestor name
; PID segment = standard call
; NTE segment = Reason CMOR COMPARISON, site requested
D INIT^HLFNC2("MPIF CMOR COMPARISON SERVER",.HL) ; Because HL7 did not know
S HL("SAF")=$P($$SITE^VASITE,"^",3) ; the facility # when dynamic
; address of batch. This needs
; to be set. Until HL7 fixs it
S MPIID=HLMID_"-"_MSGCOUNT
D MSH^HLFNC2(.HL,MPIID,.MPI)
N NODE
S LINCOUNT=LINCOUNT+1
S ^TMP("HLS",$J,LINCOUNT)=MPI
S LINCOUNT=LINCOUNT+1
S NODE=$$MPINODE^MPIFAPI(DFN)
Q:+NODE<1
S ^TMP("HLS",$J,LINCOUNT)="EVN"_HL("FS")_"A31"_HL("FS")_$P(NODE,"^",7)_HL("FS")_$P(NODE,U,6)_HL("FS")_MPINAME
S LINCOUNT=LINCOUNT+1
S ^TMP("HLS",$J,LINCOUNT)=$$EN^VAFCPID(DFN,"2,3,5")
S LINCOUNT=LINCOUNT+1
;this is the request to the site for a comparison
S ^TMP("HLS",$J,LINCOUNT)="NTE"_HL("FS")_"COMPARISON"_HL("FS")_$P($$SITE^VASITE(),U,3)
S MSGCOUNT=MSGCOUNT+1
Q
;
SEND ; Send out the batch message
N RESLT
D GENERATE^HLMA("MPIF CMOR COMPARISON SERVER","GB",1,.RESLT,MTIEN)
I $P(RESLT,U,2)'="" D EXC^RGHLLOG(220,"Error Returned in GENERATE^HLMA "_$P(RESLT,U,2)) S MPISTOP=1
Q
;
LOGIC ; This is where the dynamic address located.
; ** Routing logic field in Protocol file is being used
; instead of GET^HLSUB.
; For now, I have to hard set the receiving logical link, intercept
; the message before it send out, figure out the receiving Logical
; link from the MSH segment and let the Routing logic create the
; HLL("LINKS") array.
N RESLT
K RGL,RESLT
D LINK^HLUTIL3(SITE,.RGL) ; get the logical link to that institution
S INSTITU=$O(RGL(0))
I INSTITU<1 Q ; if there is no logical link
I $E($G(RGL(INSTITU)),1,2)'="VA" D
.D START^RGHLLOG()
.D EXC^RGHLLOG(224,"Can't send CMOR Comparison message to site, due to non-CIRN logical link for site "_INSTITU)
.D STOP^RGHLLOG()
.S RESLT=1
Q:$D(RESLT)
S HLL("LINKS",1)="MPIF CMOR COMPARISON CLIENT"_HL("FS")_RGL(INSTITU)
K INSTITU,RGL
Q
;
CLEAN ; Clean up the partition
K %,X,Y,MPISTOP,MPINAME,DFN,MPIID
K ^XTMP("HLS",$J)
Q
;
LOG ; Log exception for non ICN but CMOR belong to someone else
N NAME,SSN,RGLOG,TEXT
S XMCHAN=1,NAME=$P(^DPT(DFN,0),"^",1),SSN=$P(^(0),"^",9)
S TEXT="This patient "_NAME_" ssn# "_SSN_" is missing the ICN. Log a NOIS regarding this missing ICN."
D EXC^RGHLLOG(219,TEXT,DFN)
K XMCHAN
Q
;
STOP ; Stop/Restart the CMOR Comparison process
I $P($G(^RGSITE(991.8,1,"COMP")),"^",4)'="R" D Q
. S DIR("A")="Do you want to RESTART this CMOR Comparison process"
. S DIR("B")="N",DIR(0)="Y" D ^DIR
. I $G(Y)=1 D TASK
I $P($G(^RGSITE(991.8,1,"COMP")),"^",4)="R" D Q
. W !
. S DIR("A")="Do you want to stop CMOR Comparison process after the current patient"
. S DIR("B")="N",DIR(0)="Y" D ^DIR
. I $G(Y)=1 S $P(^RGSITE(991.8,1,"COMP"),"^",6)="Y"
Q
;
STATUS ; Where is the process right now?
N IEN,NAME,SSN,STATUS,Y
I $P($G(^RGSITE(991.8,1,"COMP")),"^",5)="" W !,"The CMOR Comparison process HAS NEVER been tasked" Q
W !,"The CMOR Comparison process has been tasked with task # ",$P($G(^RGSITE(991.8,1,"COMP")),"^",5),". The"
S STATUS=$P($G(^RGSITE(991.8,1,"COMP")),"^",4)
W !,"process ",$S(STATUS="R":"is currently running",STATUS="MS":"was manually stopped",STATUS="C":"has completed",1:"")
I (STATUS="C")!(STATUS="MS") S Y=$P($G(^RGSITE(991.8,1,"COMP")),"^",3) X ^DD("DD") W " on ",Y
S IEN=$P($G(^RGSITE(991.8,1,"COMP")),"^")
I IEN'="" D
.S NAME=$P($G(^DPT(+IEN,0)),"^"),SSN=$P($G(^(0)),"^",9)
.S CMOR=$P($G(^DPT(+IEN,"MPI")),"^",3)
.S CMOR=$P($$NNT^XUAF4(CMOR),"^")
.W " and the last patient",!,"was ",NAME," ssn # ",SSN," CMOR= ",CMOR
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMPIFQUE3 8226 printed Nov 22, 2024@17:21:32 Page 2
MPIFQUE3 ;SF/TNV-Generate Batch message for comparison of CMOR score ;FEB 27, 1998
+1 ;;1.0; MASTER PATIENT INDEX VISTA ;**1,3**;30 Apr 99
+2 ;
COMP ; Create a batch CMOR request for comparing the CMOR score with the owner
+1 ; of this patient. This will be for ALL CMOR SITES. (NOT ONE SITE)
+2 ;
+3 NEW DIRUT
+4 SET DIR("A")="This process will take a while to complete. Are you sure? "
+5 SET DIR("B")="NO"
SET DIR(0)="YAO"
DO ^DIR
KILL DIR
if $DATA(DIRUT)
QUIT
+6 ; no go
IF Y=0
KILL DIR
QUIT
+7 IF $PIECE($GET(^RGSITE(991.8,1,"COMP")),"^")'=""
SET $PIECE(^("COMP"),"^")=""
TASK ; Task this job to run
+1 SET ZTIO=""
SET ZTRTN="EN^MPIFQUE3"
SET ZTSAVE("DUZ")=""
+2 SET ZTDESC="GENERATE CMOR COMPARISON PROCESS"
+3 DO ^%ZTLOAD
+4 IF $DATA(ZTSK)
WRITE " Task#, ",ZTSK," queued"
SET $PIECE(^RGSITE(991.8,1,"COMP"),U,5)=ZTSK
+5 ;
KILL ; Clean up the partition
+1 KILL DIR,ZTSK,Y,ZTIO,ZTRTN,ZTDESC,ZTSAVE
+2 QUIT
+3 ;
EN ; Entry point for CMOR Batch comparison. This should only be run after
+1 ; the initialization to the MPI has been completed.
+2 NEW U,SITE,NODE,MPI,MTIEN,MPILOOP,DTNOW,MSGCOUNT,LINCOUNT,RGLOG
+3 SET U="^"
SET (MPILOOP,SITE)=""
SET MPISTOP=0
+4 DO START^RGHLLOG()
+5 NEW X,Y,DIC
+6 SET DIC="^VA(200,"
SET DIC(0)="MZO"
SET X="`"_+DUZ
+7 DO ^DIC
+8 IF $GET(Y)<1
SET MPINAME=""
+9 IF $GET(Y)>0
SET MPINAME=$GET(Y(0,0))
+10 ; If the job has manually stopped status it should restart at where
+11 ; it left off
+12 IF $PIECE($GET(^RGSITE(991.8,1,"COMP")),U,4)="MS"
Begin DoDot:1
+13 ; Not logical restart from the top
IF $PIECE($GET(^RGSITE(991.8,1,"COMP")),U)=""
SET $PIECE(^("COMP"),U,4)="C"
QUIT
+14 SET NODE=$$MPINODE^MPIFAPI(+$PIECE(^RGSITE(991.8,1,"COMP"),U))
+15 ; CMOR of the last patient
SET CMOR=$PIECE(NODE,U,3)
+16 ; Back up one level
IF +CMOR>0
SET SITE=$ORDER(^DPT("ACMOR",CMOR),-1)
+17 ; Marked the last patient
IF +CMOR>0
SET MPILOOP=+$PIECE(^RGSITE(991.8,1,"COMP"),U)
+18 IF +CMOR<1
SET (SITE,MPILOOP)=0
+19 KILL CMOR
End DoDot:1
+20 ; If the job has completed status it should restart at the top
+21 IF $PIECE($GET(^RGSITE(991.8,1,"COMP")),U,4)="C"
SET $PIECE(^("COMP"),U)=""
+22 ; Start the job
+23 ; set for counter in CALC^RGVCCMR2
SET ^XTMP("RGVCCMR","@@@@","DFNCOUNT")=0
+24 ; get current date and time
DO NOW^%DTC
SET Y=X
XECUTE ^DD("DD")
SET DTNOW=Y
+25 ; timestamp the job
SET $PIECE(^RGSITE(991.8,1,"COMP"),U,2)=%
+26 ; mark the status as running
SET $PIECE(^RGSITE(991.8,1,"COMP"),U,4)="R"
+27 ; reset the flag
SET $PIECE(^RGSITE(991.8,1,"COMP"),U,6)="N"
+28 NEW RGDFN,CALDT,NODE
+29 ; Get the site CMOR on file
FOR
SET SITE=$ORDER(^DPT("ACMOR",SITE))
if SITE=""
QUIT
Begin DoDot:1
+30 ; Trouble occured, user wanted to stop
if MPISTOP=1
QUIT
+31 ; Don't process your own
IF +SITE=+$$SITE^VASITE()
QUIT
+32 ; Create batch for each site
DO HDR
+33 ; Start with DFN and go
FOR
SET MPILOOP=$ORDER(^DPT("ACMOR",+SITE,MPILOOP))
if MPILOOP=""
QUIT
Begin DoDot:2
+34 SET DFN=+MPILOOP
if DFN<0
QUIT
+35 ; Was not CIRN'ed
SET NODE=$$MPINODE^MPIFAPI(DFN)
if +NODE<1
QUIT
+36 ; Death patient
IF $GET(^DPT(DFN,.35))
IF $PIECE($GET(^DPT(DFN,.35)),"^")'=""
QUIT
+37 ; Log exception if no ICN
IF $PIECE(NODE,"^")=""
DO LOG
QUIT
+38 ; current calc date
SET CALDT=$PIECE(NODE,"^",7)
+39 IF CALDT=""
SET CALDT=0
+40 SET X="T-90"
DO ^%DT
+41 ; score is older than 90 days
IF CALDT<Y
SET RGDFN=DFN
DO CALC^RGVCCMR2
+42 ; mark that patient as done
SET $PIECE(^RGSITE(991.8,1,"COMP"),U)=+DFN
+43 DO INDV
+44 ; send out if over 100 messages
IF MSGCOUNT>99
DO SEND
DO HDR
+45 IF $PIECE($GET(^RGSITE(991.8,1,"COMP")),U,6)="Y"
SET MPISTOP=1
DO SEND
QUIT
End DoDot:2
if MPISTOP=1
QUIT
+46 ;**3
IF $ORDER(^TMP("HLS",$JOB,0))
DO SEND
End DoDot:1
+47 ;
+48 ; if user asked to stop set flag = yes and status to MS
+49 ; if naturally stop set status to SN
+50 IF MPISTOP=1
SET $PIECE(^RGSITE(991.8,1,"COMP"),U,6)="Y"
SET $PIECE(^("COMP"),U,4)="MS"
+51 IF '$TEST
SET $PIECE(^RGSITE(991.8,1,"COMP"),U,4)="C"
+52 ; timestamp when it stop
DO NOW^%DTC
SET $PIECE(^RGSITE(991.8,1,"COMP"),U,3)=%
+53 DO CLEAN
+54 DO STOP^RGHLLOG()
+55 QUIT
+56 ;
HDR ; Create HL7 batch HEADER message to each of the CMOR site
+1 KILL ^TMP("HLS",$JOB)
+2 DO INIT^HLFNC2("MPIF CMOR COMPARISON SERVER",.HL)
+3 IF $DATA(HL)=1
DO EXC^RGHLLOG(220,"Error Returned in INIT^HLFNC2")
KILL HL
SET MPISTOP=1
QUIT
+4 DO CREATE^HLTF(.HLMID,.MTIEN,.HLDT,.HLDT1)
+5 IF $DATA(MTIEN)=""
DO EXC^RGHLLOG(220,"Error Returned in CREATE^HLTF")
KILL HLMID,HLDT,HLDT1
SET MPISTOP=1
QUIT
+6 ; Set line counter
SET LINCOUNT=0
+7 ; Set counter for 100 message per batch
SET MSGCOUNT=1
+8 QUIT
+9 ;
INDV ; Create individual message of the HL7 ADT-A31 batch message
+1 ; EVN segment = event, date, CMOR score, requestor name
+2 ; PID segment = standard call
+3 ; NTE segment = Reason CMOR COMPARISON, site requested
+4 ; Because HL7 did not know
DO INIT^HLFNC2("MPIF CMOR COMPARISON SERVER",.HL)
+5 ; the facility # when dynamic
SET HL("SAF")=$PIECE($$SITE^VASITE,"^",3)
+6 ; address of batch. This needs
+7 ; to be set. Until HL7 fixs it
+8 SET MPIID=HLMID_"-"_MSGCOUNT
+9 DO MSH^HLFNC2(.HL,MPIID,.MPI)
+10 NEW NODE
+11 SET LINCOUNT=LINCOUNT+1
+12 SET ^TMP("HLS",$JOB,LINCOUNT)=MPI
+13 SET LINCOUNT=LINCOUNT+1
+14 SET NODE=$$MPINODE^MPIFAPI(DFN)
+15 if +NODE<1
QUIT
+16 SET ^TMP("HLS",$JOB,LINCOUNT)="EVN"_HL("FS")_"A31"_HL("FS")_$PIECE(NODE,"^",7)_HL("FS")_$PIECE(NODE,U,6)_HL("FS")_MPINAME
+17 SET LINCOUNT=LINCOUNT+1
+18 SET ^TMP("HLS",$JOB,LINCOUNT)=$$EN^VAFCPID(DFN,"2,3,5")
+19 SET LINCOUNT=LINCOUNT+1
+20 ;this is the request to the site for a comparison
+21 SET ^TMP("HLS",$JOB,LINCOUNT)="NTE"_HL("FS")_"COMPARISON"_HL("FS")_$PIECE($$SITE^VASITE(),U,3)
+22 SET MSGCOUNT=MSGCOUNT+1
+23 QUIT
+24 ;
SEND ; Send out the batch message
+1 NEW RESLT
+2 DO GENERATE^HLMA("MPIF CMOR COMPARISON SERVER","GB",1,.RESLT,MTIEN)
+3 IF $PIECE(RESLT,U,2)'=""
DO EXC^RGHLLOG(220,"Error Returned in GENERATE^HLMA "_$PIECE(RESLT,U,2))
SET MPISTOP=1
+4 QUIT
+5 ;
LOGIC ; This is where the dynamic address located.
+1 ; ** Routing logic field in Protocol file is being used
+2 ; instead of GET^HLSUB.
+3 ; For now, I have to hard set the receiving logical link, intercept
+4 ; the message before it send out, figure out the receiving Logical
+5 ; link from the MSH segment and let the Routing logic create the
+6 ; HLL("LINKS") array.
+7 NEW RESLT
+8 KILL RGL,RESLT
+9 ; get the logical link to that institution
DO LINK^HLUTIL3(SITE,.RGL)
+10 SET INSTITU=$ORDER(RGL(0))
+11 ; if there is no logical link
IF INSTITU<1
QUIT
+12 IF $EXTRACT($GET(RGL(INSTITU)),1,2)'="VA"
Begin DoDot:1
+13 DO START^RGHLLOG()
+14 DO EXC^RGHLLOG(224,"Can't send CMOR Comparison message to site, due to non-CIRN logical link for site "_INSTITU)
+15 DO STOP^RGHLLOG()
+16 SET RESLT=1
End DoDot:1
+17 if $DATA(RESLT)
QUIT
+18 SET HLL("LINKS",1)="MPIF CMOR COMPARISON CLIENT"_HL("FS")_RGL(INSTITU)
+19 KILL INSTITU,RGL
+20 QUIT
+21 ;
CLEAN ; Clean up the partition
+1 KILL %,X,Y,MPISTOP,MPINAME,DFN,MPIID
+2 KILL ^XTMP("HLS",$JOB)
+3 QUIT
+4 ;
LOG ; Log exception for non ICN but CMOR belong to someone else
+1 NEW NAME,SSN,RGLOG,TEXT
+2 SET XMCHAN=1
SET NAME=$PIECE(^DPT(DFN,0),"^",1)
SET SSN=$PIECE(^(0),"^",9)
+3 SET TEXT="This patient "_NAME_" ssn# "_SSN_" is missing the ICN. Log a NOIS regarding this missing ICN."
+4 DO EXC^RGHLLOG(219,TEXT,DFN)
+5 KILL XMCHAN
+6 QUIT
+7 ;
STOP ; Stop/Restart the CMOR Comparison process
+1 IF $PIECE($GET(^RGSITE(991.8,1,"COMP")),"^",4)'="R"
Begin DoDot:1
+2 SET DIR("A")="Do you want to RESTART this CMOR Comparison process"
+3 SET DIR("B")="N"
SET DIR(0)="Y"
DO ^DIR
+4 IF $GET(Y)=1
DO TASK
End DoDot:1
QUIT
+5 IF $PIECE($GET(^RGSITE(991.8,1,"COMP")),"^",4)="R"
Begin DoDot:1
+6 WRITE !
+7 SET DIR("A")="Do you want to stop CMOR Comparison process after the current patient"
+8 SET DIR("B")="N"
SET DIR(0)="Y"
DO ^DIR
+9 IF $GET(Y)=1
SET $PIECE(^RGSITE(991.8,1,"COMP"),"^",6)="Y"
End DoDot:1
QUIT
+10 QUIT
+11 ;
STATUS ; Where is the process right now?
+1 NEW IEN,NAME,SSN,STATUS,Y
+2 IF $PIECE($GET(^RGSITE(991.8,1,"COMP")),"^",5)=""
WRITE !,"The CMOR Comparison process HAS NEVER been tasked"
QUIT
+3 WRITE !,"The CMOR Comparison process has been tasked with task # ",$PIECE($GET(^RGSITE(991.8,1,"COMP")),"^",5),". The"
+4 SET STATUS=$PIECE($GET(^RGSITE(991.8,1,"COMP")),"^",4)
+5 WRITE !,"process ",$SELECT(STATUS="R":"is currently running",STATUS="MS":"was manually stopped",STATUS="C":"has completed",1:"")
+6 IF (STATUS="C")!(STATUS="MS")
SET Y=$PIECE($GET(^RGSITE(991.8,1,"COMP")),"^",3)
XECUTE ^DD("DD")
WRITE " on ",Y
+7 SET IEN=$PIECE($GET(^RGSITE(991.8,1,"COMP")),"^")
+8 IF IEN'=""
Begin DoDot:1
+9 SET NAME=$PIECE($GET(^DPT(+IEN,0)),"^")
SET SSN=$PIECE($GET(^(0)),"^",9)
+10 SET CMOR=$PIECE($GET(^DPT(+IEN,"MPI")),"^",3)
+11 SET CMOR=$PIECE($$NNT^XUAF4(CMOR),"^")
+12 WRITE " and the last patient",!,"was ",NAME," ssn # ",SSN," CMOR= ",CMOR
End DoDot:1
+13 QUIT
+14 ;