source: WorldVistAEHR/trunk/r/MEDICINE-MC/MCARAM0.m@ 1147

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

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1MCARAM0 ;WASH ISC/JKL-MUSE AUTO INSTRUMENT REINITIALIZE ;2/24/95 10:01
2 ;;2.3;Medicine;;09/13/1996
3 ;
4 ;
5START ;Driver for MCARECGINIT-ECG Corrupted Records Delete
6 ;Deletes corrupted records and reinitializes error summary file
7 N MCDT,MCIEN,MCCNT,MCCOR,MCNAME,MCSSN,MCERR,MCEXDT,MCEKG,MCPID,MCNDT
8 S (MCDT,MCIEN,MCCNT,MCCOR)=0
9 S (MCNAME,MCSSN)=""
10 W !,"Warning: This process will delete all of the records listed in"
11 W !,"the retransmittal report."
12 W !!,"This process will also remove the release status of each"
13 W !,"automated record that has a release status."
14 W !!,"This process will also add a confirmation status to each"
15 W !,"automated record that does not have a confirmation status."
16 R !!,"Do you wish to continue ? N //",MCDEF:30 I '$T Q
17 I $E(MCDEF)'="Y" Q
18 W !!,"Each ""."" represents 100 records.",!!,"Deleting---"
19 ; checks for whole records
20 F I=1:1 S MCIEN=$O(^MCAR(700.5,MCIEN)) Q:MCIEN=""!(MCIEN="B") S MCROOT="^MCAR(700.5," D ERR I MCERR'="" D DEL S:MCERR="CORRUPTION" MCCOR=MCCOR+1 K MCNAME,MCSSN,MCERR,MCEXDT W:MCCNT#100=0 "."
21 S (MCDT,MCIEN)=0,(MCNAME,MCSSN)=""
22 F I=1:1 S MCIEN=$O(^MCAR(691.5,MCIEN)) Q:MCIEN=""!(MCIEN="B") S MCROOT="^MCAR(691.5," D EKGCK I MCERR'="" D DEL,DELAC S:MCERR="CORRUPTION" MCCOR=MCCOR+1 K MCNAME,MCSSN,MCERR,MCEXDT W:MCCNT#100=0 "."
23 D ^MCARAM0A
24 D ^MCARAM0B
25 D ^MCARAM0C
26 D ^MCARAM0D
27 D ^MCARAM0E
28 D ^MCARAM0F
29 D ^MCARAM0G
30 W !!,MCCNT," records deleted."
31 W !!,"Each ""."" represents 100 records.",!!,"Removing release status and adding confirmation status---"
32 D ^MCARAM0H
33 W !!,"...done."
34 Q
35 ;
36ERR ;
37 S MCERR=""
38 I $D(^MCAR(700.5,MCIEN,0)),$P(^MCAR(700.5,MCIEN,0),"^",2)="MHOLT" Q
39 I '$D(^MCAR(700.5,MCIEN,0)) S MCDT="",MCNAME="",MCSSN="",MCERR="CORRUPTION"
40 S MCDT=$P(^MCAR(700.5,MCIEN,0),"^"),MCSSN=$P(^MCAR(700.5,MCIEN,0),"^",3),MCNAME=$P(^MCAR(700.5,MCIEN,0),"^",4),MCERR=$P(^MCAR(700.5,MCIEN,0),"^",5)
41 I MCDT="" S MCDT="NO DATE/TIME",MCERR="CORRUPTION"
42 I MCSSN="" S MCSSN="NO SSN",MCERR="CORRUPTION"
43 I MCNAME="" S MCNAME="NO PATIENT NAME ON FILE",MCERR="CORRUPTION"
44 I '$D(^MCAR(700.5,"B",MCDT,MCIEN)) S MCERR="CORRUPTION"
45 Q
46 ;
47EKGCK ;
48 S MCERR=""
49 I '$D(^MCAR(691.5,MCIEN,0)) S MCERR="CORRUPTION",MCPID="",MCDT=""
50 I '$D(^MCAR(691.5,MCIEN,.1)) S MCSSN="",MCNAME="",MCERR="CORRUPTION" Q
51 I $D(^MCAR(691.5,MCIEN,0)) S MCDT=$P(^MCAR(691.5,MCIEN,0),"^"),MCPID=$P(^MCAR(691.5,MCIEN,0),"^",2),MCSSN=^MCAR(691.5,MCIEN,.1)
52 S X=MCSSN,DIC="^DPT(",DIC(0)="XZ",D="SSN" D IX^DIC
53 I +Y>0 S MCNAME=$P(Y(0),"^")
54 I +Y>0 S MCPIDT=$P(Y,"^")
55 I +Y=-1 S MCPIDT="NOPID",MCNAME="NO PATIENT NAME ON FILE"
56 I MCPID'=MCPIDT S MCERR="CORRUPTION",MCNDT=$E(MCDT,1,11) D MID
57 K X,Y,D,MCPIDT,MCNDT
58 I '$D(^MCAR(691.5,"B",MCDT,MCIEN)) S MCERR="CORRUPTION"
59 I '$D(^MCAR(691.5,"C",MCPID,MCIEN)) S MCERR="CORRUPTION"
60 Q
61MID ;
62 I '$D(^DPT(MCPID,0)) Q
63 I $D(^MCAR(691.5,"B",MCNDT)) S MCNAME=$P(^DPT(MCPID,0),"^"),MCSSN=$P(^DPT(MCPID,0),"^",9) Q
64 N MCSSN2,MCNAME2
65 S MCSSN2=$P(^DPT(MCPID,0),"^",9) I MCSSN2'[MCPIDT S MCNAME2=$P(^DPT(MCPID,0),"^"),MCCOR=MCCOR+1,MCCNT=MCCNT+1
66 K MCSSN2,MCNAME2 Q
67DEL ;
68 S DIK=MCROOT,DA=MCIEN D ^DIK
69 S MCCNT=MCCNT+1 Q
70 ;
71DELAC ;
72 I $D(MCDT),$D(MCPID),$D(^MCAR(690,"AC",MCPID,9999999.9999-MCDT,"MCAR(691.5",MCIEN)) K ^MCAR(690,"AC",MCPID,9999999.9999-MCDT,"MCAR(691.5",MCIEN)
73 Q
Note: See TracBrowser for help on using the repository browser.