VistA-WorldVistAEHR/r/SURGERY-SR/SROGTSR.m

39 lines
2.0 KiB
Mathematica

SROGTSR ;WASH/GEK,BIR/ADM - IMAGING: SURGERY CASE LIST ; [ 05/08/97 6:11 AM ]
;;3.0; Surgery ;**66,89**;24 Jun 93
ERRA ; Error trap
S SRGY(0)="0^ERROR "_$$EC^%ZOSV
D @^%ZOSF("ERRTN")
Q
GET(SRGY,SRDFN) ;
N CNT,DFN,J,K,LOOP,M,MM,MMM,SR,SRDT,SRIMAGE,SRIMCNT,SRLONG,SROP,SROPER,SROPERS,SROPS,SROTHER,SRSCAN,SRSDATE,SRSOUT,SRSTAT,SRSTATUS,SRTOT,X,Y
S X="ERRA^SROGTSR",@^%ZOSF("TRAP")
S DFN=+SRDFN
S SRSOUT=0
S (SRDT,SRTOT)=0,CNT=2 F S SRDT=$O(^SRF("ADT",DFN,SRDT)) Q:'SRDT!(SRSOUT) S SROP=0 F S SROP=$O(^SRF("ADT",DFN,SRDT,SROP)) Q:'SROP!(SRSOUT) D LIST
I '$D(SRGY(2)) S SRGY(0)="0^There are no cases entered" Q
S SRGY(0)=SRTOT_"^Case"_$S(SRTOT=1:"",1:"s")_" found"
S SRGY(1)="#^Date^Case description"
Q
LIST ; list cases
I $P($G(^SRF(SROP,"NON")),"^")="Y" Q
S SRSCAN=1 I $D(^SRF(SROP,.2)),$P(^(.2),"^",12)'="" K SRSCAN
I $D(SRSCAN),$D(^SRF(SROP,30)),$P(^(30),"^") Q
I $D(SRSCAN),$D(^SRF(SROP,31)),$P(^(31),"^",8) Q
I $D(^SRF(SROP,37)),$P(^(37),"^") Q
S SRSDATE=$P(^SRF(SROP,0),"^",9)
S SRTOT=SRTOT+1,SRGY(CNT)=SRTOT_U_$E(SRSDATE,4,5)_"-"_$E(SRSDATE,6,7)_"-"_($E(SRSDATE,1,3)+1700)_U
S SROPER=$P(^SRF(SROP,"OP"),"^") I $O(^SRF(SROP,13,0)) S SROTHER=0 F I=0:0 S SROTHER=$O(^SRF(SROP,13,SROTHER)) Q:'SROTHER D OTHER
D ^SROP1 K SROPS,MM,MMM S:$L(SROPER)<65 SROPS(1)=SROPER I $L(SROPER)>64 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
S (SRIMCNT,SRIMAGE)=0 F S SRIMAGE=$O(^SRF(SROP,2005,SRIMAGE)) Q:'SRIMAGE S SRIMCNT=SRIMCNT+1
S SRGY(CNT)=SRGY(CNT)_SROPS(1)_U_SROP_U_SRSDATE_U_SRIMCNT,CNT=CNT+1
S J=2 F Q:'$D(SROPS(J)) S SRGY(CNT)="^^"_SROPS(J),J=J+1,CNT=CNT+1
Q
OTHER ; other operations
S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SROP,13,SROTHER,0),"^"))>235 S SRLONG=0,SROTHER=999,SROPERS=" ..."
I SRLONG S SROPERS=$P(^SRF(SROP,13,SROTHER,0),"^")
S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
Q
LOOP ; break procedure
S SROPS(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROPS(M))+$L(MM)'<65 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
Q