source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDAMVSC.m@ 613

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1SDAMVSC ;;OIFO-BAY PINES/TEH - Appt Event Driver Utilities-Validate SC Appt type ; 12/1/91 [ 09/19/96 1:39 PM ] ; Compiled August 20, 2007 14:28:26
2 ;;5.3;Scheduling;**394,417,491**;Aug 13, 1993;Build 53
3 ;
4 ;
5 ;***************************************************************************************************************************
6 ;
7 ; ***** NOTE *****
8 ;
9 ;This software was created to be used with the SCHEDULING V5.3 appointment management package. The SRA API (SDAMA301)
10 ;was employed to retrieve data from the PATIENT APPOINTMENT file (2.98) due inpart to VA Fileman non-compliance.
11 ;
12 ;DBIA #4433 SUBSCRIPTION
13 ;
14 ;
15 ;Entry Point EN. This routine requires the OUTPATIENT ENOUNTER IEN (variable SDOE)
16 ;
17 ;GLOBALS: ^SCE(IEN,0) (#.1) APPOINTMENT TYPE [10P:409.1]
18 ; ^DPT(IEN,"S",DATE,0) ^ (#9.5) APPOINTMENT TYPE [16P:409.1]
19 ; ^SD(409.41,0)=OUTPATIENT CLASSIFCATION TYPE "Was treatment for SC Condition? " QUESTION FOR CHECKOUT.
20 ;
21 ;PROTOCOLS: This routine is called from the SDAM APPOINTMENT EVENTS.
22 ;
23 ;This validates that both the OUTPATIENT ENCOUNTER and the PATIENT SCHEDULING NODES for APPOINTMENT TYPE are (pointer to
24 ;409.1 APPOINTMENT TYPE) are set to the "SERVICE CONNECTED" appointment type when the response to the CLASSIFICATION TYPE
25 ;"Was treatment for SC Condition?" question is answered "YES". If the question is answered "NO" and the APPOINTMENT TYPE
26 ;is SERVICE CONNECTED, then the APPOINTMENT TYPE is reverted to REGULAR.
27 ;
28 ;
29 ;****************************************************************************************************************************
30 Q
31EN ;Entry Point
32 Q:'$G(SDOE)
33 N SDN,SDVSCL,SDVSTD,SDAPDF,SDDPTYP,SDOED,SDVSTD,SDVDPTD,SDVSCD,SDSCV,SDAPPTY,SDAPDT,SDDFN,SDVSTD,SDIENS,SDARRAY,SDAPDF
34 S SDOED=$G(^SCE(SDOE,0)) Q:SDOED=""
35 S SDDFN=$P(SDOED,U,2),SDAPDT=$P(SDOED,U)
36 ;GET APPOINTMENT FROM EVENT OUTPUT ARRAY
37 I $G(^TMP("SDAMEVT",$J,"AFTER","DPT")) S SDAPDPT=$P($G(^TMP("SDAMEVT",$J,"AFTER","DPT")),"^",16)
38 E S SDAPDPT=$P(SDOED,"^",10) ;APP TYPE
39 S SDVSCL=$P(SDOED,U,4)
40 S SDVSTD=$P(SDOED,U,5)
41 Q:'SDVSTD ; ticket #194210 ; do not proceed if no pointer to a visit
42 Q:'$D(^AUPNVSIT(SDVSTD,800))
43 S SDSCV=+$$GET1^DIQ(9000010,SDVSTD_",",80001,"I") ;SC flag in Visit file
44 S SDAPDF=$$GET1^DIQ(44,SDVSCL_",",2507,"I") ;default appt type
45 ;find if credit stop secondary visit exists.
46 N SDVSTDS,SDOE1 S SDOE1="" S SDVSTDS=$O(^AUPNVSIT("AD",SDVSTD,""))
47 I SDVSTDS>0 S SDOE1=$O(^SCE("AVSIT",SDVSTDS,""))
48 I SDSCV I SDAPDPT'=11 S SDAPDPT=11 D APPT F SDE=SDOE,SDOE1 I SDE>0 D SCE(SDE)
49 I 'SDSCV I SDAPDPT=11 D D APPT F SDE=SDOE,SDOE1 I SDE>0 D SCE(SDE)
50 . I SDAPDF'="" S SDAPDPT=SDAPDF ; set to default if exists for this clinic
51 . E S SDAPDPT=9 ; set to regular
52 Q
53SCE(SDE) ;Set FDA for SCE(ien,0) OUTPATIENT ENCOUNTER
54 S SDIENS=SDE_"," K ^TMP("SDAMSCE",$J)
55 D FDA^DILF(409.68,SDIENS,.1,,SDAPDPT,"^TMP(""SDAMSCE"",$J)","^TMP(""SDAMSCE"",$J)")
56 I $D(^TMP("SDAMSCE",$J,"DIERR")) D Q
57 .W !,"Processing Error ",^TMP("SDAMSCE",$J,"DIERR",1) Q
58 D FILE^DIE(,"^TMP(""SDAMSCE"",$J)","^TMP(""SDAMSCE"",$J)")
59 Q
60APPT ;quit if clinic in event doesn't match clinic in ^DPT
61 ;set up app type in DPT
62 I +$G(^TMP("SDAMEVT",$J,"AFTER","DPT"))'=+$G(^DPT(SDDFN,"S",SDAPDT,0)) Q
63 I $D(^DPT(SDDFN,"S",SDAPDT,0)) S $P(^DPT(SDDFN,"S",SDAPDT,0),U,16)=SDAPDPT
64END Q
Note: See TracBrowser for help on using the repository browser.