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

SROPCE0B.m

Go to the documentation of this file.
SROPCE0B ;BIR/ADM - PCE FILING STATUS REPORT, SHORT FORM ;12/16/98  2:10 PM
 ;;3.0; Surgery ;**58,62,69,77,50,86,118,142**;24 Jun 93
 ;
 ; Reference to ^ECC(723 supported by DBIA #205
 ; Reference to ^SCE("AVSIT" supported by DBIA #2045
 ; Reference to File #409.68 supported by DBIA #2045
 ;
 D HDR F  S SRSDT=$O(^SRF("AC",SRSDT)) Q:'SRSDT!(SRSDT>SRSEDT)!SRSOUT  S SRTN=0 F  S SRTN=$O(^SRF("AC",SRSDT,SRTN)) Q:'SRTN  I $D(^SRF(SRTN,0)),$$DIV^SROUTL0(SRTN),$P($G(^SRF(SRTN,30)),"^")="" D UTIL Q:SRSOUT
 D:'SRSOUT TOTAL
 Q
TOTAL D:$Y+9>IOSL PAGE Q:SRSOUT  W !!,?13,"FILED: ",$J(CNT(1),5),!,?9,"NOT FILED: "_$J(CNT(4),5)
 F I=1:1:5 S CNT(6)=CNT(6)+CNT(I)
 W:CNT(5) !,?9,"UNCERTAIN: "_$J(CNT(5),5) W !,?20,"-----",!,?7,"TOTAL CASES: ",$J(CNT(6),5)
 Q
UTIL ; process case
 S SRDIV=$P($G(^SRF(SRTN,8)),"^") I SRDIV S SRSPS=$O(^SRO(133,"B",SRDIV,0))
 I 'SRDIV S SRSPS=SRSITE
 S X=^SRO(133,SRSPS,0),SRPARAM=$P(X,"^",15),SRSR=$P(X,"^",19) I SRPARAM=""!(SRPARAM="N") Q
 S SRINOUT=$P(^SRF(SRTN,0),"^",12) I SRPARAM="O",SRINOUT'="",SRINOUT'="O" Q
 S SRNON=0 I $P($G(^SRF(SRTN,"NON")),"^")="Y" S SRNON=1
 I SRFLG=1!(SRFLG=3&('SRNON)),'$P($G(^SRF(SRTN,.2)),"^",12) Q
 I SRFLG=2!(SRFLG=3&SRNON),'$P($G(^SRF(SRTN,"NON")),"^",5) Q
 I (SRFLG=2&('SRNON))!(SRFLG=1&(SRNON)) Q
 S SRSS=$S('SRNON:$P(^SRF(SRTN,0),"^",4),1:$P(^SRF(SRTN,"NON"),"^",8)) I SRSPEC,SRSPEC'=SRSS Q
 S SRSSNM=$S('SRNON:$P(^SRO(137.45,SRSS,0),"^"),1:$P(^ECC(723,SRSS,0),"^"))
 I SRPARAM="O",SRINOUT="" S SRSTATUS=5,CNT(5)=CNT(5)+1 D CASE,CHK^SROPCE0,MISS Q
 I $P(^SRF(SRTN,0),"^",15) S SRSTATUS=1,CNT(1)=CNT(1)+1 D CASE,LINE Q
 S SRSTATUS=4,CNT(4)=CNT(4)+1 D CASE,CHK^SROPCE0,MISS
 Q
MISS ; list fields missing data
 Q:SRSOUT  S SRFLD="" S SRFLD=$O(SRX(SRFLD)) I SRFLD="" W !,?15,"No Missing Information" D LINE Q
 S SRCT=1,SRFLD="" W !!,?15,"Missing Information:" F  S SRFLD=$O(SRX(SRFLD)) Q:SRFLD=""  D:$Y+5>IOSL PAGE Q:SRSOUT  W !,$J(SRCT_". ",20),SRX(SRFLD) S SRCT=SRCT+1
LINE I 'SRSOUT W ! F I=1:1:80 W "-"
 Q
SCHED ; get appointment status from Scheduling
 N SRENC,SRVSIT,SRX S SRSCHED="<NONE>",SRVSIT=$P(SR(0),"^",15) Q:'SRVSIT
 S SRENC=$O(^SCE("AVSIT",SRVSIT,0)) Q:'SRENC
 S DA=SRENC,DIC=409.68,DR=".12",DIQ="SRX",DIQ(0)="E" D EN^DIQ1 K DA,DIC,DIQ,DR
 I SRX(409.68,SRENC,.12,"E")="INPATIENT APPOINTMENT" S SRX(409.68,SRENC,.12,"E")="INPATIENT APPT"
 S X=SRX(409.68,SRENC,.12,"E") I X'="" S SRSCHED=X
 Q
CASE ; print case info
 D:$Y+9>IOSL PAGE Q:SRSOUT  D DEM,PROC,SCHED
 W !,SRSDATE,?22,SRSNM,?44,SRSSN_"  ("_SRAGE_")",?66,$S(SRSTATUS=1:"FILED",SRSTATUS=4:"NOT FILED",1:"UNCERTAIN")
 W !,SRTN,?22,$E(SRSSNM,1,20),?66,$E(SRSCHED,1,14),! W:(SRFLG=3)&SRNON "NON-O.R." W ?22,SRPROC(1) W:$D(SRPROC(2)) !,?22,SRPROC(2) W:$D(SRPROC(3)) !,?22,SRPROC(3)
 Q
DEM ; get patient demographic information
 S SR(0)=^SRF(SRTN,0),DFN=$P(SR(0),"^") D DEM^VADPT S SRSNM=VADM(1),SRSSN=VA("PID"),Y=SRSDT X ^DD("DD") S SRSDATE=Y,X1=$E(SRSDT,1,7),X2=$P(VADM(3),"^"),SRAGE=$E(X1,1,3)-$E(X2,1,3)-($E(X1,4,7)<$E(X2,4,7))
 I $L(SRSNM)>20 S SRSNM=$P(VADM(1),",")_","_$E($P(VADM(1),",",2))_"."
 Q
PROC ; get principal procedure
 K SRPROC S X=$P(^SRF(SRTN,"OP"),"^") I $L(X)<56 S SRPROC(1)=X
 I $L(X)>55 S K=1 F  D  I $L(X)<56 S SRPROC(K)=X Q
 .F I=0:1:54 S J=55-I,Y=$E(X,J) I Y=" " S SRPROC(K)=$E(X,1,J-1),X=$E(X,J+1,$L(X)) S K=K+1 Q
 Q
PAGE I $E(IOST)="P"!SRHDR G HDR
 W ! K DIR S DIR(0)="E" D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S SRSOUT=1 Q
HDR ; print heading
 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
 W:$Y @IOF W:$E(IOST)="P" !,?(80-$L(SRINST)\2),SRINST W !,?(80-$L(SRRPT)\2),SRRPT,?70,$J("PAGE "_SRPAGE,9),!,?(80-$L(SRTITLE)\2),SRTITLE,!,?(80-$L(SRFRTO)\2),SRFRTO W:$E(IOST)="P" !,?(80-$L(SRPRINT)\2),SRPRINT
 W !!,"DATE OF "_$S(SRFLG=1:"OPERATION",SRFLG=2:"PROCEDURE",1:"OP/PROCEDURE"),?22,"PATIENT NAME",?44,"PATIENT ID  (AGE)",?66,"FILING STATUS",!,"CASE #",?22,"SPECIALTY",?66,"SCHED STATUS",!,?22,"PRINCIPAL PROCEDURE"
 S SRHDR=0,SRPAGE=SRPAGE+1 W ! F I=1:1:80 W "="
 Q