source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFHLFNC.m@ 1520

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

initial load of WorldVistAEHR

File size: 2.0 KB
RevLine 
[613]1VAFHLFNC ;ALB/MLI - Generic functions for MAS HL7 Interface ; 27 Feb 93
2 ;;5.3;Registration;**33,122**;Aug 13, 1993
3 ;
4 ; This routine contains generic MAS functions used to interface with
5 ; the DHCP HL7 package
6 ;
7ADDR(VAFADDR,VAFCOUNT) ; returns address in HL7 format
8 ;
9 ; NOTE: THIS MAY BE REPLACED WITH AN HL7 CALL IN THE FUTURE
10 ;
11 ; Input - VAFADDR as address in format:
12 ; line1^line2^line3^city^state^zip
13 ; VAFCOUNT as internal value of county (optional)
14 ;
15 ; ****Also assumes all HL7 variables returned from****
16 ; INIT^HLTRANS are defined
17 ;
18 ; Output - HL7 formated Address_HLFS_County Code (if requested)
19 ;
20 N X,Y
21 S X=$E(HLECH) ; first component separator
22 S $P(Y,X,1)=$P(VAFADDR,"^",1) ; line 1
23 S $P(Y,X,2)=$P(VAFADDR,"^",2)_$S($P(VAFADDR,"^",3)]"":" "_$P(VAFADDR,"^",3),1:"") ; lines 2 & 3
24 S $P(Y,X,3)=$P(VAFADDR,"^",4),$P(Y,X,5)=$P(VAFADDR,"^",6) ; city,zip
25 S $P(Y,X,4)=$P($G(^DIC(5,+$P(VAFADDR,"^",5),0)),"^",2) ; state abbr
26 I $G(VAFCOUNT) D ; county
27 .S $P(Y,HLFS,2)=$P($G(^DIC(5,+$P(VAFADDR,"^",5),1,+$G(VAFCOUNT),0)),"^",3)
28 .I $P(Y,HLFS,2)']"" S $P(Y,HLFS,2)=HLQ
29 I $P(Y,HLFS,1)=(X_X_X_X) S $P(Y,HLFS,1)=HLQ ; if no data...only component separator
30 Q Y
31 ;
32 ;
33INS(DFN,VAFDT) ; call to see if pt has active insurance
34 ;
35 ; Input - DFN as internal entry number of PATIENT file
36 ; VAFDT [optional] as date to compute ins coverage for
37 ;
38 ; Output - 1 if yes, 0 if no
39 ;
40INSQ Q $$INSURED^IBCNS1(DFN,$G(VAFDT))
41 ;
42 ;
43YN(X) ; extrinsic function to convert YES/NO responses to 1/0
44 ; (format of MAS-HL7 table VA01)
45 ;
46 ; Input - X as value of DHCP yes/no field
47 ;
48 ; Output - 1 if yes, 0 if no, or "" otherwise
49 ;
50 S X=$TR($E(X),"Yy1Nn0","111000")
51 Q $S(X=1:X,X=0:0,1:HLQ)
52 ;
53STATION(INSTPTR) ;
54 ;Description: Returns the facility number, including the suffix.
55 ;
56 ;Input:
57 ; INSTPTR - ien, record in the INSTITUTION file
58 ;Output:
59 ; Function value - If unsuccessful, returns NULL, otherwise the facility number, including suffix
60 ;
61 Q:'$G(INSTPTR) ""
62 Q $P($G(^DIC(4,INSTPTR,99)),"^",1)
Note: See TracBrowser for help on using the repository browser.