source: WorldVistAEHR/trunk/r/AUTOMATED_MED_INFO_EXCHANGE-DVBA-DVBC/DVBCLKTL.m@ 1582

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

initial load of WorldVistAEHR

File size: 4.1 KB
Line 
1DVBCLKTL ;ALB/GTS-AMIE C&P APPT LINK MNGT ROUTINE ; 10/20/94 10:30 PM
2 ;;2.7;AMIE;**1**;Apr 10, 1995
3 ;
4 ;** NOTICE: This routine is part of an implementation of a Nationally
5 ;** Controlled Procedure. Local modifications to this routine
6 ;** are prohibited per VHA Directive 10-93-142
7 ;
8 ;** Version Changes
9 ; 2.7 - New routine (Enhc 13)
10 ;
11EN ;** Main entry point
12 K ^TMP("DVBC",$J)
13 D HOME^%ZIS
14 K DVBASUPR
15 S:$D(^XUSEC("DVBA C SUPERVISOR",DUZ)) DVBASUPR=""
16 ;** Select a C&P patient
17 F D HDR S DVBADFN=$$REQPAT^DVBCUTL5 D:+DVBADFN>0 MAINPROC Q:+DVBADFN'>0
18 K DVBASUPR,DVBADFN
19 Q
20 ;
21MAINPROC ;
22 D CPPATARY^DVBCUTL5(DVBADFN) ;**^TMP - array of 2507's for patient
23 I +DVBACNT=1 D AUTO2507 ;**S/W select the 2507 if only one exists
24 I +DVBACNT>1 D USEL2507 ;**More than 1 2507 exists, user selects
25 S:'$D(DVBADA) DVBADA=""
26 I '$D(^DVB(396.3,+DVBADA,0)) D NO2507^DVBCUTL5 ;**No 2507 sel'd, error
27 ;
28 ;** If 2507 selected, allow link adjustment
29 I $D(^DVB(396.3,+DVBADA,0)) DO ;**Output current appointments
30 .D EXMDISP^DVBCUTL6(DVBADA) ;**Display the exams
31 .S DIR(0)="FAO^1:1",DIR("A")="Hit Return to continue with appointment display."
32 .S DIR("A",1)=" " D ^DIR K DIR,X,Y
33 .F Q:($D(DVBAOUT)) DO
34 ..D APPTSEL^DVBCUTL6($P(^DVB(396.3,DVBADA,0),U,1),1,DVBADA,$P(^DVB(396.3,DVBADA,0),U,5))
35 ..I '$D(^TMP("DVBC",$J,2)),(DVBAAPT="") DO ;**No C&P appt's
36 ...D:'$D(DVBAOUT) NOAPTERR^DVBCLKT2
37 ..I '$D(DVBAAPT),($D(^TMP("DVBC",$J,2))) DO ;**No appt selected
38 ...D:'$D(DVBAOUT) APPTERR^DVBCLKT2
39 ..I $D(DVBAAPT),($D(^TMP("DVBC",$J,2))&(DVBAAPT="")) DO
40 ...D:'$D(DVBAOUT) APPTERR^DVBCLKT2
41 ..I $D(DVBAAPT),(DVBAAPT'="") DO
42 ...K DVBADEL
43 ...I $D(DVBASUPR),($D(^DVB(396.95,"AB",+DVBADA,$P(DVBAAPT,U,4)))) D DELCK^DVBCLKT2 DO
44 ....I $D(DVBADEL) D DODEL^DVBCLKT2
45 ...I '$D(DVBASUPR),($D(^DVB(396.95,"AB",+DVBADA,$P(DVBAAPT,U,4)))) DO DELERR^DVBCLKT2
46 ...I '$D(^DVB(396.95,"AB",+DVBADA,$P(DVBAAPT,U,4))),('$D(DVBADEL)) D LINKPROC
47 ..K DVBAMORE,DVBALP,DVBADT,DVBAORD,DVBASEL,DVBAAPT
48 ..K APPTSTAT,APPTNODE,DVBALKDA,DVBCADLK,DVBCOLAP,DVBADEL
49 K ^TMP("DVBC",$J),DVBAOUT,DVBADTOT,DVBAPNAM,DVBADA
50 Q
51 ;
52AUTO2507 ;If only 1 2507, select it
53 ;** DVBADA is the IEN of the selected 2507 request
54 N DVBADT,DVBAORD
55 S (DVBADT,DVBADA,DVBAORD)=""
56 S DVBAORD=$O(^TMP("DVBC",$J,DVBAORD))
57 S DVBADT=$O(^TMP("DVBC",$J,DVBAORD,DVBADT))
58 S DVBADA=$O(^TMP("DVBC",$J,DVBAORD,DVBADT,DVBADA))
59 K ^TMP("DVBC",$J)
60 Q
61 ;
62LINKPROC ;Link appt to 2507
63 D LNKQS^DVBCLKT2 ;**Add link or modify existing link
64 K DVBCADLK S:+Y=0 DVBCADLK="" S DVBAYVAL=Y K Y
65 N DVBAOUT S:$D(DTOUT) DVBAOUT=""
66 ;
67 ;** If Appt, either add to 396.95 or modify an existing link
68 ;** APPTNODE and APPTSTAT from 'S' node of appt selected to link
69 I $D(DVBCADLK),(DVBAYVAL'="^"),('$D(DVBAOUT)) DO ;**Add Link
70 .D STATCK^DVBCUTL7($P(DVBAAPT,U,4),DVBADFN) ;**Set APPTNODE,APPTSTAT
71 .S SAVESTAT=APPTSTAT
72 .I SAVESTAT["A" D ATRBCK^DVBCUTL7,ADDLK^DVBCUTL8 ;**Link lost: Auto-rbk
73 .I SAVESTAT'["A" D NOAUTO^DVBCUTL7,ADDLK^DVBCUTL8 ;**Link lost: non-auto
74 I '$D(DVBCADLK),(DVBAYVAL'="^"),('$D(DVBAOUT)) DO ;**Rebook Link
75 .S DVBAOLDA=$$SELLNK^DVBCUTL8(DVBADA)
76 .I +DVBAOLDA'>0,('$D(DVBANOLK)) D ERRMESS^DVBCLKT2
77 .I +DVBAOLDA>0 DO
78 ..S OLDSTAT=$P(^DPT(DVBADFN,"S",$P(^DVB(396.95,DVBAOLDA,0),U,3),0),U,2)
79 ..I OLDSTAT["P"!(OLDSTAT["N"&(OLDSTAT'="NT")) DO
80 ...S ^TMP("DVBC",$J,"VETERAN CANCELLATION")=1
81 ...S ^TMP("DVBC",$J,"VETERAN REQ APPT DATE")=$P(DVBAAPT,U,4)
82 ..D STATCK^DVBCUTL7($P(DVBAAPT,U,4),DVBADFN) ;**Set APPTNODE,APPTSTAT
83 ..S SAVESTAT=APPTSTAT ;**APPTNODE,APPTSTAT used in subroutines
84 ..I SAVESTAT["A" D ATRBCK^DVBCUTL7,FIXLK^DVBCUTL8 ;**Link lost:Auto-rbk
85 ..I SAVESTAT'["A" D NOAUTO^DVBCUTL7,FIXLK^DVBCUTL8 ;**Link lost:non-auto
86 K SAVESTAT,OLDSTAT,DVBAYVAL,DVBANOLK
87 Q
88 ;
89USEL2507 ;**User select 2507
90 D REQSEL^DVBCUTL5 ;**Select 2507 from ^TMP
91 I (+Y'>0)!($D(DVBAOUT)) S DVBADA=""
92 S:+Y>0 DVBASEL=+Y ;**Y selected 2507 value returned from ^DIR
93 D:+Y>0 FINDDA^DVBCUTL5 ;**Find selected 2507 DA (Return DVBADA)
94 K ^TMP("DVBC",$J)
95 Q
96 ;
97HDR ;** Veteran selection header
98 W @IOF,!!,?18,"AMIE/C&P Appointment Link Management",!!
99 I $D(DVBASUPR) W !,"As a Supervisor, you may remove 2507 appointment links",!!
100 Q
Note: See TracBrowser for help on using the repository browser.