source: WorldVistAEHR/trunk/r/SURGERY-SR/SROUTUP.m@ 1396

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

initial load of WorldVistAEHR

File size: 2.7 KB
Line 
1SROUTUP ;B'HAM ISC/MAM - UPDATE UTILIZATION FILE ; [ 07/27/98 2:33 PM ]
2 ;;3.0; Surgery ;**50**;24 Jun 93
3 S X="T-1" D ^%DT S SRDTOLD=Y,X="T+6" D ^%DT S SRDTNEW=Y
4 I '$D(^SRU(SRDTNEW)) K DA,DIC,DD,DO,DA S (X,DINUM)=SRDTNEW,DIC="^SRU(",DIC(0)="L",DLAYGO=131.8 D FILE^DICN K DIC,DLAYGO
5 I '$O(^SRU(SRDTNEW,1,0)) S ^SRU(SRDTNEW,1,0)="^131.81PA^0^0"
6 S SROR=0 F S SROR=$O(^SRS(SROR)) Q:'SROR I '$D(^SRU(SRDTNEW,1,SROR,0)),'$P(^SRS(SROR,0),"^",6) D OR
7 D END
8 Q
9 I '$O(^SRU(SRDTOLD,2,0))!($D(^HOLIDAY(SRDTOLD,0))) D SPEC Q
10 I $D(^HOLIDAY(SRDTNEW,0)) S SRHOLID=1,SRSITE=0 F S SRSITE=$O(^SRO(133,SRSITE)) Q:'SRSITE I $D(^SRO(133,SRSITE,3,SRDTNEW,0)) S SRHOLID=0
11 I '$O(^SRU(SRDTNEW,2,0)) S ^SRU(SRDTNEW,2,0)="^131.82PA^0^0",SRSS=0 F S SRSS=$O(^SRU(SRDTOLD,2,SRSS)) Q:'SRSS D SPOLD
12END K SRSITE D ^SRSKILL
13 Q
14OR ; set operating room times
15 S SRSITE=$P(^SC($P(^SRS(SROR,0),"^"),0),"^",4) S:SRSITE SRSITE=$O(^SRO(133,"B",SRSITE,0))
16 S (SRST,SRET,SRACT)="" I $D(^HOLIDAY(SRDTNEW,0)),SRSITE,'$D(^SRO(133,SRSITE,3,SRDTNEW,0)) S SRACT="Y" D SETOR Q
17 I $D(^HOLIDAY(SRDTNEW,0)),'SRSITE S SRACT="Y" D SETOR Q
18 S X=SRDTNEW D H^%DTC S SRDAY=%Y,SRWD=$O(^SRS(SROR,4,"B",SRDAY,0)) I 'SRWD D OLDOR,SETOR Q
19 I $P(^SRS(SROR,4,SRWD,0),"^",2) S SRST=SRDTNEW_"."_$P(^SRS(SROR,4,SRWD,0),"^",2),SRST=+SRST
20 I SRST,$P(^SRS(SROR,4,SRWD,0),"^",3) S SRET=SRDTNEW_"."_$P(^(0),"^",3),SRET=+SRET
21 I SRST,'SRET S SRST=""
22 I $P(^SRS(SROR,4,SRWD,0),"^",4) S SRACT="Y"
23 I SRACT'="Y",'SRST D OLDOR
24SETOR S X=^SRU(SRDTNEW,1,0),$P(^(0),"^",3)=SROR,$P(^(0),"^",4)=$P(X,"^",4)+1
25 S ^SRU(SRDTNEW,1,SROR,0)=SROR_"^"_SRST_"^"_SRET_"^"_SRACT
26 Q
27OLDOR I '$D(^SRU(SRDTOLD,1,SROR,0))!($D(^HOLIDAY(SRDTOLD,0))) S SRST=SRDTNEW_".07",SRET=SRDTNEW_".17" Q
28 S X=^SRU(SRDTOLD,1,SROR,0),SRST=$P(X,"^",2),SRET=$P(X,"^",3),SRACT=$P(X,"^",4)
29 S SRST=$S(SRST:SRDTNEW_"."_$P(SRST,".",2),1:""),SRET=$S(SRET:SRDTNEW_"."_$P(SRET,".",2),1:"")
30 Q
31SPOLD ; set specialty times from previous week
32 S X=^SRU(SRDTOLD,2,SRSS,0),SRST=$P(X,"^",2),SRET=$P(X,"^",3),SRACT=$P(X,"^",4)
33 S SRST1=$S(SRST:SRDTNEW_"."_$P(SRST,".",2),1:"")
34 S SRET1=$S(SRET:SRDTNEW_"."_$P(SRET,".",2),1:"")
35 I $D(^HOLIDAY(SRDTNEW,0)),SRHOLID S (SRST1,SRET1)="",SRACT="Y"
36 S X=^SRU(SRDTNEW,2,0),$P(^(0),"^",3)=SRSS,$P(^(0),"^",4)=$P(X,"^",4)+1
37 S ^SRU(SRDTNEW,2,SRSS,0)=SRSS_"^"_SRST1_"^"_SRET1_"^"_SRACT
38 Q
39SPEC ; set specialty times if times from last week not used
40 I $O(^SRU(SRDTNEW,2,0)) Q
41 S ^SRU(SRDTNEW,2,0)="^131.82PA^0^0"
42 S SRHOLID=0
43 I $D(^HOLIDAY(SRDTNEW,0)) S SRHOLID=1,SRSITE=0 F S SRSITE=$O(^SRO(133,SRSITE)) Q:'SRSITE I $D(^SRO(133,SRSITE,3,SRDTNEW,0)) S SRHOLID=0
44 S SRHRS=$S(SRHOLID:"^^^Y",1:"^"_SRDTNEW_".07^"_SRDTNEW_".17^")
45 S SRSS=0 F S SRSS=$O(^SRO(137.45,SRSS)) Q:'SRSS S ^SRU(SRDTNEW,2,SRSS,0)=SRSS_SRHRS,X=$P(^SRU(SRDTNEW,2,0),"^",4),$P(^(0),"^",3)=SRSS,$P(^(0),"^",4)=X+1
46 Q
Note: See TracBrowser for help on using the repository browser.