source: FOIAVistA/tag/r/SURGERY-SR/SROPCEU0.m@ 1590

Last change on this file since 1590 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1SROPCEU0 ;BIR/ADM - UNTRANSMITTED OUTPATIENT ENCOUNTERS (CONT.) ;06/21/05
2 ;;3.0; Surgery ;**69,77,50,142**;24 Jun 93
3 ;
4 ; Reference to ^ECC(723 supported by DBIA #205
5 ;
6 U IO S (SRNEW,SRSOUT,SRSUB)=0,(SRHDR,SRPAGE)=1,Y=SDATE X ^DD("DD") S STARTDT=Y,Y=EDATE X ^DD("DD") S ENDATE=Y
7 S SRRPT="Outpatient Surgery Encounters Not Transmitted to NPCD"
8 S SRTITLE="For Completed "_$S(SRFLG=1:"O.R. Surgical Procedures",SRFLG=2:"Non-O.R. Procedures",1:"O.R. Surgical and Non-O.R. Procedures")
9 S SRFRTO="From: "_STARTDT_" To: "_ENDATE,SRINST=SRSITE("SITE") D NOW^%DTC S Y=$E(%,1,12) X ^DD("DD") S SRPRINT="Report Printed: "_Y
10 I SRSORT G S1
11 D HDR I SRSEL=1 S SRTN=0 F S SRTN=$O(^TMP("SR69",$J,SRTN)) Q:'SRTN!SRSOUT D CASE
12 Q:SRSOUT D:$Y+10>IOSL PAGE Q:SRSOUT
13 W !!,$S(SRSPEC:"SPECIALTY: "_SRSPECN,1:" * * * ALL SPECIALTIES * * *")
14TOT W !!," Total with NO status: ",$J(SRCNT(0),5)
15 W !," Total with NON-COUNT: ",$J(SRCNT(12),5)
16 W !,"Total with ACTION REQUIRED: ",$J(SRCNT(14),5),!,?28,"-----"
17 W !," Total cases identified: ",$J(SRCNT,5) S SRSUB=0
18 Q
19S1 S (SRSP,SRSPECN)=0 F S SRSPECN=$O(^TMP("SRSP",$J,SRSPECN)) Q:SRSPECN=""!SRSOUT S SRNEW=1 D PAGE Q:SRSOUT D
20 .I SRSEL=1 S SRTN=0 F S SRTN=$O(^TMP("SRSP",$J,SRSPECN,SRTN)) Q:'SRTN!SRSOUT D CASE
21 .Q:SRSOUT S X=^TMP("SRSP",$J,SRSPECN,0),SRCNT(0)=$P(X,"^"),SRCNT(12)=$P(X,"^",2),SRCNT(14)=$P(X,"^",3),SRCNT=$P(X,"^",4),SRSUB=1 D:$Y+10>IOSL PAGE Q:SRSOUT
22 .D TOT
23 Q:SRSOUT S SRSUB=1 D PAGE Q:SRSOUT W !!," * * * COMBINED TOTALS FOR ALL SPECIALTIES * * *" S X=^TMP("SRSP",$J,0),SRCNT(0)=$P(X,"^"),SRCNT(12)=$P(X,"^",2),SRCNT(14)=$P(X,"^",3),SRCNT=$P(X,"^",4) D TOT
24 Q
25SUBHD W !!,">>> "_$S($P(SRSPECN,";;")=1:"SURGICAL",1:"MEDICAL")_" SPECIALTY: "_$P(SRSPECN,";;",2)_$S('SRNEW:" * * continued * *",1:"")
26 S SRNEW=0 I SRSORT W !
27 Q
28CASE ; print case info
29 D:$Y+6>IOSL PAGE Q:SRSOUT
30 S SRNON=0 I $P($G(^SRF(SRTN,"NON")),"^")="Y" S SRNON=1
31 S SRSS=$S('SRNON:$P(^SRF(SRTN,0),"^",4),1:$P(^SRF(SRTN,"NON"),"^",8)),SRSSNM=$S('SRNON:$P(^SRO(137.45,SRSS,0),"^"),1:$P(^ECC(723,SRSS,0),"^"))
32 S SRSTATUS=$S('SRSORT:^TMP("SR69",$J,SRTN),1:^TMP("SRSP",$J,SRSPECN,SRTN)) I SRSTATUS="" S SRSTATUS="<NONE>"
33 I SRSORT D CLIN
34 D DEM,PROC W !,SRSDATE,?23,SRTN,?38,$S(SRSORT:$E(SRLOC,1,20),1:$E(SRSSNM,1,20)),?61,$S(IOM<82:$E(SRSTATUS,1,19),1:SRSTATUS)
35 W !,SRSNM,?23,SRPROC(1),!,SRSSN_" ("_SRAGE_")" W:$D(SRPROC(2)) ?23,SRPROC(2) W:(SRFLG=3)&SRNON !,"NON-O.R." I $D(SRPROC(3)) W:'SRNON ! W ?23,SRPROC(3)
36 W ! F I=1:1:IOM W "-"
37 Q
38DEM ; get patient dempgraphic information
39 S SR(0)=^SRF(SRTN,0),DFN=$P(SR(0),"^") D DEM^VADPT S SRSNM=VADM(1),SRSSN=VA("PID"),(SRSDT,Y)=$P(SR(0),"^",9) 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))
40 I $L(SRSNM)>21 S SRSNM=$P(VADM(1),",")_","_$E($P(VADM(1),"^",2))_"."
41 Q
42PROC ; get principal procedure
43 K SRPROC S X=$P(^SRF(SRTN,"OP"),"^") I $L(X)<58 S SRPROC(1)=X
44 I $L(X)>57 S K=1 F D I $L(X)<58 S SRPROC(K)=X Q
45 .F I=0:1:56 S J=57-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
46 Q
47CLIN ; get associated clinic
48 S X=$P(^SRF(SRTN,0),"^",21) I X S SRLOC=X
49 I 'SRNON,'X S X=$P(^SRO(137.45,SRSS,0),"^",5) S:X SRLOC=X I 'X S Y=$P(^SRF(SRTN,0),"^",2) I Y S X=$P(^SRS(Y,0),"^") I X S SRLOC=X
50 I SRNON,'X S X=$P(^SRF(SRTN,"NON"),"^",2) I X S SRLOC=X
51 S SRLOC=$S(SRLOC:$P(^SC(SRLOC,0),"^"),1:"<NOT ENTERED>")
52 Q
53PAGE I $E(IOST)="P"!SRHDR D HDR Q
54 W ! K DIR S DIR(0)="E" D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S SRSOUT=1 Q
55HDR ; print heading
56 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
57 W:$Y @IOF W:$E(IOST)="P" !,?(IOM-$L(SRINST)\2),SRINST W !,?(IOM-$L(SRRPT)\2),SRRPT,?(IOM-10),$J("Page "_SRPAGE,9),!,?(IOM-$L(SRTITLE)\2),SRTITLE,!,?(IOM-$L(SRFRTO)\2),SRFRTO
58 I $E(IOST)="P" W !,?(IOM-$L(SRPRINT)\2),SRPRINT W:SRSUB !
59 I SRSEL=1,'SRSUB W !!,"DATE OF "_$S(SRFLG=1:"OPERATION",SRFLG=2:"PROCEDURE",1:"OP/PROCEDURE"),?23,"CASE #",?38,$S(SRSORT:"CLINIC",1:"SPECIALTY"),?61,"SCHED STATUS",!,"PATIENT NAME",?23,"PRINCIPAL PROCEDURE",!,"PATIENT ID (AGE)"
60 S (SRHDR,SRSUB)=0,SRPAGE=SRPAGE+1 W ! F I=1:1:IOM W "="
61 I SRSORT D:SRSPECN'="" SUBHD S SRNEW=0
62 Q
63REFILE ; re-file cases in PCE
64 N SRVISIT,SRVSIT K DIC S DIC=9.4,DIC(0)="XM",X="SURGERY" D ^DIC K DIC Q:Y=-1 S SRPKG=+Y
65 S (SRK,SRTN)=0,SRS="SURGERY DATA",SRFILE=1
66 F S SRTN=$O(^TMP("SR69",$J,SRTN)) Q:'SRTN D
67 .S (SRVISIT,SRVSIT)=$P(^SRF(SRTN,0),"^",15),SRV=$$DELVFILE^PXAPI("PRV^POV^CPT",SRVSIT)
68 .D UTIL^SROPCEP I 'SRK D
69 ..D TMP^SROPCEP
70 ..S SRVSIT=SRVISIT,SRV=$$DATA2PCE^PXAPI("^TMP(""SRPXAPI"",$J)",SRPKG,SRS,SRVSIT)
71 ..K ^TMP("SRPXAPI",$J)
72 Q
Note: See TracBrowser for help on using the repository browser.