source: WorldVistAEHR/trunk/r/E_CLAIMS_MGMT_ENGINE-BPS/BPSJUTL.m@ 1005

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

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1BPSJUTL ;BHAM ISC/LJF - e-Pharmacy Utils ;16-OCT-2003
2 ;;1.0;E CLAIMS MGMT ENGINE;**1,2,5**;JUN 2004;Build 45
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 Q
6 ;
7HLP(PROTOCOL) ; Find the Protocol IEN
8 Q +$O(^ORD(101,"B",PROTOCOL,0))
9 ;
10VAHL7ECH(HL) ; Hl7 Encoding Characters
11 S FS=$G(HL("FS")) I FS="" S FS="|"
12 S ECH=$G(HL("ECH")) I ECH="" S ECH="^~\&"
13 S CPS=$E(ECH),REP=$E(ECH,2)
14 ;
15 Q
16 ;
17MSG(BPSJMM,BPSJRTN) ; Message Handler
18 ;
19 N XMDUZ,XMSUB,XMY,XMTEXT,BPMSJMG
20 ;
21 I $G(U)="" S U="^"
22 I $G(BPSJRTN)]"" S BPSJMM(.0001)="Source Process: "_BPSJRTN
23 S BPMSJMG=$O(^BPS(9002313.99,0)) Q:'BPMSJMG
24 S BPMSJMG=+$G(^BPS(9002313.99,BPMSJMG,"VITRIA")) Q:'BPMSJMG
25 S BPMSJMG=$G(^VA(200,BPMSJMG,.15)) Q:BPMSJMG=""
26 S XMY(BPMSJMG)="",XMTEXT="BPSJMM(",XMSUB="ECME Registration Problem."
27 D ^XMD
28 ;
29 Q
30 ;
31VA200NM(VAIX,VATITLE,HL) ;
32 ;
33 N RETDATA,BPSNMDAT
34 N FS,CPS,REP
35 ;
36 I '$G(VAIX) Q ""
37 S BPSNMDAT=$P($G(^VA(200,VAIX,0)),U,1) I BPSNMDAT="" Q ""
38 ;
39 D VAHL7ECH(.HL)
40 D STDNAME^XLFNAME(.BPSNMDAT,"C")
41 ;
42 S RETDATA=$G(BPSNMDAT("FAMILY")) ;1
43 S RETDATA=RETDATA_CPS_$G(BPSNMDAT("GIVEN")) ;2
44 S RETDATA=RETDATA_CPS_$G(BPSNMDAT("MIDDLE")) ;3
45 S RETDATA=RETDATA_CPS_$G(BPSNMDAT("SUFFIX")) ;4
46 S RETDATA=RETDATA_CPS_$G(BPSNMDAT("PREFIX")) ;5
47 S RETDATA=RETDATA_CPS_$G(BPSNMDAT("DEGREE")) ;6
48 ;
49 S VATITLE=$P($G(^VA(200,VAIX,0)),U,9)
50 I VATITLE S VATITLE=$G(^DIC(3.1,VATITLE,0))
51 ;
52 Q RETDATA
53 ;
54VA20013(VAIX,HL) ; Build the HL7 Contact Means data field
55 ;
56 N FDATA,RETDATA
57 N FS,CPS,REP
58 ;
59 I '$G(VAIX) Q ""
60 ; VAIX is the index to ^VA(200,n
61 D VAHL7ECH(.HL)
62 S RETDATA=$P($G(^VA(200,VAIX,.15)),U,1) ; LJF@DAOU.COM
63 I RETDATA]"",RETDATA["@" S RETDATA=CPS_"NET"_CPS_"INTERNET"_CPS_RETDATA
64 S FDATA=$$EN^BPSJPHNM(VAIX,CPS,REP)
65 I $L(FDATA) D
66 . I $L(RETDATA) S RETDATA=RETDATA_REP
67 . S RETDATA=RETDATA_FDATA
68 Q RETDATA
69 ;
70ENCODE(INSTR,TCH) ; Encode data - Primarily HL7
71 N X,WCHR,OSTR
72 S OSTR=""
73 I $G(INSTR)]"" F X=1:1:$L(INSTR) D S OSTR=OSTR_WCHR
74 . S WCHR=$E(INSTR,X) I $D(TCH(WCHR)) S WCHR=TCH(WCHR)
75 Q OSTR
76 ;
77SPAR(HL,BPSJSEG,HCTS) ; Segment Parsing
78 N II,IJ,IK,ISDATA
79 N FS,CPS,REP,ECH
80 ;
81 I '$G(HCTS) Q
82 ;
83 D VAHL7ECH(.HL)
84 M ISDATA=^TMP($J,"BPSJHLI",HCTS)
85 S IK=0,IJ=1,II=""
86 F S II=$O(ISDATA(II)) Q:II="" D
87 . S ISDATA=$G(ISDATA(II)) Q:ISDATA=""
88 . F D Q:ISDATA=""
89 . . S IK=IK+1,BPSJSEG(IJ,IK)=$P(ISDATA,FS)
90 . . S $P(ISDATA,FS)=""
91 . . I $E(ISDATA)=FS S IJ=IJ+1,$E(ISDATA)=""
92 ;
93 ; Promote data in 1st subnode and kill subnode
94 S II=""
95 F S II=$O(BPSJSEG(II)) Q:II="" D
96 . S IJ=$O(BPSJSEG(II,"")) Q:'IJ
97 . S BPSJSEG(II)=BPSJSEG(II,IJ) K BPSJSEG(II,IJ)
98 Q
Note: See TracBrowser for help on using the repository browser.