source: WorldVistAEHR/trunk/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFP41.m@ 837

Last change on this file since 837 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.1 KB
Line 
1MPIFP41 ;;BIR/CML-MPI VISTA build post-init to search for bad ICN Checksums ;Jun 10, 2005
2 ;;1.0; MASTER PATIENT INDEX VISTA ;**41**;30 Apr 99
3 ;
4EN ;
5 D BMES^XPDUTL("Post-init will look for patients with erroneous ICN Checksum values.")
6 ;
7 S QUEDUZ=$S($G(DUZ)="":.5,1:DUZ)
8 S ZTSAVE("QUEDUZ")="",ZTRTN="QUE^MPIFP41",ZTDESC="MPI/PD - Search for Bad ICN Checksums",ZTIO="",ZTDTH=$$NOW^XLFDT D ^%ZTLOAD
9 I $D(ZTSK) D BMES^XPDUTL("Job was queued as Task #"_ZTSK_".")
10 ;
11QUIT ;
12 K ZTSK S:$D(ZTQUEUED) ZTREQ="@"
13 K QUEDUZ,ZTDESC,ZTIO,ZTREQ,ZTRTN,ZTSAVE,ZTDTH
14 Q
15 ;
16QUE ;entry point for background job
17 N ARR,CHKSUM,DA,DFN,DIFF,DR,ERRCNT,I,ICN,LTH,MPI,NODE,OLDSUM,SITENM,SITENUM,TXTCNT,START,STOP
18 S (ERRCNT,DFN)=0,START=$$NOW^XLFDT
19 F S DFN=$O(^DPT(DFN)) Q:'DFN S NODE=$G(^DPT(DFN,"MPI")) S ICN=$P(NODE,"^") I ICN D
20 .S CHKSUM=$$CHECKDG^MPIFSPC(ICN),OLDSUM=$P(NODE,"^",2)
21 .I +OLDSUM,$L(OLDSUM)'=6 S LTH=($L(OLDSUM)+1) F I=LTH:1:6 S OLDSUM="0"_OLDSUM
22 .I CHKSUM'=OLDSUM D
23 ..S ERRCNT=ERRCNT+1,ARR(ICN)=CHKSUM_"^"_OLDSUM
24 ..S DIE="^DPT(",DA=DFN,DR="991.02///^S X=CHKSUM" D ^DIE K DIE
25 ;
26 ;calculate run time
27 S STOP=$$NOW^XLFDT
28 S DIFF=($$FMDIFF^XLFDT(STOP,START,2))/3600
29 ;
30 ;send results back to MPI
31 N XMDUZ,XMSUB,SITENM,SITENUM,MPI,XMY,XMTEXT
32 S SITENM=$P($$SITE^VASITE,"^",2),SITENUM=$P($$SITE^VASITE,"^",3)
33 S XMDUZ="MPI AUSTIN"
34 S XMSUB="MPIF*1.0*41 Post Init - "_SITENUM_"/"_SITENM
35 S XMY("G.MPI POST INIT MONITOR@MPI-AUSTIN.MED.VA.GOV")="",XMTEXT="MPI(1,"
36 S MPI(1,1)=SITENUM_"/"_SITENM_": (Run Time = "_$J(DIFF,5,2)_" hrs)"
37 S MPI(1,2)="Found "_ERRCNT_" patients with bad ICN checksums"_$S(ERRCNT>0:" -- all have been fixed.",1:".")
38 S MPI(1,3)=""
39 I ERRCNT>0 S MPI(1,4)="(ICN/GOOD CHECKSUM^CURRENT BAD CHECKSUM)"
40 S TXTCNT=4
41 S ICN=0 F S ICN=$O(ARR(ICN)) Q:'ICN S TXTCNT=TXTCNT+1,MPI(1,TXTCNT)=ICN_"/"_ARR(ICN)
42 D ^XMD
43 ;send e-mail to local user who queued this job
44 N XMDUZ,XMSUB,MPI,XMY,XMTEXT
45 S XMDUZ="MPI AUSTIN"
46 S XMSUB="MPIF*1.0*41 Post Init Complete."
47 S XMY("`"_QUEDUZ_"@"_^XMB("NETNAME"))="",XMTEXT="MPI(1,"
48 S MPI(1,1)="Post Init for patch MPIF*1.0*41 has run to completion."
49 S MPI(1,2)="You should now delete routine ^MPIFP41."
50 D ^XMD
51 Q
Note: See TracBrowser for help on using the repository browser.