diff --git a/nursing-unit-api/src/main/java/com/nu/modules/pad/directiveplan/api/CareDirectiveApi.java b/nursing-unit-api/src/main/java/com/nu/modules/pad/directiveplan/api/CareDirectiveApi.java index 5f3cde78..9fc82b0d 100644 --- a/nursing-unit-api/src/main/java/com/nu/modules/pad/directiveplan/api/CareDirectiveApi.java +++ b/nursing-unit-api/src/main/java/com/nu/modules/pad/directiveplan/api/CareDirectiveApi.java @@ -13,6 +13,7 @@ import org.jeecg.common.api.vo.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; + import java.util.*; /** @@ -146,59 +147,73 @@ public class CareDirectiveApi { //给数据加标识 if (!CollectionUtils.isEmpty(history)) { + //未结束就是未执行;结束时间在应该结束时间后就是超时 history.stream().forEach(item -> { - if ("N".equals(item.getIzStart())) { - // 未开始 + if ("N".equals(item.getIzFinish())) { + //未执行 item.setExecuteStatus("hisUnExe"); + } else if (item.getFinishTime().after(item.getEndTime())) { + //超时 + item.setExecuteStatus("hisTimeOut"); } else { - // 已开始 - Date ygjssj = item.getEndTime(); // 应该结束时间 - Date sjkssj = item.getBeginTime(); // 实际开始时间 - Date sjjssj = item.getFinishTime(); // 实际结束时间 - String cssc = item.getTimeoutDuration(); // 超时时长(分钟) - String fwsc = item.getServiceDuration(); // 服务时长(分钟) - - // 判断是否超时 - boolean isTimeout = false; - - // 条件1:如果实际开始时间 > (应该结束时间 + 超时时长) - if (sjkssj != null && ygjssj != null && cssc != null) { - try { - int csscInt = Integer.parseInt(cssc); - Calendar calendar = Calendar.getInstance(); - calendar.setTime(ygjssj); - calendar.add(Calendar.MINUTE, csscInt); - Date latestAllowedTime = calendar.getTime(); // 最晚允许开始时间 - - if (sjkssj.after(latestAllowedTime)) { - isTimeout = true; - } - } catch (NumberFormatException e) { - e.printStackTrace(); - } - } - - // 条件2:如果实际结束时间-实际开始时间 > 服务时长 - if (!isTimeout && sjkssj != null && sjjssj != null && fwsc != null) { - try { - long actualServiceMinutes = (sjjssj.getTime() - sjkssj.getTime()) / (1000 * 60); - int fwscInt = Integer.parseInt(fwsc); - - if (actualServiceMinutes > fwscInt) { - isTimeout = true; - } - } catch (NumberFormatException e) { - e.printStackTrace(); - } - } - - if (isTimeout) { - item.setExecuteStatus("hisTimeOut"); - } else { - item.setExecuteStatus("hisOk"); - } + //正常 + item.setExecuteStatus("hisOk"); } }); + //旧版逻辑 +// history.stream().forEach(item -> { +// if ("N".equals(item.getIzStart())) { +// // 未开始 +// item.setExecuteStatus("hisUnExe"); +// } else { +// // 已开始 +// Date ygjssj = item.getEndTime(); // 应该结束时间 +// Date sjkssj = item.getBeginTime(); // 实际开始时间 +// Date sjjssj = item.getFinishTime(); // 实际结束时间 +// String cssc = item.getTimeoutDuration(); // 超时时长(分钟) +// String fwsc = item.getServiceDuration(); // 服务时长(分钟) +// +// // 判断是否超时 +// boolean isTimeout = false; +// +// // 条件1:如果实际开始时间 > (应该结束时间 + 超时时长) +// if (sjkssj != null && ygjssj != null && cssc != null) { +// try { +// int csscInt = Integer.parseInt(cssc); +// Calendar calendar = Calendar.getInstance(); +// calendar.setTime(ygjssj); +// calendar.add(Calendar.MINUTE, csscInt); +// Date latestAllowedTime = calendar.getTime(); // 最晚允许开始时间 +// +// if (sjkssj.after(latestAllowedTime)) { +// isTimeout = true; +// } +// } catch (NumberFormatException e) { +// e.printStackTrace(); +// } +// } +// +// // 条件2:如果实际结束时间-实际开始时间 > 服务时长 +// if (!isTimeout && sjkssj != null && sjjssj != null && fwsc != null) { +// try { +// long actualServiceMinutes = (sjjssj.getTime() - sjkssj.getTime()) / (1000 * 60); +// int fwscInt = Integer.parseInt(fwsc); +// +// if (actualServiceMinutes > fwscInt) { +// isTimeout = true; +// } +// } catch (NumberFormatException e) { +// e.printStackTrace(); +// } +// } +// +// if (isTimeout) { +// item.setExecuteStatus("hisTimeOut"); +// } else { +// item.setExecuteStatus("hisOk"); +// } +// } +// }); } if (!CollectionUtils.isEmpty(current)) { current.stream().forEach(item -> {