VistA-FOIAVistA/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAMIS.m

81 lines
4.5 KiB
Mathematica
Raw Normal View History

RAMIS ;HISC/CAH,GJC,FPT AISC/MJK-Radiology AMIS Report ;4/15/96 12:49
;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
I $O(RACCESS(DUZ,""))="" D SETVARS^RAPSET1(0) S RAPSTX=""
I $O(RACCESS(DUZ,""))="" D ACCVIO^RAUTL19 Q
W !!,"NOTE: This output should be queued to a printer that supports 132 columns.",!
D CHK^RAMIS2 I '$D(RADFLAG) G Q^RAMIS1
S ZTRTN="START^RAMIS",ZTSAVE("BEGDATE")="",ZTSAVE("ENDDATE")="",ZTSAVE("^TMP($J,""RA D-TYPE"",")="" D DATE^RAUTL G:RAPOP Q^RAMIS1
D SHOWSTAT
DEV W ! D ZIS^RAUTL G:RAPOP Q^RAMIS1
START ; Start processing here
S:$D(ZTQUEUED) ZTREQ="@"
U IO K ^TMP($J,"RAMIS") S RAXIT=0
S RABEG=BEGDATE-.0001,RAEND=ENDDATE+.9999,D="TOT",RACRT=8
D CRIT^RAUTL1 D INIT
F RADTE=RABEG:0:RAEND S RADTE=$O(^RADPT("AR",RADTE)) Q:RADTE'>0!(RADTE>RAEND) D Q:RAXIT
. S RADFN=0
. F S RADFN=$O(^RADPT("AR",RADTE,RADFN)) Q:RADFN'>0 D RADTI Q:RAXIT
. Q
G:'RAXIT ^RAMIS1
G Q^RAMIS1
;
RADTI ; Obtain the Registered Exams node
F RADTI=0:0 K RA20,RABILAT,RA21H,RA21B,RAOR,RAPORT,RAORFL,RAPORTFL,RAVST,RACPT S RADTI=$O(^RADPT("AR",RADTE,RADFN,RADTI)) Q:RADTI'>0!(RAXIT) I $D(^RADPT(RADFN,"DT",RADTI,0)) S RAD0=^(0) D RACNI
Q
RACNI ; Obtain the Examinations node
S (RADIVN,Y)=+$P(RAD0,U,3) Q:RADIVN'>0
S C=$P(^DD(70.02,3,0),U,2) D Y^DIQ Q:Y="" S RADIVN(0)=Y
I $D(^TMP($J,"RA D-TYPE",RADIVN(0),RADIVN))[0 Q
F RACNI=0:0 S RACNI=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI)) Q:RACNI'>0!(RAXIT) I $D(^(RACNI,0)) S RAP0=^(0) D CHK:$D(RACRT(+$P(RAP0,"^",3)))
Q
;
CHK I $D(ZTQUEUED) D STOPCHK^RAUTL9 S:$G(ZTSTOP)=1 RAXIT=1 Q:RAXIT
S RADIV=$S($D(^RA(79,+$P(RAD0,"^",3),0)):+$P(RAD0,"^",3),1:99) I '$D(^TMP($J,"RAMIS",RADIV)) S D=RADIV D INIT
S C=$S($D(^DIC(42,+$P(RAP0,"^",6),0)):"IN",1:"OUT")
I '$D(RAVST) S RAVST="" F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,"VST",C)+1
F I=0:0 S I=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"F",I)) Q:I'>0!(RAXIT) I $D(^(I,0)) S X=^(0) I $D(^RA(78.4,+X,0)) S T=$S($P(^(0),"^",2)'="Y":"FLM",1:"CINE"),X=+$P(X,"^",2) D FLM
F I=0:0 S I=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"M",I)) Q:I'>0 I $D(^(I,0)) S RAQI=+^(0) D EXTRA^RAUTL12(RAQI)
Q:'$D(^RAMIS(71,+$P(RAP0,"^",2),0)) S RAPRI=^(0),RAPRC=$E($P(RAPRI,"^"),1,30) Q:'$D(^(2))!($D(RACPT(+$P(RAPRI,"^",9)))) S RACPT(+$P(RAPRI,"^",9))=""
F I=0:0 S I=$O(^RAMIS(71,+$P(RAP0,"^",2),2,I)) Q:I'>0!(RAXIT) I $D(^(I,0)) S RAZ=^(0),RAMJ=$S($D(^RAMIS(71.1,+RAZ,0)):^(0),1:"") D RAPRC
Q:'$D(RAMIS(1)) F I=0:0 S I=$O(RAMIS(I)) Q:I'>0!(RAXIT) S A=RAMIS(I),RAWT=RAWT(I),RAMUL=RAMUL(I),RACT=RACT(I) D STORE
K RAMIS,RAWT,RAMUL,RACT,RAZ,RAMJ,RAMULP,RAMULPFL,RAPORT,RAOR,RABILAT,RA21H,RA21B,RA20 Q
;
STORE ; Store data into ^TMP($J,"RAMIS")
I $D(ZTQUEUED) D STOPCHK^RAUTL9 S:$G(ZTSTOP)=1 RAXIT=1 Q:RAXIT
I A=20,$D(RA20) Q
I A=21,$D(RA21H),RACT="H" Q
I A=21,$D(RA21B),RACT="B" Q
S:A=20 RA20="" I A=21 S:RACT="H" RA21H="" S:RACT="B" RA21B=""
I '$D(RAORFL),$D(RAOR) S RAORFL="" F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,25,"EX",C)+1
I '$D(RAPORTFL),$D(RAPORT) S RAPORTFL="" F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,26,"EX",C)+1
I '$D(RAMULPFL),$D(RAMULP) S RAMULPFL="" F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,"MULP","EX",C)+1
F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,A,"EX",C)+RAMUL
F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,A,"WT",C)+(RAMUL*RAWT)
I $D(RAOR) F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,25,"WT",C)+(RAMUL*RAWT)
I $D(RAPORT) F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,26,"WT",C)+(RAMUL*RAWT)
I $D(RAMULP) F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,"MULP","WT",C)+(RAMUL*RAWT)
F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,"TOT","EX",C)+RAMUL
F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,"TOT","WT",C)+(RAMUL*RAWT)
Q
;
INIT ; Initialize the ^TMP($J,"RAMIS" global to zero.
F A=1:1:27,99,"TOT","MULP" F T="EX","WT" F C="IN","OUT" S ^TMP($J,"RAMIS",D,A,T,C)=0
F T="FLM","CINE","CINERUNS","VST" F C="IN","OUT" S ^TMP($J,"RAMIS",D,T,C)=0
Q
;
RAPRC I $D(ZTQUEUED) D STOPCHK^RAUTL9 S:$G(ZTSTOP)=1 RAXIT=1 Q:RAXIT
I +RAZ=25 S RAOR="" Q
I +RAZ=26 S RAPORT="" Q
S:$P(RAZ,U,3)="Y" RABILAT="" F J=1:1 I '$D(RAMIS(J)) S RAMIS(J)=$S(RAMJ]"":+RAZ,1:99),RAWT(J)=+$P(RAMJ,U,2),RAMUL(J)=$S(+$P(RAZ,U,2)>0:+$P(RAZ,U,2),1:1) S:$D(RABILAT)&(RAMUL(J)<2) RAMUL(J)=RAMUL(J)*2 S RACT(J)=$P(RAZ,U,4) S:J>1 RAMULP="" Q
K RABILAT
Q
;
FLM I $D(ZTQUEUED) D STOPCHK^RAUTL9 S:$G(ZTSTOP)=1 RAXIT=1 Q:RAXIT
F D=RADIV,"TOT" S ^(C)=^TMP($J,"RAMIS",D,T,C)+X S:T="CINE" ^(C)=^TMP($J,"RAMIS",D,"CINERUNS",C)+1
Q
SHOWSTAT ;
K ^TMP($J,"RA I-TYPE") N RA2,RAXIT S (RA2,RAXIT)=""
F S RA2=$O(^RA(72,"AA",RA2)) Q:RA2="" S ^TMP($J,"RA I-TYPE",RA2)=""
D DISPXAM^RALWKL1(8) K ^TMP($J,"RA I-TYPE")
Q