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

DG944PST.m

Go to the documentation of this file.
  1. DG944PST ;BIR/CML-PATCH DG*5.3*944 POST INSTALLATION ROUTINE ;5/1/17
  1. ;;5.3;Registration;**944**;Aug 13, 1993;Build 2
  1. ;
  1. ; - Story 500994 (cml)
  1. ; This post-init will loop thru the Patient file (^DPT(DFN)) and check the zero node looking for any names
  1. ; that contain lowercase letters.
  1. ; Any that are found will be updated to all uppercase and saved into the .01 field of the PATIENT (#2) file.
  1. ; When the job is complete it will send an email to:
  1. ; - (locally) POSTMASTER and the person who installed the patch (DUZ)
  1. ; - (MPI Outlook) Christine.Chesney@domain.ext, Link.Christine@domain.ext and John.Williams30ec0c@domain.ext.
  1. ;
  1. ; - Story 557843 (cml)
  1. ; This post-init will loop thru the Patient file (^DPT(DFN)) and check for any records that have an ICN and
  1. ; an ICN CHECKSUM but do NOT have the FULL ICN field populated.
  1. ; Any that are found will have the FULL ICN field updated to be ICN_"V"_CHECKSUM.
  1. ; When the job is complete it will send an email to:
  1. ; - (locally) POSTMASTER and the person who installed the patch (DUZ)
  1. ; - (MPI Outlook) Christine.Chesney@domain.ext, Link.Christine@domain.ext and John.Williams30ec0c@domain.ext.
  1. ;
  1. ; - Story 557808 (jfw)
  1. ; Add 'Department of Defense' entry to the SOURCE OF NOTIFICATION File (#47.76).
  1. ;
  1. ; - Story 557909 (jfw)
  1. ; Enable auditing on the PLACE OF BIRTH CITY (.092)/STATE (.093) fields
  1. ; in the PATIENT file (#2).
  1. ;
  1. ; - Stories 557815 and 557804 (elz)
  1. ; Populate the new Source of Notification Business Rules (#47.761) file with initial
  1. ; business rules for both Source of Notification and Document Types allowed
  1. ;
  1. ;
  1. POST ;queue off post-init to identify and cleanup any names with lowercase characters or missing FULL ICN
  1. N DGI,DGFLDS
  1. ; Modifying the following field(s) in the PATIENT File #2:
  1. ; - .092 PLACE OF BIRTH [CITY]
  1. ; - .093 PLACE OF BIRTH [STATE]
  1. S DGFLDS=".092,.093"
  1. D BMES^XPDUTL("Post-Install:"),MES^XPDUTL("")
  1. ;Turning on AUDITING for PATIENT File field(s)
  1. F DGI=1:1:$L(DGFLDS,",") D AUDIT(2,$P(DGFLDS,",",DGI),"PATIENT")
  1. D UPDTFLE ;Add new Source of Notification
  1. D BRFILE ;Add the DOD Source/Document type business rules into the new file
  1. D QUE ;Task off cleanup of lowercase letters in names or missing FULL ICN
  1. D BMES^XPDUTL("Post-Install: Finished")
  1. Q
  1. ;
  1. AUDIT(DGFILE,DGFLD,DGFNAME) ;Turn on Auditing for Field in File
  1. D TURNON^DIAUTL(DGFILE,DGFLD) ;DBIA #4397 Supported
  1. D MES^XPDUTL(" Enabled AUDIT on file #"_DGFILE_" ("_DGFNAME_"), field #"_DGFLD)
  1. Q
  1. ;
  1. UPDTFLE ;Create a new entry in SOURCE OF NOTIFICATIONS file (#47.76)
  1. N DGFDA,DGERRMSG
  1. D BMES^XPDUTL(" Add A New Source Of Notification (Department of Defense) to File #47.76.")
  1. I $$FIND1^DIC(47.76,"","X","Department of Defense") D MES^XPDUTL(" *** 'Department of Defense' Source of Notification entry already exists!") Q
  1. S DGFDA(47.76,"+1,",.01)="Department of Defense"
  1. S DGFDA(47.76,"+1,",1)=14
  1. S DGFDA(47.76,"+1,",2)=1
  1. D UPDATE^DIE("","DGFDA","","DGERRMSG")
  1. I $D(DGERRMSG) D MES^XPDUTL(" >>> ERROR! 'Department of Defense' Source of Notification NOT added!"),MES^XPDUTL(" [#"_DGERRMSG("DIERR",1)_": "_DGERRMSG("DIERR",1,"TEXT",1)_"]") Q
  1. D MES^XPDUTL(" *** 'Department of Defense' Source of Notification successfully added to")
  1. D MES^XPDUTL(" File #47.76!")
  1. Q
  1. ;
  1. QUE ; Queue off the cleanup of names with lowercase letters and missing FULL ICNs
  1. D BMES^XPDUTL(" Queuing job to clean up lowercase names and missing FULL ICNs.")
  1. N ZTIO,ZTSK,ZTRTN,ZTDESC,ZTSAVE,ZTDTH,Y
  1. S ZTIO="",ZTRTN="DFNLOOP^DG944PST",ZTDTH=$H
  1. S ZTDESC="DG*5.3*944 post-install cleanup of patient names with lowercase letters and missing FULL ICNs"
  1. D ^%ZTLOAD
  1. I '$G(ZTSK) D MES^XPDUTL(" **** Queuing job failed!!!") Q
  1. D MES^XPDUTL(" Job number #"_ZTSK_" was queued.")
  1. Q
  1. ;
  1. DFNLOOP ; entry point for queued job to loop on Patient file
  1. N DFNCNT,DFN,LCCNT,FICNT,NM,START,DONE,CKSUM,MPINODE,FULLICN,ICN,QUIT
  1. S START=$$FMTE^XLFDT($$NOW^XLFDT)
  1. S (DFNCNT,DFN,LCCNT,FICNT)=0
  1. F S DFN=$O(^DPT(DFN)) Q:'DFN S DFNCNT=DFNCNT+1 D
  1. .I $D(^DPT(DFN,-9)) Q
  1. .S NM=$P($G(^DPT(DFN,0)),"^") I NM]"" I NM'["MERGING" I NM'?.UPN S LCCNT=LCCNT+1 D UPDNM
  1. .D FULLCHK
  1. S DONE=$$FMTE^XLFDT($$NOW^XLFDT)
  1. ;
  1. EMAILS ; Send email to person who ran the INIT, letting them know results
  1. N XMDUZ,XMTEXT,XMSUB,XMY,XMZ,XMDUN,X,R
  1. S R(1)="Cleanup of patient names containing lowercase letters and missing FULL ICNs:"
  1. S R(2)=" "
  1. S R(3)="Process started: "_START
  1. S R(4)="Process completed: "_DONE
  1. S R(5)="Total number of patient names converted to uppercase: "_LCCNT
  1. S R(6)="Total number of records updated with FULL ICN: "_FICNT
  1. S R(7)=" ",R(8)="You can now delete the post-init routine ^DG944PST."
  1. S XMTEXT="R(",XMSUB="Results from running patch DG*5.3*944"
  1. S XMDUZ=.5
  1. S XMY(DUZ)=""
  1. D ^XMD
  1. ;
  1. ; Send message to MPI developers on Outlook
  1. ; IA#4440 supported call to check for test or production account
  1. Q:$$PROD^XUPROD()=0 ;not a production account. Don't send email to MPI dev
  1. ;
  1. N DGSNAME,DGSITE,XMDUZ,XMTEXT,XMSUB,XMY,XMZ,XMDUN,R
  1. S X=$$SITE^VASITE()
  1. S DGSNAME=$P(X,"^",2),DGSITE=$P(X,"^",3)
  1. S R(1)="Post-Init routine ^DG944PST run at station: "_DGSITE_" - "_DGSNAME
  1. S R(2)=" "
  1. S R(3)="Process Started: "_START_" - Completed: "_DONE
  1. S R(4)=" "
  1. S R(5)="Total Patient file records processed: "_DFNCNT
  1. S R(6)=" "
  1. S R(7)="Total names converted to uppercase: "_LCCNT
  1. S R(8)=" "
  1. S R(9)="Total number of records updated with FULL ICN: "_FICNT
  1. S XMTEXT="R(",XMSUB="Results from running patch DG*5.3*944 at station: "_DGSITE
  1. S XMDUZ=DUZ
  1. S XMY("Christine.Chesney@domain.ext")=""
  1. S XMY("John.Williams30ec0c@domain.ext")=""
  1. S XMY("Christine.Link@domain.ext")=""
  1. D ^XMD
  1. Q
  1. ;
  1. UPDNM ; convert lowercase letters to uppercase letters and edit .01 in Patient file
  1. N NEWNM,CHK
  1. S CHK=NM,NEWNM=$TR(CHK,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
  1. L +^DPT(DFN):10 I '$T Q
  1. S DIE="^DPT(",DA=DFN,DR=".01///^S X=NEWNM"
  1. D ^DIE K DIE,DA,DR
  1. L -^DPT(DFN)
  1. Q
  1. ;
  1. FULLCHK ; check and populate FULL ICN field if needed
  1. Q:'$D(^DPT(DFN,"MPI"))
  1. S MPINODE=$G(^DPT(DFN,"MPI"))
  1. S ICN=$P(MPINODE,"^"),CKSUM=$P(MPINODE,"^",2),FULLICN=$P(MPINODE,"^",10)
  1. Q:FULLICN]""
  1. I ICN,CKSUM D
  1. . S FULLICN=ICN_"V"_CKSUM
  1. . S DIE="^DPT(",DA=DFN,DR="991.1///^S X=FULLICN" D ^DIE S FICNT=FICNT+1
  1. Q
  1. ;
  1. BRFILE ; populate business rules into new file. To ensure this is only done once, check the
  1. ; file to make sure there are no entries in it already just in case the patch is re-installed.
  1. ; This way if there are changes broadcast from the MPI, they are not overwritten.
  1. D MES^XPDUTL("Filed Business Rules for Source of Notifications to Document Types.")
  1. N DGCOUNT,DGLINE,DGDATA,DGTIEN
  1. S DGCOUNT=0
  1. I $P($G(^DG(47.761,0)),"^",4) D Q
  1. . D MES^XPDUTL("SOURCE OF NOTIFICATION BUSINESS RULES (#47.761) file already populated.")
  1. F DGLINE=2:1 S DGDATA=$P($T(BRDATA+DGLINE),";",3) Q:DGDATA="" D
  1. . N DGFDA,DGTYPE,DGIEN,DGROOT
  1. . S DGTYPE=$O(^DG(47.75,"C",$P(DGDATA,"^",2),0))
  1. . I 'DGTYPE D MES^XPDUTL("Document Type "_$P(DGDATA,"^",2)_" NOT FOUND!!") Q
  1. . S DGIEN=+DGDATA
  1. . I '$D(^DG(47.761,DGIEN)) D
  1. .. N DGFDA
  1. .. S DGFDA(1,47.761,"+1,",.01)=DGIEN
  1. .. S DGFDA(1,47.761,"+1,",.02)=1
  1. .. S DGFDA(1,47.761,"+1,",.03)=DT
  1. .. S DGIEN(1)=DGIEN
  1. .. D UPDATE^DIE("","DGFDA(1)","DGIEN","DGROOT")
  1. . I $D(DGROOT) D MES^XPDUTL("ERROR filing Source "_DGDATA_$G(DGROOT("DIERR",1,"TEXT",1))) Q
  1. . S DGFDA(1,47.7611,"+1,"_DGIEN_",",.01)=DGTYPE
  1. . S DGFDA(1,47.7611,"+1,"_DGIEN_",",.02)=1
  1. . S DGTIEN(1)=DGTYPE
  1. . D UPDATE^DIE("","DGFDA(1)","DGTIEN","DGROOT")
  1. . I $D(DGROOT) D MES^XPDUTL("ERROR filing Doc Type "_DGDATA_".") Q
  1. . S DGCOUNT=DGCOUNT+1
  1. D MES^XPDUTL("Filed Business Rules for "_DGCOUNT_" of 15 successfully.")
  1. Q
  1. ;
  1. BRDATA ; data to populate into the 47.761 file
  1. ; Format: Source of Notification^Document Type
  1. ;;1^INPTD
  1. ;;8^DC
  1. ;;8^SPROD
  1. ;;8^CR
  1. ;;8^DCUSG
  1. ;;8^CSUSG
  1. ;;8^ORUS
  1. ;;8^NDUCROD
  1. ;;8^NDPRA
  1. ;;8^NDCEOR
  1. ;;8^NODAP
  1. ;;8^NODOF
  1. ;;8^NODOFAF
  1. ;;8^UACCM
  1. ;;10^EC
  1. ;;