Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SROACC5

SROACC5.m

Go to the documentation of this file.
SROACC5 ;BIR/MAM - CPT ACCURACY ALL CODES ;05/14/99  11:33 AM
 ;;3.0; Surgery ;**37,50,88,127,142**;24 Jun 93
 ;
 ; Reference to ^ECC(723 supported by DBIA #205
 ;
 S SRSDT=SDATE1 F  S SRSDT=$O(^SRF("AC",SRSDT)) Q:SRSDT>EDATE1!('SRSDT)  S SRTN=0 F  S SRTN=$O(^SRF("AC",SRSDT,SRTN)) Q:'SRTN  I $D(^SRF(SRTN,0)),$P($G(^SRF(SRTN,30)),"^")="",$$DIV^SROUTL0(SRTN) D UTIL
 S SRHDR=0 D HDR^SROACC S CPT=0 F  S CPT=$O(^TMP("SR",$J,CPT)) Q:CPT=""!(SRSOUT)  D MORE
 I '$D(^TMP("SR",$J)) D LINE W $$NODATA^SROUTL0()
 Q
CNT ; get count
 S X=$S($D(^TMP("SR",$J,CPT))#2:^(CPT),1:0) S ^TMP("SR",$J,CPT)=X+1
 S X=$S($D(^TMP("SR",$J,CPT,2))#2:^(2),1:0) S ^TMP("SR",$J,CPT,2)=X+1
 Q
MORE ; print CPT description and get cases
 I $Y+12>IOSL D HDR^SROACC I SRSOUT Q
 S TYPE=0,X=$$CPT^ICPTCOD(CPT,EDATE),CPT1=$P(X,"^",2)_"  "_$P(X,"^",3)
 F  S TYPE=$O(^TMP("SR",$J,CPT,TYPE)) Q:TYPE=""  D DESC S SRSDT=0 F  S SRSDT=$O(^TMP("SR",$J,CPT,TYPE,SRSDT)) Q:'SRSDT!(SRSOUT)  D SRTN
 Q
SRTN S SRTN=0 F  S SRTN=$O(^TMP("SR",$J,CPT,TYPE,SRSDT,SRTN)) Q:'SRTN!(SRSOUT)  D PRINT
 Q
LOOP ; break procedure greater than 50 characters
 S SROP(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM=""  Q:$L(SROP(M))+$L(MM)'<50  S SROP(M)=SROP(M)_MM_" ",SROPER=MMM
 Q
DESC ; print description
 Q:SRSOUT  I '$O(^TMP("SR",$J,CPT,TYPE,0)) Q
 D LINE W !!,?(132-$L(CPT1)\2),CPT1
 I TYPE=1 W !,?50,"PRINCIPAL PROCEDURES"
 I TYPE=2 W !,?54,"OTHER PROCEDURES"
 K SRDESC S X=$$CPTD^ICPTCOD(CPT,"SRDESC",,EDATE) F I=1:1:X S Y=$S(I=1:"DESCRIPTION: "_SRDESC(I),1:SRDESC(I)) W !,?(132-$L(Y)\2),Y
 W !! F LINE=1:1:132 W "-"
 Q
PRINT ; print each case
 I $Y+5>IOSL D HDR^SROACC Q:SRSOUT  D DESC
 S SRNON=0 I $P($G(^SRF(SRTN,"NON")),"^")="Y" S SRNON=1
 S DFN=$P(^SRF(SRTN,0),"^"),Y=SRSDT D D^DIQ S SRDT=Y
 I 'SRNON S X=$P(^SRF(SRTN,0),"^",4),SRSS=$S(X:$P(^SRO(137.45,X,0),"^"),1:"SPECIALTY NOT ENTERED")
 I SRNON S X=$P(^SRF(SRTN,"NON"),"^",8),SRSS=$S(X:$P(^ECC(723,X,0),"^"),1:"SPECIALTY NOT ENTERED")
 S Y=$P(SRDT,"@",2),SRDT=$E(SRSDT,4,5)_"/"_$E(SRSDT,6,7)_"/"_$E(SRSDT,2,3)_" "_Y
 D DEM^VADPT S SRNAME=VADM(1),SSN=VA("PID")
 S SR(.1)=$S($D(^SRF(SRTN,.1)):^(.1),1:""),SRSUR=$S(SRNON:$P(^SRF(SRTN,"NON"),"^",6),1:$P(SR(.1),"^",4)),SRATT=$S(SRNON:$P(^SRF(SRTN,"NON"),"^",7),1:$P(SR(.1),"^",13))
 I SRSUR S SRSUR=$P(^VA(200,SRSUR,0),"^") I $L(SRSUR)>20 S SRSUR=$P(SRSUR,",")_", "_$E($P(SRSUR,",",2))
 I SRATT S SRATT=$P(^VA(200,SRATT,0),"^") I $L(SRATT)>20 S SRATT=$P(SRATT,",")_", "_$E($P(SRATT,",",2))
 D OPER^SROACC0
 K SROP,SROPT,MM,MMM S:$L(SROPER)<51 SROP(1)=SROPER I $L(SROPER)>50 S SROPER=SROPER_"  " F M=1:1 D LOOP Q:MMM=""
 W !,SRDT,?20,SRNAME,?60,SROP(1),?111,SRSUR,!,?3,SRTN,?20,VA("PID") W:$D(SROP(2)) ?60,SROP(2) W ?111,SRATT,!
 W:SRFLG=3&(SRNON) "NON-O.R." W ?20,SRSS I $D(SROP(3)) W ?60,SROP(3) I $D(SROP(4)) W !,?60,SROP(4) I $D(SROP(5)) W !,?60,SROP(5)
 ;
 I $D(SRCPTT) S:$L(SRCPTT)<51 SROPT(1)=SRCPTT I $L(SRCPTT)>50 S SRCPTT=SRCPTT_"  " F M=1:1 D LOOP^SROACC0 Q:MMM=""
 I $D(SRCPTT) F LOOP=1:1 Q:'$D(SROPT(LOOP))  W !,?60,SROPT(LOOP)
 W ! Q
UTIL ; set ^TMP("SR")
 S SRNON=0 I $P($G(^SRF(SRTN,"NON")),"^")="Y" S SRNON=1
 I SRFLG=1!(SRFLG=3&('SRNON)) Q:$P($G(^SRF(SRTN,.2)),"^",12)=""
 I SRFLG=2 Q:'SRNON
 S CPT=$P($G(^SRO(136,SRTN,0)),"^",2) I CPT S ^TMP("SR",$J,CPT,1,SRSDT,SRTN)="",X=$S($D(^TMP("SR",$J,CPT))#2:^(CPT),1:0),^TMP("SR",$J,CPT)=X+1,X=$S($D(^TMP("SR",$J,CPT,1))#2:^(1),1:0),^TMP("SR",$J,CPT,1)=X+1
 S OP=0 F  S OP=$O(^SRO(136,SRTN,3,OP)) Q:'OP  I $P($G(^SRO(136,SRTN,3,OP,0)),"^") S CPT=$P(^(0),"^"),^TMP("SR",$J,CPT,2,SRSDT,SRTN)="" D CNT
 Q
LINE W ! F LINE=1:1:132 W "="
 Q