VistA-WorldVistAEHR/r/MEDICINE-MC/MCARAMLA.m

34 lines
1.2 KiB
Mathematica

MCARAMLA ;WASH ISC/JKL-MUSE AUTO RETRANSMISSION-TRAN INCOMP ;2/27/95 11:15
;;2.3;Medicine;;09/13/1996
;
;
;Called from ^MCARAML
;Retransmit records with same date/time,
;no transaction zero node, no EKG SSN, no EKG record by date
N MCDATE,MCIEN,MCZERO,MCNAME,MCSSN,MCI,MCJ,MCK,MCL,MCERR
S MCDATE=0
F MCI=1:1 S MCDATE=$O(^MCAR(700.5,"B",MCDATE)) Q:MCDATE="" D FORMAT
Q
FORMAT ;
S MCIEN=0 F MCJ=1:1 S MCIEN=$O(^MCAR(700.5,"B",MCDATE,MCIEN)) Q:MCIEN="" D SAVE
Q
SAVE ;
I '$D(^MCAR(700.5,MCIEN,0)) Q
S MCZERO=^MCAR(700.5,MCIEN,0),MCNAME=$P(MCZERO,"^",4),MCSSN=$P(MCZERO,"^",3)
I $P(MCZERO,"^",2)="MHOLT" Q
I '$D(^MCAR(691.5,"B",MCDATE)) D SET Q
S (MCERR,MCEKG)=0
F MCK=1:1 S MCEKG=$O(^MCAR(691.5,"B",MCDATE,MCEKG)) Q:MCEKG="" Q:('$D(^MCAR(691.5,MCEKG,.1))) I MCSSN=^MCAR(691.5,MCEKG,.1) S MCERR=1
I MCERR>0 Q
D SET Q
SET ;
I MCNAME="" S MCNAME="NO PATIENT NAME"
I MCSSN="" S MCSSN="NO SSN"
I $L(MCNAME)<30 F MCL=$L(MCNAME):1:30 S MCNAME=MCNAME_" "
I $L(MCSSN)<10 F MCL=$L(MCSSN):1:10 S MCSSN=MCSSN_" "
I $D(^TMP($J,0,"MC",MCNAME,MCSSN,MCDATE)) Q
S MCCNT=MCCNT+1 W:MCCNT#100=0 "."
S ^TMP($J,0,"MC",MCNAME,MCSSN,MCDATE)=""
S ^TMP($J,0,"MC",0)=MCCNT
Q