String out_row_tablecode;
Object[] base;
String inpatient_no;
int seq_no;
String print_data;
String operation_date;
List<String> nurseInfo;
SimpleDateFormat format;
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
if (first) {
nurseInfo = new ArrayList<String>();
format = new SimpleDateFormat("yyyy-MM-dd");
base = getRow();
if (base == null) {
setOutputDone();
return false;
}
out_row_tablecode = "dw.t_shgc";
inpatient_no = get(Fields.In, "ffield01").getString(base);
base = createOutputRow(base, data.outputRowMeta.size());
get(Fields.Out, "ftablecode").setValue(base, out_row_tablecode);
get(Fields.Out, "fdataid").setValue(base, inpatient_no);
print_data = get(Fields.In, "print_data").getString(base);
operation_date = get(Fields.In, "operation_date").getString(base);
first = false;
}
Object[] r = getRow();
if (r == null) {
putRow(data.outputRowMeta, base);
setOutputDone();
return false;
}
logBasic("当前住院号:" + inpatient_no);
logBasic("当前元素标签:" + element_id);
String inpatient_no_tmp = get(Fields.In, "ffield01").getString(r);
int element_id_tmp = Integer.parseInt(get(Fields.In, "element_id").getString(r));
if (inpatient_no_tmp.equals(inpatient_no)) {
logBasic("与新纪录住院号:" + inpatient_no_tmp + "相等");
if (element_id_tmp == element_id) {
logBasic("与新纪录元素标签:" + inpatient_no_tmp + "相等,跳过此行数据");
return true;
} else {
logBasic("与新纪录元素标签:" + inpatient_no_tmp + "不等,处理数据中...");
switch (element_id_tmp) {
case 794:
logBasic("元素转换标签:794");
get(Fields.Out, "ffield02").setValue(base, get(Fields.In, "value").getString(r));
break;
case 4641:
logBasic("元素转换标签:4641");
get(Fields.Out, "ffield03").setValue(base, get(Fields.In, "value").getString(r));
break;
case 370:
logBasic("元素转换标签:370");
get(Fields.Out, "ffield05").setValue(base, get(Fields.In, "value").getString(r));
break;
case 595:
logBasic("元素转换标签:595");
get(Fields.Out, "ffield06to13").setValue(base, get(Fields.In, "value").getString(r));
break;
case 721:
logBasic("元素转换标签:721");
get(Fields.Out, "ffield14").setValue(base, get(Fields.In, "value").getString(r));
break;
case 793:
logBasic("元素转换标签:793");
get(Fields.Out, "ffield15").setValue(base, get(Fields.In, "value").getString(r));
break;
case 720:
logBasic("元素转换标签:720");
get(Fields.Out, "ffield16").setValue(base, get(Fields.In, "value").getString(r));
break;
default:
logBasic("非法标签:" + element_id_tmp);
break;
}
element_id = element_id_tmp;
return true;
}
} else {
logBasic("与新纪录住院号:" + inpatient_no_tmp + "不等,输出之前数据到结果中。");
putRow(data.outputRowMeta, base);
base = r;
out_row_tablecode = "dw.t_ssqk";
inpatient_no = get(Fields.In, "ffield01").getString(base);
element_id = Integer.parseInt((get(Fields.In, "element_id").getString(base)));
base = createOutputRow(base, data.outputRowMeta.size());
get(Fields.Out, "ftablecode").setValue(base, out_row_tablecode);
get(Fields.Out, "fdataid").setValue(base, inpatient_no);
switch (element_id) {
case 794:
logBasic("元素转换标签:794");
get(Fields.Out, "ffield02").setValue(base, get(Fields.In, "value").getString(r));
break;
case 4641:
logBasic("元素转换标签:4641");
get(Fields.Out, "ffield03").setValue(base, get(Fields.In, "value").getString(r));
break;
case 370:
logBasic("元素转换标签:370");
get(Fields.Out, "ffield05").setValue(base, get(Fields.In, "value").getString(r));
break;
case 595:
logBasic("元素转换标签:595");
get(Fields.Out, "ffield06to13").setValue(base, get(Fields.In, "value").getString(r));
break;
case 721:
logBasic("元素转换标签:721");
get(Fields.Out, "ffield14").setValue(base, get(Fields.In, "value").getString(r));
break;
case 793:
logBasic("元素转换标签:793");
get(Fields.Out, "ffield15").setValue(base, get(Fields.In, "value").getString(r));
break;
case 720:
logBasic("元素转换标签:720");
get(Fields.Out, "ffield16").setValue(base, get(Fields.In, "value").getString(r));
break;
default:
logBasic("非法标签:" + element_id_tmp);
break;
}
}
return true;
}