source: FOIAVistA/tag/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFCCOPT.m@ 1093

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

initial load of FOIAVistA 6/30/08 version

File size: 3.1 KB
Line 
1VAFCCOPT ;ALB/CM/PHH/EG/GAH OUTPATIENT APPT (HL7 MESS) NIGHT JOB ; 10/18/06
2 ;;5.3;Registration;**91,298,568,585,725**;Jun 06, 1996;Build 12
3 ;hl7v1.6
4 ;This routine will loop through the Hospital Location file "S" node
5 ;and generate an HL7-v2.3 A08 message for all appointments for today
6 ;that have a status of "No action taken" or "Future"
7 ;the HL7 message is not batch.
8 ;
9 ;07/07/00 ACS - Added sequence 39 (facility+suffix) to the outpatient
10 ;string of fields
11 ;
12 ;Check to see if sending v2.3 is on or off
13EN I '$P($$SEND^VAFHUTL(),"^",2) Q
14 ;
15 S ERRB="^TMP($J,""ADT-ERR"","
16 ;
17 N STAT,X1,X2
18 ;This job should be set to run after midnight daily.
19 D NOW^%DTC S START=X
20 S X1=START,X2=1 D C^%DTC S STOP=X K X1,X2,%H,X,%,%I
21 S ENT=0,GBL="^TMP(""HLS"",$J)"
22 ;
23 K HL D INIT^HLFNC2("VAFC ADT-A08-SCHED SERVER",.HL)
24 I $D(HL)=1 DO QUIT
25 .I $P(HL,"^",2)="Server Protocol Disabled"
26 .E S @ERRB@(1)=HL D EBULL^VAFHUTL2("","","",ERRB)
27 ;
28 S PSTR="2,3,7,10,18,39,44,50"
29 ;
30 N DGARRAY,DGCNT
31 S COUNT=0
32 F S ENT=$O(^SC(ENT)) Q:(ENT="")!(ENT'?.N) D
33 .S ENT1=START
34 .S DGARRAY(1)=START_";"_STOP,DGARRAY("FLDS")="1;3",DGARRAY(2)=ENT
35 .S DGCNT=$$SDAPI^SDAMA301(.DGARRAY)
36 .;
37 .I DGCNT>0 S DFN=0 F S DFN=$O(^TMP($J,"SDAMA301",ENT,DFN)) Q:DFN="" D
38 ..Q:'$D(^DPT(DFN,0))
39 ..S ENT1=0 F S ENT1=$O(^TMP($J,"SDAMA301",ENT,DFN,ENT1)) Q:ENT1=""!(ENT1'?.N1".".N) D
40 ...S STAT=$P($P(^TMP($J,"SDAMA301",ENT,DFN,ENT1),"^",3),";")
41 ...I STAT="NT" S ERR=$$CREATE() I +ERR>0 S VPTR=$P(ERR,"^",6) D GEN
42 ...I +$G(ERR)<0 S @ERRB@(1)=ERR D EBULL^VAFHUTL2("","","",ERRB)
43 .I DGCNT'=0 K ^TMP($J,"SDAMA301")
44 D EXIT
45 Q
46 ;
47GEN I COUNT DO ;first time through its been done
48 . K HL D INIT^HLFNC2("VAFC ADT-A08-SCHED SERVER",.HL)
49 . I $D(HL)=1 DO
50 . . S @ERRB@(1)=HL D EBULL^VAFHUTL2("","","",ERRB)
51 I $D(HL)=1 S ENT="ZZZZEND",ENT1=9999999,ENT2=9999999 Q
52 ;
53 ;
54 ;Generate the following segments:
55 ;EVN
56 S EVN=$$EVN^VAFHLEVN("A08","05")
57 I +EVN=-1 S ERR="-1^Unable to generate EVN segment" Q
58 ;PID
59 S VAFPID=$$EN^VAFCPID(DFN,"2,3,4,5,6,7,8,9,11,12,13,14,16,19,29,30")
60 ;ZPD
61 S ZPD=$$EN^VAFHLZPD(DFN,"2,3,4,5,6,7,8,9,10,11,12,13,14,15")
62 ;PV1 (outpatient)
63 S PV1=$$OUT^VAFHLPV1(DFN,EVENT,EVDT,VPTR,PSTR)
64 I +PV1=-1 S ERR="-1^Unable to generate PV1 segment" Q
65 ;
66 ; no dg1 segment will be created. No diagnosis
67 ; information will be known at this stage.
68 S COUNT=1
69 K ^TMP("HLS",$J)
70 ;
71 ;
72 S @GBL@(COUNT)=EVN,COUNT=COUNT+1
73 MERGE @GBL@(COUNT)=VAFPID S COUNT=COUNT+1
74 S @GBL@(COUNT)=ZPD,COUNT=COUNT+1
75 S @GBL@(COUNT)=PV1
76 ;
77 D GENERATE^HLMA("VAFC ADT-A08-SCHED SERVER","GM",1,,.HLRST)
78 I $L($P(HLRST,2,99)) DO
79 . S @ERRB@(1)=HLRST D EBULL^VAFHUTL2("","","",ERRB)
80 . S ERRCNT=$G(ERRCNT)+1
81 . I $G(ERRCNT)>10 S ENT="ZZZZEND",ENT1=9999999,ENT2=9999999
82 Q
83 ;
84EXIT K HLERR
85 ;
86 D KILL^HLTRANS
87 K ERRCNT,VAFPID,^TMP("HLS",$J),SEQ,RESULT,MID
88 K PSTR,ZPD,DG1,PID,PV1,MSH,EVN,ENT,ENT1,ENT2,DFN,START,STOP,GBL,HLSDT
89 K EVDT,HLMTN,EVENT,COUNT,HLEVN,HLENTRY,ERR,VPTR,ERRB
90 Q
91 ;
92CREATE() ;
93 ;creates new entry in pivot file
94 N NODE,VPTR
95 S EVDT=ENT1,VPTR=DFN_";DPT("
96 S NODE=$$PIVNW^VAFHPIVT(DFN,EVDT,2,VPTR)
97 I +NODE=-1 Q NODE
98 S EVENT=$P(NODE,":")
99 Q EVENT_"^"_NODE
Note: See TracBrowser for help on using the repository browser.