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

SDWARD.m

Go to the documentation of this file.
SDWARD ;ALB/GRR - LIST INPATIENTS WITH PENDING APPTS ; 14 NOV 84
 ;;5.3;Scheduling;**406**;Aug 13, 1993
 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
 S VAR="SDY",VAL=SDY,PGM="START^SDWARD" D ZIS^DGUTQ G:POP END
 ;
START 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
 N SDLIST,SDCOUNT S SDCOUNT=0
 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)=""
 I $D(SDLIST)>1 D CHECK
 I SDCOUNT<0 W !,$$SDAPIERR^SDAMUTDT D END Q  ; SDAPI Returned an Error.
 I '$D(^UTILITY("SD",$J)) W !,"NO PATIENTS FOUND" G END
 D HED
 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
 G END
 ;
CHECK N SDARRAY,SDDATE,SDDATA,SDNAME,SDCLIN,SDDFN
 S SDARRAY(1)=DT,SDARRAY(3)="R;I",SDARRAY(4)="SDLIST(",SDARRAY("FLDS")="2;4",SDARRAY("SORT")="P"
 S SDCOUNT=$$SDAPI^SDAMA301(.SDARRAY) Q:SDCOUNT'>0
 S SDDFN="" F  S SDDFN=$O(^TMP($J,"SDAMA301",SDDFN)) Q:SDDFN=""  D
 . S SDDATE="" F  S SDDATE=$O(^TMP($J,"SDAMA301",SDDFN,SDDATE)) Q:SDDATE=""  S SDDATA=$G(^(SDDATE)) D
 ..S SDNAME=$P($P(SDDATA,U,4),";",2),SDCLIN=$P($P(SDDATA,U,2),";",1)
 ..I $G(SDNAME)]"",$G(SDCLIN)]"" S ^UTILITY("SD",$J,SDNAME,SDDFN,SDDATE,SDCLIN)=""
 Q
 ;
PRT D:$Y+2>IOSL HED
 W !,?3,$S($D(^SC(SC,0)):$P(^(0),"^",1),1:"DELETED CLINIC")
 S Y=SDI\1 D D^DIQ W ?50,Y," " S X=SDI D TM^SDROUT0 W ?61,$J(X,8)
 Q
 ;
PN D:$Y+2>IOSL HED
 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)
 Q
 ;
HED W @IOF,!,"PATIENTS ADMITTED ",SDPY," WHO HAVE PENDING APPOINTMENTS",?66,HY,!,"PATIENT NAME",?32,"PT ID",?43,"WARD"
 W !,?3,"CLINIC",?50,"APPNT DATE",?64,"TIME",! F I=1:1:79 W "-"
 Q
 ;
END W !,@IOF K %DT,DFN,I,HY,SC,SD,SDD,SDI,SDJ,SDPY,SDY,X,Y,SDERR,PGM,POP,VA,VAL,VAR,^UTILITY("SD")
 K ^TMP($J,"SDAMA301")
 D CLOSE^DGUTQ,SDWARD^SDKILL
 Q