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

DG53358M.m

Go to the documentation of this file.
  1. DG53358M ;ALB/AEG - DG*5.3*358 POST INSTALL (CONT) ;3-5-2001
  1. ;;5.3;Registration;**358,1015**;3-5-2001;Build 21
  1. ;
  1. MBDST ; Called after Phase II processing completes to send user a message
  1. ; as to the details of mt status inconsistencies.
  1. I '$D(^TMP($J,"PAT")) D
  1. .S ^UTILITY($J,1)="No inconsistencies were noted between the CURRENT MEANS TEST"
  1. .S ^UTILITY($J,2)="STATUS field (#.14) of the PATIENT file (#2) and the STATUS"
  1. .S ^UTILITY($J,3)="field (#.03) of the ANNUAL MEANS TEST file (#408.31)."
  1. I $D(^TMP($J,"PAT")) D
  1. .S ^UTILITY($J,1)="The following inconsistencies were found between the CURRENT MEANS"
  1. .S ^UTILITY($J,2)="TEST STATUS field (#.14) of the PATIENT file (#2) and the"
  1. .S ^UTILITY($J,3)="STATUS field (#.03) of the ANNUAL MEANS TEST file (#408.31)."
  1. .S ^UTILITY($J,4)="The inconsistencies have been corrected."
  1. .S ^UTILITY($J,5)=" "
  1. .S ^UTILITY($J,6)=$$BLDSTR("PATIENT NAME","SSN","CATEGORY (PAT)","CATEGORY (MEANS)")
  1. .S ^UTILITY($J,7)=$$BLDSTR("------------","---","--------------","----------------")
  1. .N NM,IEN,I,DFN,DPTS,LST4,P1,P2,P3,P4,NM1
  1. .S (NM,IEN)=""
  1. .F I=8:1 S NM=$O(^TMP($J,"PAT",NM)) Q:NM="" S IEN="" F S IEN=$O(^TMP($J,"PAT",NM,IEN)) Q:IEN="" D
  1. ..S DFN=$P($G(^TMP($J,"PAT",NM,IEN)),U,1),DPTS=$P($G(^TMP($J,"PAT",NM,IEN)),U,2)
  1. ..S DPTS=$S(DPTS'="":$P($G(^DG(408.32,DPTS,0)),U,1),DPTS="":" ",1:" ")
  1. ..S DGMTS=$P($G(^TMP($J,"PAT",NM,IEN)),U,4),DGMTS=$S(DGMTS'="":$P($G(^DG(408.32,DGMTS,0)),U,1),DGMTS="":" ",1:" ")
  1. ..S NM1=$E($G(NM),1,15) I NM1["^" S NM1=$P($G(NM1),U,1)
  1. ..S LST4=$E($P($G(^DPT(DFN,0)),U,9),6,9)
  1. ..S P1=NM1,P2=LST4,P3=DPTS,P4=DGMTS
  1. ..S ^UTILITY($J,I)=$$BLDSTR(P1,P2,P3,P4)
  1. ..Q
  1. .Q
  1. N DIFROM,%
  1. N XMDUZ,XMSUB,XMTEXT,XMY,Y
  1. S XMDUZ="REGISTRATION PACKAGE",XMY(DUZ)="",XMY(.5)=""
  1. S XMTEXT="^UTILITY($J,"
  1. D NOW^%DTC S Y=% D DD^%DT
  1. S XMSUB="DG*5.3*358 POST INSTALL - Phase II report "_Y
  1. D ^XMD
  1. D BMES^XPDUTL(" MAIL MESSAGE < #"_XMZ_" > sent.")
  1. K ^UTILITY($J),^TMP($J,"PAT")
  1. Q
  1. BADEN ; Process Phase III portion of cleanup report
  1. K ^UTILITY($J)
  1. I '$D(^TMP($J,"BADEN")) D
  1. .S ^UTILITY($J,1)="No means test records found where the CURRENT MEANS TEST STATUS field (#.14)"
  1. .S ^UTILITY($J,2)="of the PATIENT file (#2) was populated without a corresponding"
  1. .S ^UTILITY($J,3)="Means Test on file."
  1. I $D(^TMP($J,"BADEN")) D
  1. .S ^UTILITY($J,1)="The following patients had the CURRENT MEANS TEST STATUS field (#.14)"
  1. .S ^UTILITY($J,2)="of the PATIENT file (#2) populated; however, there was no"
  1. .S ^UTILITY($J,3)="corresponding Means Test on File. The PATIENT file has been"
  1. .S ^UTILITY($J,4)="updated."
  1. .S ^UTILITY($J,5)=" "
  1. .S ^UTILITY($J,6)=$$BLDSTR("PATIENT NAME","SSN","CURRENT MT STATUS","")
  1. .S ^UTILITY($J,7)=$$BLDSTR("------------","---","-----------------","")
  1. .N DGDFN,DPTSTAT,NM,NM1,LST4,DPTS,P1,P2,P3,P4
  1. .S (DGDFN,DPTSTAT)=""
  1. .F I=8:1 S DGDFN=$O(^TMP($J,"BADEN",DGDFN)) Q:'+DGDFN S DPTSTAT="" F S DPTSTAT=$O(^TMP($J,"BADEN",DGDFN,DPTSTAT)) Q:DPTSTAT="" D
  1. ..S NM=$P($G(^DPT(DGDFN,0)),U),NM1=$E($G(NM),1,15)
  1. ..S LST4=$E($P($G(^DPT(DGDFN,0)),U,9),6,9)
  1. ..S DPTS=$P($G(^DG(408.32,DPTSTAT,0)),U,1),DPTS=$E($G(DPTS),1,15)
  1. ..S P1=NM1,P2=LST4,P3=DPTS,P4=""
  1. ..S ^UTILITY($J,I)=$$BLDSTR(P1,P2,P3,P4)
  1. ..Q
  1. .Q
  1. N DIFROM,%,Y
  1. N XMDUZ,XMSUB,XMTEXT,XMY,XMZ
  1. S XMDUZ="REGISTRATION PACKAGE",XMY(DUZ)="",XMY(.5)=""
  1. D NOW^%DTC S Y=% D DD^%DT
  1. S XMSUB="DG*5.3*358 POST INSTALL - Phase III report "_Y
  1. S XMTEXT="^UTILITY($J,"
  1. D ^XMD
  1. D BMES^XPDUTL(" MAIL MESSAGE < #"_XMZ_" > sent.")
  1. K ^TMP($J,"BADEN"),^UTILITY($J)
  1. Q
  1. DOAN ; Phase IV Process Reporting
  1. ;
  1. ; This reporting mechanism is broken down into 2 distinct parts.
  1. ;
  1. ; 1. An email will be generated on those patients that were in a NLR
  1. ; status and the date of the test was > than the date of death. The
  1. ; tests meeting those criteria were treated as invalid and purged.
  1. ;
  1. ; 2. An email will be generated for those test in an NLR status on
  1. ; expired patients where the date of the test was on or before the
  1. ; date of death. These test statii were recalculated to what they
  1. ; were prior to date of death.
  1. ;
  1. ; PART I
  1. I '$D(^TMP($J,"NLR-DEL")) D
  1. .S ^UTILITY($J,1)="No means test records were found in a status of 'NO LONGER REQUIRED'"
  1. .S ^UTILITY($J,2)="where the date of the test is greater than the date of death."
  1. I $D(^TMP($J,"NLR-DEL")) D
  1. .S ^UTILITY($J,1)="The following means tests were found in a status of 'NO LONGER REQUIRED'"
  1. .S ^UTILITY($J,2)="and the test date was entered after the date of death. These tests"
  1. .S ^UTILITY($J,3)="are considered to be invalid and have been purged."
  1. .S ^UTILITY($J,4)=" "
  1. .S ^UTILITY($J,5)=$$BLDSTR("PATIENT NAME","SSN","DATE OF DEATH","DATE OF TEST")
  1. .S ^UTILITY($J,6)=$$BLDSTR("------------","---","-------------","------------")
  1. .N DGDFN,DGMTI,DGDOD,DGMTS,DOD,DOT,DOT1,DGDFN1
  1. .S (DGDFN,DGMTI,DGDFN1)=""
  1. .F I=8:1 S DGDFN1=$O(^TMP($J,"NLR-DEL",DGDFN1)) Q:'+DGDFN1 D
  1. ..S DGDFN=$P($G(DGDFN1),"~~",1),DGMTI=$P($G(DGDFN1),"~~",2)
  1. ..S NM=$P($G(^DPT(DGDFN,0)),U,1),NM1=$E($G(NM),1,15)
  1. ..S LST4=$E($P($G(^DPT(DGDFN,0)),U,9),6,9)
  1. ..S DOT=$P($G(^TMP($J,"NLR-DEL",DGDFN1)),U,1)
  1. ..S Y=DOT X ^DD("DD") S DOT1=Y
  1. ..S DOD=$P($G(^DPT(DGDFN,.35)),U),Y=$P($G(DOD),".",1)
  1. ..X ^DD("DD") S DGDOD=Y
  1. ..S P1=NM1,P2=LST4,P3=DGDOD,P4=DOT1
  1. ..S ^UTILITY($J,I)=$$BLDSTR(P1,P2,P3,P4)
  1. ..Q
  1. .Q
  1. N DIFROM,%,Y
  1. N XMDUZ,XMSUB,XMTEXT,XMY,XMZ
  1. S XMDUZ="REGISTRATION PACKAGE",XMY(DUZ)="",XMY(.5)=""
  1. S XMTEXT="^UTILITY($J,"
  1. N %,Y
  1. D NOW^%DTC S Y=% D DD^%DT
  1. S XMSUB="DG*5.3*358 POST INSTALL - PHASE IV (PART 1) "_Y
  1. D ^XMD
  1. D MES^XPDUTL(" MAIL MESSAGE < #"_XMZ_" > sent.")
  1. K ^UTILITY($J),^TMP($J,"NLR-DEL")
  1. ;
  1. P2 ; PART 2
  1. I '$D(^TMP($J,"RECALC")) D
  1. .S ^UTILITY($J,1)="No means test records found where the status is 'NO LONGER REQUIRED'"
  1. .S ^UTILITY($J,2)="and the test date is on or before the date of death."
  1. I $D(^TMP($J,"RECALC")) D
  1. .N OLDSTAT,NEWSTAT,DGDFN,NEWCAT,OLDCAT,PID,TDATE,TDATE1,DGDFN1
  1. .S (OLDSTAT,NEWSTAT,DGDFN,DGDFN1)=""
  1. .S ^UTILITY($J,1)="The following patients have expired and had a means test"
  1. .S ^UTILITY($J,2)="on file in a status of 'NO LONGER REQUIRED'. The test"
  1. .S ^UTILITY($J,3)="dates are on or prior to the date of death; therefore, the status"
  1. .S ^UTILITY($J,4)="has been recalculated to reflect the status at the time of"
  1. .S ^UTILITY($J,5)="death."
  1. .S ^UTILITY($J,6)=" "
  1. .S ^UTILITY($J,7)=$$BLDSTR("PATIENT SSN","TEST DATE","OLD STATUS","NEW STATUS")
  1. .S ^UTILITY($J,8)=$$BLDSTR("----------","---------","----------","----------")
  1. .F I=9:1 S DGDFN1=$O(^TMP($J,"RECALC",DGDFN1)) Q:'+DGDFN1 D
  1. ..S DGDFN=$P($G(DGDFN1),"~~",1),TDATE=$P($G(DGDFN1),"~~",2)
  1. ..S PID=$E($P($G(^DPT(DGDFN,0)),U,9),1,3)_"-"_$E($P($G(^DPT(DGDFN,0)),U,9),4,5)_"-"_$E($P($G(^DPT(DGDFN,0)),U,9),6,9)
  1. ..S Y=TDATE X ^DD("DD") S TDATE1=Y
  1. ..S OLDCAT=$P($G(^TMP($J,"RECALC",DGDFN1)),U,1)
  1. ..S NEWCAT=$P($G(^TMP($J,"RECALC",DGDFN1)),U,2)
  1. ..S P1=PID,P2=TDATE1,P3=OLDCAT,P4=NEWCAT
  1. ..S ^UTILITY($J,I)=$$BLDSTR(P1,P2,P3,P4)
  1. ..Q
  1. .Q
  1. N DIFROM,%,Y
  1. N XMDUZ,XMSUB,XMTEXT,XMY,XMZ
  1. S XMDUZ="REGISTRATION PACKAGE",XMY(DUZ)="",XMY(.5)=""
  1. S XMTEXT="^UTILITY($J,"
  1. D NOW^%DTC S Y=% D DD^%DT
  1. S XMSUB="DG*5.3*358 POST INSTALL - Phase IV (Part II) "_Y
  1. D ^XMD
  1. D MES^XPDUTL(" MAIL MESSAGE < #"_XMZ_" > sent.")
  1. K ^UTILITY($J),^TMP($J,"RECALC")
  1. Q
  1. BLDSTR(P1,P2,P3,P4) ; Build a string from input
  1. N S1,S2,S3,S4
  1. S S1=$E(P1,1,15) I $L(S1)'>14 D
  1. .S S1=S1_$J("",(15-$L(S1)))
  1. S S2=P2
  1. S S3=$E(P3,1,15) I $L(S3)'>14 D
  1. .S S3=S3_$J("",(15-$L(S3)))
  1. S S4=$E(P4,1,15) I $L(S4)'>14 D
  1. .S S4=S4_$J("",(15-$L(S4)))
  1. Q S1_$J("",5)_S2_$J("",5)_S3_$J("",5)_S4