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

AMQQAPT.m

Go to the documentation of this file.
AMQQAPT ; IHS/CMI/THL - PATIENT APPOINTMENTS;
 ;;2.0;IHS PCC SUITE;**5**;MAY 14, 2009
 ;
APT(DFN,ADT,EDT,JOB) ;EP;
 ;CREATE AND DISPLAY LIST OF FUTURE APPOINTMENTS FOR A PATIENT
 ;DFN - PATIENT IEN
 ;CLN - CLINIC(S) TO INCLUDE
 ;ADT - START DATE
 ;EDT - END DATE
 ;JOB - $J
 ;AMQQCLN - CLINIC
 ;AMQQDT - DISPLAYED DATA
 ;AMQQPOV - APPT PURPOSE
 ;AMQQTYP - TYPE OF APPT
 ;
 N AMQQCLN,AMQQDT,AMQQPOV,AMQQTYP,POV
 N X,Y,Z
 S:'$G(JOB) JOB=$J
 S AMQQJOB=JOB
 S ADT=$$FMADD^XLFDT(DT,-1)  ;always start with yesterday
 S:'$G(EDT) EDT=9999999
 S ADT=ADT_".9999" ;start with last time yesterday
 F  S ADT=$O(^DPT(DFN,"S",ADT)) Q:'ADT!($P(ADT,".")>EDT)  S X=^(ADT,0) D
 .I $O(^TMP(AMQQJOB,"AMQQAPT","AMQQCLN",0)),$G(^TMP(AMQQJOB,"AMQQAPT","AMQQCLN"))'="ALL"&'$D(^TMP(AMQQJOB,"AMQQAPT","AMQQCLN",+X)) Q
 .S AMQQCLN=$E($P($G(^SC(+X,0)),U),1,15)
 .S AMQQDT=$E(ADT,4,5)_"/"_$E(ADT,6,7)_"/"_($E(ADT,1,3)+1700)
 .S AMQQTYP=+$P(X,U,16)
 .S AMQQTYP=$E($P($G(^SD(409.1,AMQQTYP,0)),U),1,15)
 .S AMQQPOV=$P(X,U,7)
 .I AMQQPOV D  I 1
 ..S AMQQPOV=$P($P($P(^DD(2.98,9,0),U,3),(AMQQPOV_":"),2),";")
 .E  S AMQQPOV="NOT STATED"
 .S AMQQPOV=$E(AMQQPOV,1,13)
 .S X=""
 .S $E(X,10)=AMQQDT
 .S $E(X,25)=AMQQCLN
 .S $E(X,42)=AMQQPOV
 .S $E(X,57)=AMQQTYP
 .S ^TMP($J,"AMQQAPT",DFN,ADT)=X
 .W !,X
 .S AMQQTOT=$G(AMQQTOT)+1
 .I AMQQTOT#(IOSL-6-(5*($E(IOST,1,2)="P-")))=1 D ^AMQQDOH I AMQP(AMQQOV)=99999999999 Q
 Q
QAPT ;EP;
 ;QUERY WHETHER TO INCLUDE PATIENT APPOINTMENTS IN QMAN DISPLAY
 NEW X,Y,X2
 D CAPT
 S AMQQJOB=$J
 K DIR
 S DIR(0)="YO"
 S DIR("A")="Include list of upcoming appts for the patient"
 S DIR("B")="NO"
 W !!
 D ^DIR
 K DIR
 I 'Y D CAPT Q
 S X1=DT
 S X2=365
 D C^%DTC
 S DIR(0)="D^::EF"
 S DIR("A")="End date for appointments to include.........."
 S DIR("B")=X
 S Y=X
 X ^DD("DD")
 S DIR("B")=Y
 D ^DIR
 K DIR
 I 'Y D CAPT Q
 S ^TMP($J,"AMQQAPT")=Y
 S AMQQEDT=Y
 S AMQQADT=DT-.0001
 K ^TMP($J,"AMQQAPT","AMQQCLN"),AMQQSTOP,CLN
 S DIR(0)="YO"
 S DIR("A")="Include appointments for all clinics.........."
 S DIR("B")="YES"
 D ^DIR
 K DIR
 I Y=1 S ^TMP($J,"AMQQAPT","AMQQCLN")="ALL" Q
 W !!
 F  D SC Q:$D(AMQQSTOP)
 K AMQSTOP
 Q:'$D(^TMP($J,"AMQQAPT","AMQQCLN"))
 Q
SC ;SELECT CLINICS AND CREATE CLINIC ARRAY
 K DIC
 S DIC="^SC("
 S DIC(0)="AMQEZ"
 S DIC("A")="Select"_$S($O(^TMP($J,"AMQQAPT","AMQQCLN",0)):" another",1:"")_" Clinic: "
 W !
 D ^DIC
 K DIC,DD,DR,DA
 I Y<1 S AMQQSTOP="" Q
 S ^TMP($J,"AMQQAPT","AMQQCLN",+Y)=""
 Q
CAPT ;CLEAN UP
 K AMQQDT,AMQQADT,AMQQEDT,AMQQCLN,AMQQPOV,AMQQTYP,AMQQJOB
 K ^TMP($J,"AMQQAPT")
 Q