-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparseCVX.pl
More file actions
executable file
·47 lines (38 loc) · 962 Bytes
/
Copy pathparseCVX.pl
File metadata and controls
executable file
·47 lines (38 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/perl
#
# parseCVX.pl
#
# File reads in flat file cvx.txt with | seperated fields and outputs
# javascript code necessary set the manurfacture code in HL7 RXO segment
#
my $file = "./cvx.txt";
my @junk = ();
my $cvx;
my $description;
my $mcode;
open(FILE, '<', $file) or die $!;
my $header=<<'HEADER';
// Update Manufacture code based on CVX code
for each (seg in msg..RXA) {
var cvx = seg['RXA.5']['RXA.5.1'].toString();
switch (+cvx) {
HEADER
my $footer=<<'FOOTER';
default :
break;
}
}
FOOTER
print $header;
while(my $line = <FILE>) {
(undef,undef,$cvx,$description,$mcode,@junk) = split(/\|/,$line);
$cvx =~ s/^\s+|\s+$//g;
$description =~ s/^\s+|\s+$//g;
$mcode =~ s/^\s+|\s+$//g;
print "\tcase $cvx :\n";
print "\t\tseg['RXA.17']['RXA.17.1'] = '" . $mcode . "'\n";
print "\t\tseg['RXA.17']['RXA.17.2'] = '" . $description . "'\n";
print "\t\tbreak\n";
}
print $footer;
close(FILE);