Our EHR company sends ICD9 codes in the DG1.3.1 segment and we are sending these messages on to another vendor for chart abstraction. Our other vendor requires the decimal point be placed in the code. I have it currently working when the ICD9 code received is 5 numeric characters but I am having problems writing the javascript code for those codes that begin with an E or V then a 3 or 4 digit number. I would need a code such as V8712to appear as V871.2 etc. Also, my coding does not appear to be working on 4-digit codes such as 4235 which would appear as 423.5.
This is what I have so far:
String.prototype.inject = function(index) {return this.substr(0,index)+'.'+this.substr(index)};
for each (dg1 in msg.DG1) {
var code = dg1['DG1.3']['DG1.3.1'].toString();
if (/^\d{4}$/.test(code))
dg1['DG1.3']['DG1.3.1'] = code.inject(4);
else if (/^\d{4,5}$/.test(code))
dg1['DG1.3']['DG1.3.1'] = code.inject(3);
}
This is what I have so far:
String.prototype.inject = function(index) {return this.substr(0,index)+'.'+this.substr(index)};
for each (dg1 in msg.DG1) {
var code = dg1['DG1.3']['DG1.3.1'].toString();
if (/^\d{4}$/.test(code))
dg1['DG1.3']['DG1.3.1'] = code.inject(4);
else if (/^\d{4,5}$/.test(code))
dg1['DG1.3']['DG1.3.1'] = code.inject(3);
}
Insert decimal into DG1.3.1 Segment
0 commentaires:
Enregistrer un commentaire