source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDWARD.m@ 1147

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

initial load of WorldVistAEHR

File size: 2.1 KB
Line 
1SDWARD ;ALB/GRR - LIST INPATIENTS WITH PENDING APPTS ; 14 NOV 84
2 ;;5.3;Scheduling;**406**;Aug 13, 1993
3 S %DT(0)=-DT,%DT="AXE",%DT("A")="LIST PATIENTS WITH PENDING APPOINTMENTS ADMITTED ON DATE: " D ^%DT K %DT Q:Y<0 S SDY=Y D:'$D(DT) DT^SDUTL
4 S VAR="SDY",VAL=SDY,PGM="START^SDWARD" D ZIS^DGUTQ G:POP END
5 ;
6START K ^UTILITY("SD",$J),^TMP($J,"SDAMA301") U IO S Y=SDY D D^DIQ S SDPY=Y,Y=DT D D^DIQ S HY=Y
7 N SDLIST,SDCOUNT S SDCOUNT=0
8 F SDJ=SDY-.0001:0 S SDJ=$O(^DGPM("AMV1",SDJ)) Q:SDJ=""!(SDJ\1>SDY)!$D(SDERR) F DFN=0:0 S DFN=$O(^DGPM("AMV1",SDJ,DFN)) Q:DFN="" S SDLIST(DFN)=""
9 I $D(SDLIST)>1 D CHECK
10 I SDCOUNT<0 W !,$$SDAPIERR^SDAMUTDT D END Q ; SDAPI Returned an Error.
11 I '$D(^UTILITY("SD",$J)) W !,"NO PATIENTS FOUND" G END
12 D HED
13 S SDD=0 F SD=0:0 S SDD=$O(^UTILITY("SD",$J,SDD)) Q:SDD="" S DFN=$O(^UTILITY("SD",$J,SDD,0)) D PN F SDI=0:0 S SDI=$O(^UTILITY("SD",$J,SDD,DFN,SDI)) Q:SDI="" F SC=0:0 S SC=$O(^UTILITY("SD",$J,SDD,DFN,SDI,SC)) Q:SC="" D PRT
14 G END
15 ;
16CHECK N SDARRAY,SDDATE,SDDATA,SDNAME,SDCLIN,SDDFN
17 S SDARRAY(1)=DT,SDARRAY(3)="R;I",SDARRAY(4)="SDLIST(",SDARRAY("FLDS")="2;4",SDARRAY("SORT")="P"
18 S SDCOUNT=$$SDAPI^SDAMA301(.SDARRAY) Q:SDCOUNT'>0
19 S SDDFN="" F S SDDFN=$O(^TMP($J,"SDAMA301",SDDFN)) Q:SDDFN="" D
20 . S SDDATE="" F S SDDATE=$O(^TMP($J,"SDAMA301",SDDFN,SDDATE)) Q:SDDATE="" S SDDATA=$G(^(SDDATE)) D
21 ..S SDNAME=$P($P(SDDATA,U,4),";",2),SDCLIN=$P($P(SDDATA,U,2),";",1)
22 ..I $G(SDNAME)]"",$G(SDCLIN)]"" S ^UTILITY("SD",$J,SDNAME,SDDFN,SDDATE,SDCLIN)=""
23 Q
24 ;
25PRT D:$Y+2>IOSL HED
26 W !,?3,$S($D(^SC(SC,0)):$P(^(0),"^",1),1:"DELETED CLINIC")
27 S Y=SDI\1 D D^DIQ W ?50,Y," " S X=SDI D TM^SDROUT0 W ?61,$J(X,8)
28 Q
29 ;
30PN D:$Y+2>IOSL HED
31 D PID^VADPT6 W !,$E($P(^DPT(DFN,0),"^",1),1,25),?29,VA("PID") K VA("BID"),VA("PID") I $D(^DPT(DFN,.1)) W ?43,$P(^(.1),"^",1)
32 Q
33 ;
34HED W @IOF,!,"PATIENTS ADMITTED ",SDPY," WHO HAVE PENDING APPOINTMENTS",?66,HY,!,"PATIENT NAME",?32,"PT ID",?43,"WARD"
35 W !,?3,"CLINIC",?50,"APPNT DATE",?64,"TIME",! F I=1:1:79 W "-"
36 Q
37 ;
38END W !,@IOF K %DT,DFN,I,HY,SC,SD,SDD,SDI,SDJ,SDPY,SDY,X,Y,SDERR,PGM,POP,VA,VAL,VAR,^UTILITY("SD")
39 K ^TMP($J,"SDAMA301")
40 D CLOSE^DGUTQ,SDWARD^SDKILL
41 Q
Note: See TracBrowser for help on using the repository browser.