Commit 9019dd78 authored by chenhao's avatar chenhao

提交120急救站的导入接口开发

parent 3c1532be
......@@ -308,4 +308,37 @@ AND NAME IS NOT NULL
GROUP BY
NAME
</select>
<select id='getFireTeamBySequenceNbr' resultType="map">
SELECT
name
FROM
cb_fire_team
WHERE
sequence_nbr = #{sequenceNbr} and is_delete=0
</select>
<select id='getFirstAidForTypeCodeAndCompanyId' resultType="map">>
SELECT
name,
sequence_nbr
FROM
cb_fire_team
WHERE
company = #{company}
AND is_delete = 0
AND type_code = (
SELECT
CODE
FROM
cb_data_dictionary
WHERE
`name` = '企(事)业单位医疗救援队(站)'
AND type = 'XFJGLX'
)
</select>
</mapper>
......@@ -332,6 +332,9 @@ public class ExcelServiceImpl {
case "XFAQBG":
excelImportSafeReport(multipartFile);
break;
case "JJZB":
excelImportDutyPerson(multipartFile, "JJZB");
break;
}
return;
}
......@@ -952,8 +955,65 @@ public class ExcelServiceImpl {
} else if (ExcelEnums.WXXFZB.getType().equals(dutyType)) {
initDutyFireFightingData(sheet, dataList, dayByMonth);
dutyFireFightingService.saveImportData(dataList);
} else if (ExcelEnums.JJZB.getType().equals(dutyType)) {
initDutyFirstAidData(sheet, dataList, dayByMonth);
dutyFireFightingService.saveImportData(dataList);
}
}
}
private void initDutyFirstAidData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) {
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
DutyFirstAidDto dutyFirstAidDto = new DutyFirstAidDto();
// row是一行数据,row.getCell(i),代表拿到这一行,第i列数据
Row row = sheet.getRow(i);
if (row == null) {
continue;
}
Cell cell = row.getCell(2);
if (cell == null) {
continue;
}
cell = row.getCell(1);
if (cell != null) {
String[] split = cell.toString().split("@");
dutyFirstAidDto.setTeamId(split[1]);
dutyFirstAidDto.setTeamName(split[0]);
}
cell = row.getCell(2);
if (cell != null) {
String[] splitStr = cell.toString().split("@");
dutyFirstAidDto.setUserName(splitStr[0]);
dutyFirstAidDto.setUserId(splitStr[1]);
}
cell = row.getCell(3);
if (cell != null) {
String[] splitStr = cell.toString().split("@");
dutyFirstAidDto.setPostTypeName(splitStr[0]);
dutyFirstAidDto.setPostType(splitStr[1]);
}
cell = row.getCell(4);
if (cell != null) {
String[] splitStr = cell.toString().split("@");
dutyFirstAidDto.setFirstAid(splitStr[0]);
dutyFirstAidDto.setFirstAidId(splitStr[1]);
}
List<DutyPersonShiftDto> dutyShift = new ArrayList<>();
for (int j = 0; j < dayByMonth.size(); j++) {
cell = row.getCell(5 + j);
String dutyType = cell == null ? "" : cell.toString();
if (!StringUtils.isEmpty(dutyType)) {
DutyPersonShiftDto dutyPersonShiftDto = new DutyPersonShiftDto();
dutyPersonShiftDto.setDutyDate(dayByMonth.get(j));
dutyPersonShiftDto.setShiftId(Long.valueOf(dutyType.split("@")[1]));
dutyShift.add(dutyPersonShiftDto);
}
}
dutyFirstAidDto.setDutyShift(dutyShift);
Map<String, Object> dutyPersonDtoMap = Bean.BeantoMap(dutyFirstAidDto);
dataList.add(dutyPersonDtoMap);
}
}
private void excelImportSafeReport(MultipartFile multipartFile) throws Exception {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment