var dateTimePattern = 'yyyyMMddHHmmss';
var datePattern = 'yyyyMMdd';
var timePattern = 'HHmmss';

var currentDateTime = DateUtil.getCurrentDate(dateTimePattern);
var currentDate = DateUtil.getCurrentDate(datePattern);
var currentTime = DateUtil.getCurrentDate(timePattern);

tmp['MSH']['MSH.4'] = msg['facility_name'];
tmp['MSH']['MSH.6'] = msg['facility_name'];
tmp['MSH']['MSH.7'] = currentDateTime;
tmp['MSH']['MSH.10'] = 'MSGID' + msg['order_id'];


tmp['PID']['PID.3'] = msg['patient_id'];
tmp['PID']['PID.4'] = msg['patient_id'];
tmp['PID']['PID.5'] = msg['patient_name'];
tmp['PID']['PID.5']['PID.5.1'] = msg['patient_last_name'];
tmp['PID']['PID.7'] = msg['patient_dob'];
tmp['PID']['PID.8'] = msg['patient_gender'];
tmp['PID']['PID.11'] = msg['patient_address'];
tmp['PID']['PID.12'] = 'TZ';
tmp['PID']['PID.13'] = msg['patient_phone'];


tmp['PV1']['PV1.19'] = msg['visit_id'];


tmp['ORC']['ORC.2'] = currentDateTime;


tmp['OBR']['OBR.2'] = msg['order_id'];
tmp['OBR']['OBR.3'] = msg['order_id'];
tmp['OBR']['OBR.4']['OBR.4.4'] = msg['procedure_code'];
tmp['OBR']['OBR.4']['OBR.4.5'] = msg['procedure_name'];
tmp['OBR']['OBR.4']['OBR.4.6'] = msg['procedure_name'];
tmp['OBR']['OBR.4']['OBR.4.7'] = msg['procedure_view'];
tmp['OBR']['OBR.4']['OBR.4.8'] = msg['procedure_view'];
tmp['OBR']['OBR.6'] = msg['order_date_time'];

tmp['OBR']['OBR.16']['OBR.16.1'] = msg['physician_code'];
tmp['OBR']['OBR.16']['OBR.16.2'] = msg['physician_name'];
tmp['OBR']['OBR.18'] = msg['order_id'];
tmp['OBR']['OBR.19'] = msg['order_id'];
tmp['OBR']['OBR.20'] = msg['order_id'];
tmp['OBR']['OBR.20'] = msg['facility_name'];
tmp['OBR']['OBR.24'] = msg['modaility_code'];
tmp['ZDS']['ZDS.1']['ZDS.1.2'] = "TIBAPACS";
tmp['ZDS']['ZDS.1']['ZDS.1.3'] = msg['facility_name'];