|
@@ -37,8 +37,6 @@ public class RiBaoService {
|
|
|
private MsSuspectedMapper msSuspectedMapper;
|
|
|
@Autowired
|
|
|
private MsReportMapper msReportMapper;
|
|
|
- @Autowired
|
|
|
- private RiBaoService msReportService;
|
|
|
|
|
|
@Autowired
|
|
|
private UptownHouseMapper uptownHouseMapper;
|
|
@@ -46,40 +44,107 @@ public class RiBaoService {
|
|
|
@Autowired
|
|
|
private UptownUnitMapper uptownUnitMapper;
|
|
|
|
|
|
- public List<MsSuspected> getByReportId(Long reportId) {
|
|
|
- return msSuspectedMapper.selectByReportId(reportId);
|
|
|
+ @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
+ public MsReport editRibao(Long reportId) {
|
|
|
+ DateTime dateTime = new DateTime();
|
|
|
+
|
|
|
+ MsReport msReport = msReportMapper.selectById(reportId);
|
|
|
+ if (msReport != null) {
|
|
|
+ msReport.setReportStatus(1);
|
|
|
+ msReport.setTimeUpdate(dateTime);
|
|
|
+ msReportMapper.updateById(msReport);
|
|
|
+ }
|
|
|
+
|
|
|
+ return msReport;
|
|
|
}
|
|
|
|
|
|
- public MsReport selectById(Long reportId) {
|
|
|
- return msReportMapper.selectById(reportId);
|
|
|
+ // 删除家人
|
|
|
+ @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
+ public int delRibaoDetail(Long suspectedId) {
|
|
|
+ return msSuspectedMapper.deleteById(suspectedId);
|
|
|
}
|
|
|
|
|
|
- //获取前一天数据
|
|
|
-// public List<MsSuspected> getByReportReportDate(String reportDate, Long userCreate) {
|
|
|
-//
|
|
|
-// List<MsReport> listReport = msReportMapper.selectByReportDate(reportDate, userCreate);
|
|
|
-// List<MsSuspected> listSuspected = null;
|
|
|
-// if (listReport != null && listReport.size() > 0) {
|
|
|
-// listSuspected = msSuspectedMapper.selectByReportId(Long.parseLong(listReport.get(0).getReportId().toString()));
|
|
|
-// }
|
|
|
-// return listSuspected;
|
|
|
-// }
|
|
|
+ // 添加修改家人
|
|
|
+ @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
+ public MsSuspected addOrEditRibaoDetail(MsSuspected ribaoDetail) {
|
|
|
+ DateTime dateTime = new DateTime();
|
|
|
|
|
|
- //获取今天数据
|
|
|
- public MsReport getReportByDateNow(Long userCreate) {
|
|
|
- //根据昨天的获取今天的
|
|
|
- msReportService.getNowByYesterday(userCreate);
|
|
|
- Date t = new Date();
|
|
|
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- String reportDate = df.format(t);
|
|
|
- List<MsReport> listReport = msReportMapper.selectByReportDate(reportDate, userCreate);
|
|
|
- MsReport msReport = new MsReport();
|
|
|
- if (listReport != null && listReport.size() > 0) {
|
|
|
- msReport = msReportMapper.selectById(Long.parseLong(listReport.get(0).getReportId().toString()));
|
|
|
+ //判断是否疑似
|
|
|
+ Integer suspectedStatus = 0;
|
|
|
+ if (ribaoDetail.getMuscle().intValue() == 1 ||
|
|
|
+ ribaoDetail.getSingleRoom().intValue() == 1 ||
|
|
|
+ ribaoDetail.getTemperature().compareTo(new BigDecimal(36)) == -1 ||
|
|
|
+ ribaoDetail.getTemperature().compareTo(new BigDecimal(37.3)) == 1 ||
|
|
|
+ ribaoDetail.getCough() > 0 ||
|
|
|
+ ribaoDetail.getMuscle() > 0 ||
|
|
|
+ ribaoDetail.getDyspnea() > 0 ||
|
|
|
+ ribaoDetail.getFatigue() > 0 ||
|
|
|
+ ribaoDetail.getDiarrhea() > 0) {
|
|
|
+ suspectedStatus = 1;
|
|
|
}
|
|
|
- return msReport;
|
|
|
+
|
|
|
+ ribaoDetail.setSuspectedStatus(suspectedStatus);
|
|
|
+ if (ribaoDetail.getSuspectedId().longValue() > 0L) {
|
|
|
+ ribaoDetail.setTimeUpdate(dateTime);
|
|
|
+ msSuspectedMapper.updateById(ribaoDetail);
|
|
|
+ } else {
|
|
|
+ ribaoDetail.setSuspectedId(IdWorker.getId());
|
|
|
+ ribaoDetail.setTimeCreate(dateTime);
|
|
|
+ ribaoDetail.setTimeUpdate(dateTime);
|
|
|
+ msSuspectedMapper.insert(ribaoDetail);
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新今日日报
|
|
|
+ updateRibao(ribaoDetail.getReportId(), ribaoDetail.getMedical(), ribaoDetail.getSingleRoom(), ribaoDetail.getTemperature());
|
|
|
+
|
|
|
+ return ribaoDetail;
|
|
|
}
|
|
|
|
|
|
+ // 更新今日日报
|
|
|
+ @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
+ public void updateRibao(Long reportId, Integer medical, Integer singleRoom, BigDecimal temperature) {
|
|
|
+ //更新今日日报
|
|
|
+ Integer trueNum = 0, singleNum = 0, isSuspected = 0, isNoSuspected = 0, isFamliy = 0;
|
|
|
+
|
|
|
+ //确诊
|
|
|
+ trueNum = msReportMapper.selectSuspectedNum(reportId);
|
|
|
+
|
|
|
+ //居家隔离
|
|
|
+ singleNum = msReportMapper.selectSingleRoomNum(reportId);
|
|
|
+
|
|
|
+ //正常
|
|
|
+ isSuspected = msReportMapper.selectisSuspectedNum(reportId);
|
|
|
+
|
|
|
+ //疑似
|
|
|
+ isNoSuspected = msReportMapper.selectisNoSuspectedNum(reportId);
|
|
|
+
|
|
|
+ //今日居家
|
|
|
+ List<MsSuspected> list = msSuspectedMapper.selectByReportId(reportId);
|
|
|
+ if (list != null && list.size() > 0)
|
|
|
+ isFamliy = list.size();
|
|
|
+ MsReport msReport = msReportMapper.selectById(reportId);
|
|
|
+ if (msReport != null) {
|
|
|
+ msReport.setSureNum(trueNum);
|
|
|
+ msReport.setSingleNum(singleNum);
|
|
|
+ msReport.setSuspectedNum(isNoSuspected);
|
|
|
+ msReport.setNormalNum(isSuspected);
|
|
|
+ msReport.setSafetyNum(isFamliy);
|
|
|
+ if (isNoSuspected > 0)
|
|
|
+ msReport.setMsStatus(2);// 健康状态:1正常,2异常
|
|
|
+ else
|
|
|
+ msReport.setMsStatus(1);
|
|
|
+ msReportMapper.updateById(msReport);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public MsReport getRibao(Long reportId) {
|
|
|
+ MsReport msReport = msReportMapper.selectById(reportId);
|
|
|
+ String houseStr = this.getHouseStr(msReport.getHouseId());
|
|
|
+ msReport.setHouseIdStr(houseStr);
|
|
|
+
|
|
|
+ return msReport;
|
|
|
+ }
|
|
|
|
|
|
//获取今天数据
|
|
|
public String getHouseStr(Long houseId) {
|
|
@@ -101,30 +166,106 @@ public class RiBaoService {
|
|
|
return houseStr;
|
|
|
}
|
|
|
|
|
|
- //上报
|
|
|
- @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
- public Integer addReport(Long userCreate) {
|
|
|
- Date t = new Date();
|
|
|
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- String reportDate = df.format(t);
|
|
|
- List<MsReport> listReport = msReportMapper.selectByReportDate(reportDate, userCreate);
|
|
|
- if (listReport == null || listReport.size() == 0)
|
|
|
- return 0;
|
|
|
-
|
|
|
- //判断体温是否填写
|
|
|
- List<MsSuspected> listSuspected = msSuspectedMapper.selectByReportId(Long.parseLong(listReport.get(0).getReportId().toString()));
|
|
|
- for (MsSuspected msSuspected : listSuspected) {
|
|
|
- if (msSuspected.getTemperature().compareTo(new BigDecimal(0)) == 0)
|
|
|
- return 2;
|
|
|
+ public MsSuspected getRibaoDetail(Long suspectedId) {
|
|
|
+ MsSuspected obj = msSuspectedMapper.selectById(suspectedId);
|
|
|
+
|
|
|
+ if (obj.getGrender().intValue() == 1) {
|
|
|
+ obj.setGrenderStr("男");
|
|
|
+ } else if (obj.getGrender().intValue() == 2) {
|
|
|
+ obj.setGrenderStr("女");
|
|
|
}
|
|
|
- MsReport msReport = msReportMapper.selectById(Long.parseLong(listReport.get(0).getReportId().toString()));
|
|
|
- if (msReport != null) {
|
|
|
- msReport.setReportStatus(1);
|
|
|
- msReport.setUserUpdate(userCreate);
|
|
|
- msReport.setTimeUpdate(DateTime.now());
|
|
|
- msReportMapper.updateById(msReport);
|
|
|
+
|
|
|
+ if (obj.getFamilyStatus().intValue() == 0) {
|
|
|
+ obj.setFamilyStatusStr("正常");
|
|
|
+ } else if (obj.getFamilyStatus().intValue() == 1) {
|
|
|
+ obj.setFamilyStatusStr("心血管疾病(服用ARB)");
|
|
|
+ } else if (obj.getFamilyStatus().intValue() == 2) {
|
|
|
+ obj.setFamilyStatusStr("心血管疾病(未服用ARB)");
|
|
|
+ } else if (obj.getFamilyStatus().intValue() == 3) {
|
|
|
+ obj.setFamilyStatusStr("呼吸系统病史");
|
|
|
+ } else if (obj.getFamilyStatus().intValue() == 4) {
|
|
|
+ obj.setFamilyStatusStr("肿瘤病史");
|
|
|
+ } else if (obj.getFamilyStatus().intValue() == 5) {
|
|
|
+ obj.setFamilyStatusStr("糖尿病史");
|
|
|
+ } else if (obj.getFamilyStatus().intValue() == 6) {
|
|
|
+ obj.setFamilyStatusStr("服用过激素药物");
|
|
|
+ } else if (obj.getFamilyStatus().intValue() == 7) {
|
|
|
+ obj.setFamilyStatusStr("妊娠期");
|
|
|
+ } else if (obj.getFamilyStatus().intValue() == 8) {
|
|
|
+ obj.setFamilyStatusStr("其他");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (obj.getMedical().intValue() == 0) {
|
|
|
+ obj.setMedicalStr("否");
|
|
|
+ } else if (obj.getMedical().intValue() == 1) {
|
|
|
+ obj.setMedicalStr("是");
|
|
|
}
|
|
|
- return 1;
|
|
|
+
|
|
|
+ if (obj.getCough().intValue() == 0) {
|
|
|
+ obj.setCoughStr("无咳嗽");
|
|
|
+ } else if (obj.getCough().intValue() == 1) {
|
|
|
+ obj.setCoughStr("偶有短暂咳嗽");
|
|
|
+ } else if (obj.getCough().intValue() == 2) {
|
|
|
+ obj.setCoughStr("咳嗽轻度影响生活");
|
|
|
+ } else if (obj.getCough().intValue() == 3) {
|
|
|
+ obj.setCoughStr("咳嗽严重影响生活");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (obj.getMuscle().intValue() == 0) {
|
|
|
+ obj.setMuscleStr("无");
|
|
|
+ } else if (obj.getMuscle().intValue() == 1) {
|
|
|
+ obj.setMuscleStr("按压有");
|
|
|
+ } else if (obj.getMuscle().intValue() == 2) {
|
|
|
+ obj.setMuscleStr("偶尔");
|
|
|
+ } else if (obj.getMuscle().intValue() == 3) {
|
|
|
+ obj.setMuscleStr("持续有");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (obj.getDyspnea().intValue() == 0) {
|
|
|
+ obj.setDyspneaStr("无");
|
|
|
+ } else if (obj.getDyspnea().intValue() == 1) {
|
|
|
+ obj.setDyspneaStr("急走或上坡气短");
|
|
|
+ } else if (obj.getDyspnea().intValue() == 2) {
|
|
|
+ obj.setDyspneaStr("气短而走路变慢");
|
|
|
+ } else if (obj.getDyspnea().intValue() == 3) {
|
|
|
+ obj.setDyspneaStr("走路数分钟后气短");
|
|
|
+ } else if (obj.getDyspnea().intValue() == 4) {
|
|
|
+ obj.setDyspneaStr("气短无法离开房间");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (obj.getFatigue().intValue() == 0) {
|
|
|
+ obj.setFatigueStr("无");
|
|
|
+ } else if (obj.getFatigue().intValue() == 1) {
|
|
|
+ obj.setFatigueStr("可体力劳动但觉得累");
|
|
|
+ } else if (obj.getFatigue().intValue() == 2) {
|
|
|
+ obj.setFatigueStr("轻体力劳动后长时间不能恢复");
|
|
|
+ } else if (obj.getFatigue().intValue() == 3) {
|
|
|
+ obj.setFatigueStr("不能正常生活");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (obj.getDiarrhea().intValue() == 0) {
|
|
|
+ obj.setDiarrheaStr("无");
|
|
|
+ } else if (obj.getDiarrhea().intValue() == 1) {
|
|
|
+ obj.setDiarrheaStr("轻度腹泻少于于3次");
|
|
|
+ } else if (obj.getDiarrhea().intValue() == 2) {
|
|
|
+ obj.setDiarrheaStr("中度腹泻4-6次");
|
|
|
+ } else if (obj.getDiarrhea().intValue() == 3) {
|
|
|
+ obj.setDiarrheaStr("重度腹泻超过6次");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (obj.getSingleRoom().intValue() == 0) {
|
|
|
+ obj.setSingleRoomStr("否");
|
|
|
+ } else if (obj.getSingleRoom().intValue() == 1) {
|
|
|
+ obj.setSingleRoomStr("是");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (obj.getSuspectedStatus().intValue() == 0) {
|
|
|
+ obj.setSuspectedStatusStr("否");
|
|
|
+ } else if (obj.getSuspectedStatus().intValue() == 1) {
|
|
|
+ obj.setSuspectedStatusStr("是");
|
|
|
+ }
|
|
|
+
|
|
|
+ return obj;
|
|
|
}
|
|
|
|
|
|
// @Pd(name = "userName") String userName,// 家人姓名
|