VistA-WorldVistAEHR/r/ICR_IMMUNOLOGY_CASE_REGISTR.../IMRRAD.m

39 lines
1.9 KiB
Mathematica

IMRRAD ;HCIOFO/NCA,FT-Data Extract of Radiology and Dental to National Registry ;03/05/01 03:56
;;2.1;IMMUNOLOGY CASE REGISTRY;**4,11,14,15**;Feb 09, 1998
RAD ; Extract Radiology Data. Called from IMRDAT1
S IMRJRXX=IMRSD,(IMRJRLD,IMRSD)=$S(IMRLD>0:IMRLD,1:IMRSD)
D RAD^IMRUTL S IMRSD=IMRJRXX
S IMRRAD=0 Q:'$D(^TMP($J,"RAE1"))
S IMRRAI="A" F S IMRRAI=$O(^TMP($J,"RAE1",DFN,IMRRAI),-1) Q:IMRRAI="" S IMRX1=$G(^(IMRRAI)),IMRD=9999999.9999-$P(IMRRAI,"-",1) D RA
D EXIT
Q
RA Q:IMRJRLD'<IMRD
Q:IMRD>IMRED
Q:IMRD<IMRSD
S IMRC=IMRC+1,IMRX="",IMRX=IMRD_"^"_$P(IMRX1,"^",1)_"^"_$P(IMRX1,"^",10) I IMRX'="" S ^TMP($J,"IMRX",IMRC)="RA"_U_IMRX S IMRSEND=1 ;IMRD=exam date, piece 1=radiology procedure,piece 10=CPT code
S CNUM="" F S CNUM=$O(^TMP($J,"RAE1",DFN,IMRRAI,"CMOD",CNUM)) Q:CNUM="" S CPTREC=$G(^TMP($J,"RAE1",DFN,IMRRAI,"CMOD",CNUM)),CPTC=$P(CPTREC,U,1),IPC=CNUM+4 D RA2 ;cpt modifier starts at piece 5
Q
RA2 S:IMRD'<IMRRAD IMRRAD=IMRD
S:CPTC'="" $P(^TMP($J,"IMRX",IMRC),U,IPC)=CPTC,CPTC=""
D LCHK^IMRDAT
Q
DENT ; Extract Dental Data. Called from IMRDAT1
S IMRJRLD=$S(IMRLD>0:IMRLD,1:IMRSD)
S IMRDENS=9999999-IMRJRLD,IMRDENE=9999999-IMRED,IMRDENT=0
; E x-ref on File 221 is patient pointer
F IMRRAI=IMRDENE:0 S IMRRAI=$O(^DENT(221,"E",DFN,IMRRAI)) Q:IMRRAI'<IMRDENS!(IMRRAI<1) D DENT^IMRUTL S IMRD=$G(IMRAR(221,IMRRAI_",",.01,"I")) D DENT1
G EXIT
DENT1 ;
Q:IMRD'>IMRJRLD
Q:IMRD>IMRED
Q:IMRD<IMRSD
I $G(IMRAR(221,IMRRAI,61,"I"))>0 S:IMRD>IMRDENT IMRDENT=IMRD
S IMRC=IMRC+1,IMRHOLD=""
F IMRLOOP=6:1:8,10:1:12,38,14:1:17,19,39,21:1:25,6.7,27:1:37,7.1,6.2,6.4,6.6,6.8 S IMRHOLD=IMRHOLD_U_$G(IMRAR(221,IMRRAI_",",IMRLOOP,"I"))
S ^TMP($J,"IMRX",IMRC)="DNT"_U_IMRD_U_$G(IMRAR(221,IMRRAI_",",5,"E"))_U_$G(IMRAR(221,IMRRAI_",",4.5,"E"))_IMRHOLD
S IMRSEND=1
D LCHK^IMRDAT
Q
EXIT K IMRRAI,IMRRAJ,IMRAK,IMRX1,IMRX2,IMRX,IMRLOOP,IMRHOLD,IMRAR,^TMP($J,"RAE1"),IMRDENE,IMRDENS,IMRJRLD,IMRJRXX
Q