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

SRONPEN.m

Go to the documentation of this file.
  1. SRONPEN ;B'HAM ISC/ADM - NON-O.R. PROCEDURE REPORT ; [ 07/26/04 9:50 AM ]
  1. ;;3.0; Surgery ;**132**;24 Jun 93
  1. I '$D(SRSITE) D ^SROVAR G:'$D(SRSITE) END S SRSITE("KILL")=1
  1. S SRSOUT=0 I '$D(SRTN) D NON G:'$D(SRTN) END S SRTN("KILL")=1
  1. I $P($G(^SRF(SRTN,"NON")),"^")'="Y" W !!,?5,"The case selected is not a Non-OR Procedure.",! D FOOT G END
  1. N SRAGE,SRDIV,SRHDR,SRLOC,SRPRINT,SRSEL,SRSINED,SRDTITL
  1. S SRDTITL="Procedure Report"
  1. DISPLY K %ZIS,IO("Q") S %ZIS="Q" D ^%ZIS I POP G END
  1. I $D(IO("Q")) K IO("Q") S ZTDESC="Procedure Report",ZTRTN="EN^SRONPEN",(ZTSAVE("SRSITE("),ZTSAVE("SRTN"))="" D ^%ZTLOAD G END
  1. EN D OPTOP^SRONP2(SRTN) S DFN=$P(^SRF(SRTN,0),"^"),VAINDT=$P(^SRF(SRTN,0),"^",9)
  1. S Y=$E(VAINDT,1,7) D D^DIQ S SRSDATE=Y D OERR^VADPT
  1. S SRHDR=" "_VADM(1)_" ("_VA("PID")_") Case #"_SRTN_" - "_SRSDATE
  1. S Y=$E($$NOW^XLFDT,1,12) D DD^%DT S SRPRINT="Printed: "_Y
  1. S SRLOC=" Pt Loc: "_$P(VAIN(4),"^",2)_" "_VAIN(5)
  1. S SRAGE="",Z=$P(VADM(3),"^") I Z S X=$E($P(^SRF(SRTN,0),"^",9),1,12),Y=$E(X,1,7),SRAGE=$E(Y,1,3)-$E(Z,1,3)-($E(Y,4,7)<$E(Z,4,7))
  1. S SRDIV=$$SITE^SROUTL0(SRTN) I SRDIV S X=$P(^SRO(133,SRDIV,0),"^"),SRDIV=$$EXTERNAL^DILFD(133,.01,"",X)
  1. S SRDIV=$S(SRDIV'="":SRDIV,1:SRSITE("SITE"))
  1. U IO S (SRPAGE,SRSOUT)=0,$P(SRLINE,"-",80)="" D HDR
  1. S SRI=0 F S SRI=$O(^TMP("SRNOR",$J,SRTN,SRI)) Q:'SRI D Q:SRSOUT
  1. .I $E(IOST)="P",$Y+11>IOSL D FOOT Q:SRSOUT D HDR
  1. .I $E(IOST)'="P",$Y+3>IOSL D FOOT Q:SRSOUT D HDR
  1. .W !,^TMP("SRNOR",$J,SRTN,SRI)
  1. D:'SRSOUT FOOT D END
  1. Q
  1. SRHDR S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT
  1. S Y=$E($P(^SRF(SRTN,0),"^",9),1,7) D D^DIQ S SRSDATE=Y
  1. S SRHDR=" "_VADM(1)_" ("_VA("PID")_") Case #"_SRTN_" - "_SRSDATE
  1. Q
  1. END K ^TMP("SRNOR",$J)
  1. W @IOF I $D(ZTQUEUED) Q:$G(ZTSTOP) S ZTREQ="@" Q
  1. D ^SRSKILL K VAIN,VAINDT I $D(SRSITE("KILL")) K SRSITE
  1. I $D(SRTN("KILL")) K SRTN
  1. D ^%ZISC
  1. Q
  1. NON ; select patient and case
  1. K DIC S DIC("A")="Select Patient: ",DIC=2,DIC(0)="QEAMZ" D ^DIC I Y<0 S SRSOUT=1 G END
  1. S DFN=+Y D DEM^VADPT S SRNM=VADM(1)
  1. W @IOF,!,"Non-O.R. Procedures for "_SRNM_" ("_VA("PID")_")" I $D(^DPT(DFN,.35)) S Y=$P(^(.35),"^") I Y D D^DIQ S Y=$P(Y,"@")_" "_$P(Y,"@",2) W !," (DIED ON "_Y_")"
  1. W !! S (SRDT,CNT)=0 F S SRDT=$O(^SRF("ADT",DFN,SRDT)) Q:'SRDT!$D(SRTN) S SROP=0 F S SROP=$O(^SRF("ADT",DFN,SRDT,SROP)) Q:'SROP!$D(SRTN) I $P($G(^SRF(SROP,"NON")),"^")="Y" D LIST
  1. SEL W !!!,"Select Procedure: " R X:DTIME I '$T!("^"[X) G END
  1. I '$D(SRCASE(X)) W !!,"Enter the number corresponding to the procedure for which you want to print",!,"a report." G SEL
  1. S SRTN=+SRCASE(X)
  1. Q
  1. LIST ; list case
  1. I $Y+5>IOSL S SRBACK=0 D SEL^SROPER Q:$D(SRTN)!(SRSOUT) W @IOF,!,?1,"NON-O.R. PROCEDURES FOR "_VADM(1)_" ("_VA("PID")_")",! I SRBACK S CNT=0,SROP=SRCASE(1)-1,SRDT=$P(SRCASE(1),"^",2)
  1. S CNT=CNT+1,SRSDATE=$P(^SRF(SROP,0),"^",9),SROPER=$P(^SRF(SROP,"OP"),"^"),SRCASE(CNT)=SROP
  1. K SROPS,MM,MMM S:$L(SROPER)<55 SROPS(1)=SROPER I $L(SROPER)>54 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
  1. S Y=SRSDATE D D^DIQ S SRSDATE=$P(Y,"@")_" "_$P(Y,"@",2)
  1. W !,CNT_".",?4,SRSDATE,?20,SROPS(1) I $D(SROPS(2)) W !,?20,SROPS(2) I $D(SROPS(3)) W !,?20,SROPS(3) I $D(SROPS(4)) W !,?20,SROPS(4)
  1. W !
  1. Q
  1. LOOP ; break procedure if greater than 55 characters
  1. S SROPS(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROPS(M))+$L(MM)'<55 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
  1. Q
  1. Q
  1. HDR ; heading
  1. I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
  1. S SRPAGE=SRPAGE+1 I $Y'=0 W @IOF
  1. W !,VADM(1)_" ("_VA("PID"),") Age: "_SRAGE,?(79-$L("PAGE "_SRPAGE)),"PAGE "_SRPAGE
  1. W !,"NON-O.R. PROCEDURE - CASE #"_SRTN,?52,SRPRINT,!,SRLINE,!
  1. Q