source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSDA.m@ 632

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

revised back to 6/30/08 version

File size: 2.1 KB
Line 
1GMTSDA ; SLC/DLT,KER/NDBI - Appointments ; 02/27/2002 [4/14/04 1:53pm]
2 ;;2.7;Health Summary;**5,19,28,49,70**;Oct 20, 1995;Build 5
3 ;
4 ; External Reference
5 ; DBIA 1024 ^DIC(40.7
6 ; DBIA 10040 ^SC(
7 ; DBIA 2065 ^SCE(
8 ; DBIA 2065 ^SCE("ADFN"
9 ; DBIA 2929 CVP^A7RHSM
10 ; DBIA 10061 SDA^VADPT
11 ;
12PAST ; Gets Patient's Past Appointments for date range
13 N GMDT,GMIDT,MAX S X=1
14 S VASD("F")=$S(GMTSBEG=1:2560101,1:GMTSBEG),VASD("T")=$S(GMTS1=6666666:DT,1:9999999-GMTS1)
15 S MAX=$S(+($G(GMTSNDM))>0:+($G(GMTSNDM)),1:99999)
16 S VASD("W")=123456789 D SDA^VADPT
17 I VAERR=2 D CKP^GMTSUP W "DATABASE NOT AVAILABLE",! D END Q
18 S (YCNT,Y)=0 F S Y=$O(^UTILITY("VASD",$J,Y)) Q:'Y S YCNT=YCNT+1,ADATE=$P(^(Y,"I"),U,1),^UTILITY("GMTSVASD",$J,9999999-ADATE)=ADATE_U_$P(^UTILITY("VASD",$J,Y,"E"),U,2,99)
19 S GMDT=VASD("F")
20 F S GMDT=$O(^SCE("ADFN",DFN,GMDT)) Q:GMDT'>0!(GMDT>VASD("T")) D
21 . S GMI=0 F S GMI=$O(^SCE("ADFN",DFN,GMDT,GMI)) Q:GMI'>0 D
22 . . S GMIDT=9999999-GMDT
23 . . I '$D(^UTILITY("GMTSVASD",$J,GMIDT)) D
24 . . . Q:$P($G(^SCE(GMI,0)),U,6)'=""
25 . . . I $P($G(^SCE(GMI,0)),U,4) Q:$P($G(^SC($P(^SCE(GMI,0),U,4),"OOS")),U)
26 . . . S ^UTILITY("GMTSVASD",$J,GMIDT)=GMDT_U_$S(+$P(^SCE(GMI,0),U,4):$P($G(^SC(+$P(^(0),U,4),0)),U),1:$P($G(^DIC(40.7,$P(^SCE(GMI,0),U,3),0)),U))_U_"UNSCHEDULED"
27 D:$$ROK^GMTSU("A7RHSM")&($$NDBI^GMTSU) CVP^A7RHSM
28 I '$D(^UTILITY("GMTSVASD",$J)) D END Q
29 S IDATE="",YCNT=0
30 F S IDATE=$O(^UTILITY("GMTSVASD",$J,IDATE)) Q:+IDATE'>0!(YCNT=MAX) D
31 . S ADATE=+^(IDATE),ADATE(0)=^(IDATE) D PRINT S YCNT=YCNT+1
32 D END Q
33FUTURE ; Gets Patient's Future Appointments
34 D SDA^VADPT N MAX S MAX=$S(+($G(GMTSNDM))>0:+($G(GMTSNDM)),1:99999)
35 I VAERR=2 D CKP^GMTSUP W "DATABASE NOT AVAILABLE",! D END Q
36 S (YCNT,Y)=0 F S Y=$O(^UTILITY("VASD",$J,Y)) Q:'Y S YCNT=YCNT+1,ADATE=$P(^(Y,"I"),U,1),ADATE(0)=^UTILITY("VASD",$J,Y,"E") D PRINT Q:YCNT=MAX
37 D END Q
38PRINT ; Output
39 D CKP^GMTSUP Q:$D(GMTSQIT) S X=ADATE D REGDTM4^GMTSU,CKP^GMTSUP
40 W X,?18,$E($P(ADATE(0),"^",2),1,25),?58,$E($P(ADATE(0),"^",3),1,21)
41 W ! Q
42END ; Clean-up and Quit
43 K %I,IDATE,IDATES,ADATE,VASD,X,Y,YCNT,Z,^UTILITY("VASD",$J),^UTILITY("GMTSVASD",$J) Q
Note: See TracBrowser for help on using the repository browser.