source: FOIAVistA/trunk/r/SURGERY-SR/SRHLVZSQ.m@ 711

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

initial load of FOIAVistA 6/30/08 version

File size: 2.2 KB
Line 
1SRHLVZSQ ;B'HAM ISC/PTD,DLR - Surgery Interface Sender of ZSQ Message ; [ 06/09/98 6:17 AM ]
2 ;;3.0; Surgery ;**41**;24 Jun 93
3 ; Per VHA Directive 10-93-142, this routine SHOULD NOT be modified.
4 ;VISTA Surgery system responds to QRY message with ZSQ message.
5 ;ZSQ can contain surgical data for a specified patient/date,
6 ;or all surgical cases (scheduled, requested,...) for a
7 ;specified date.
8 ;Variables defined when this module is called:
9 ;DFN - IEN in file #2 for a request of patient data.
10 ; - "" for a request of all cases
11 ;SRDT - Requested date in FileMan form
12 ;
13ZSQ(DFN,SRDT) ;query response message for patient or all cases on a given date
14 N BDT,CASE,EDT,FIND,HLCOMP,HLREP,HLSUB,SRI
15 S SRI=1,HLCOMP=$E(HLECH,1),HLREP=$E(HLECH,2),HLSUB=$E(HLECH,4),(HLMTN,HLSDT)="ZSQ"
16 ;Determine if data is available for requested date. If not, set HLERR and SRERR build error message and quit."
17 ;specified patient cases ONLY
18 S FIND=0 I $G(DFN)'="" D I FIND=0 S SRERR="No cases for the requested patient." Q
19 .S CASE=0 F S CASE=$O(^SRF("B",DFN,CASE)) Q:'CASE I $P($P(^SRF(CASE,0),"^",9),".")=SRDT S FIND=1 Q
20 ;all cases
21 I $G(DFN)="" D I FIND=0 S SRERR="No cases scheduled for date requested." Q
22 .S BDT=SRDT-.0001,EDT=SRDT+.9999 F S BDT=$O(^SRF("AC",BDT)) Q:'BDT!(BDT>EDT)!($G(FIND)=1) S CASE=0 F S CASE=$O(^SRF("AC",BDT,CASE)) Q:'CASE!($G(FIND)=1) S:$P($G(^SRF(CASE,31)),U,4) FIND=1
23PROCESS ;Data exists for the requested date.
24 S SRAC="AA" D MSA^SRHLVUO(.SRI,SRAC)
25 S BDT=SRDT-.0001,EDT=SRDT+.9999 F S BDT=$O(^SRF("AC",BDT)) Q:'BDT!(BDT>EDT) S CASE=0 F S CASE=$O(^SRF("AC",BDT,CASE)) Q:'CASE D
26 .;all patient cases for a requested date
27 .I $G(DFN)'="" Q:DFN'=+$P(^SRF("AC",BDT,CASE),"^") D MSG
28 .;all cases for a requested date
29 .I $G(DFN)="" S DFN=$P(^SRF(CASE,0),"^") D MSG S DFN=""
30 Q
31 ;
32MSG ;Send ZSQ message.
33 N SREVENT,SRSTATUS,SROERR
34 S (SREVENT,SRSTATUS)=""
35 S SROERR=CASE D STATUS^SROERR0
36 D ZCH^SRHLVUO1(.SRI,.SREVENT,.SRSTATUS)
37 D PID^SRHLVUO(.SRI)
38 D OBX^SRHLVUO(.SRI)
39 D DG1^SRHLVUO(.SRI)
40 D AL1^SRHLVUO(.SRI)
41 D ZIS^SRHLVUO2(.SRI)
42 D ZIG^SRHLVUO1(.SRI)
43 D ZIP^SRHLVUO1(.SRI)
44 D ZIL^SRHLVUO1(.SRI)
45 Q
46 ;
47ERR(SRAC,SRERR) ;Error found, transmit error message.
48 N SRI
49 K ^TMP("HLS",$J)
50 S SRI=1
51 D MSA^SRHLVUO(.SRI,SRAC)
52 D ERR^SRHLVUO(.SRI,SRERR)
53 Q
Note: See TracBrowser for help on using the repository browser.