source: FOIAVistA/tag/r/SURGERY-SR/SRHLVZQR.m@ 1337

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

initial load of FOIAVistA 6/30/08 version

File size: 2.4 KB
Line 
1SRHLVZQR ;B'HAM ISC/PTD,DLR - Surgery Interface Sender of SQR 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 SQM message with SQR message.
5 ;SQR 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 ;
13ZQR(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(HL("ECH"),1),HLREP=$E(HL("ECH"),2),HLSUB=$E(HL("ECH"),4),(HLMTN,HLSDT)="ZQR"
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 HLERR="No cases for the requested patient.",SRERR="QRD"_HLCOMP_"8"_HLCOMP_HLCOMP_HLERR,SRAC="AE" D ERR(SRAC,SRERR) 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 HLERR="No cases scheduled for date requested.",SRERR="QRF"_HLCOMP_"2"_HLCOMP_HLCOMP_HLERR,SRAC="AE" D ERR(SRAC,SRERR) 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 ZQR message.
33 N SREVENT,SRSTATUS,SROERR
34 S (SREVENT,SRSTATUS)=""
35 S SROERR=CASE D STATUS^SROERR0
36 D ZCH^SRHLVUO1(.SRI,.SREVENT,.SRSTATUS,"HLA")
37 D PID^SRHLVUO(.SRI,"HLA")
38 D DG1^SRHLVUO(.SRI,"HLA")
39 D AL1^SRHLVUO(.SRI,"HLA")
40 D OBX^SRHLVUO(.SRI,"HLA")
41 D ZIS^SRHLVUO2(.SRI,"HLA")
42 D ZIG^SRHLVUO1(.SRI,"HLA")
43 D ZIP^SRHLVUO1(.SRI,"HLA")
44 D ZIL^SRHLVUO1(.SRI,"HLA")
45 Q
46 ;
47ERR(SRAC,SRERR) ;Error found, transmit error message.
48 N SRI
49 K ^TMP("HLA",$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.