调整护理类服务指令矩阵预览接口历史数据逻辑
This commit is contained in:
parent
146c7bfcb3
commit
b7d5462ce9
|
|
@ -287,65 +287,49 @@ public class CareDirectiveApi {
|
|||
item.setExecuteStatus("hisUnExe");
|
||||
} else {
|
||||
// 已开始
|
||||
Date ygkssj = item.getStartTime(); // 应该开始时间
|
||||
Date ygjssj = item.getEndTime(); // 应该结束时间
|
||||
Date sjkssj = item.getBeginTime(); // 实际开始时间
|
||||
Date sjjssj = item.getFinishTime(); // 实际结束时间
|
||||
String rcsc = item.getTimeoutDuration(); // 容错时长(分钟)
|
||||
String cssc = item.getTimeoutDuration(); // 超时时长(分钟)
|
||||
String fwsc = item.getServiceDuration(); // 服务时长(分钟)
|
||||
|
||||
// 判断是否超时(实际开始时间 > 应该开始时间 + 容错时长)
|
||||
if (ygkssj != null && sjkssj != null && rcsc != null) {
|
||||
// 判断是否超时
|
||||
boolean isTimeout = false;
|
||||
|
||||
// 条件1:如果实际开始时间 > (应该结束时间 + 超时时长)
|
||||
if (sjkssj != null && ygjssj != null && cssc != null) {
|
||||
try {
|
||||
int rcscInt = Integer.parseInt(rcsc);
|
||||
int csscInt = Integer.parseInt(cssc);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(ygkssj);
|
||||
calendar.add(Calendar.MINUTE, rcscInt);
|
||||
Date deadlineTime = calendar.getTime(); // 最晚开始时间
|
||||
calendar.setTime(ygjssj);
|
||||
calendar.add(Calendar.MINUTE, csscInt);
|
||||
Date latestAllowedTime = calendar.getTime(); // 最晚允许开始时间
|
||||
|
||||
if (sjkssj.after(deadlineTime)) {
|
||||
// 实际开始时间超过最晚开始时间
|
||||
item.setExecuteStatus("hisTimeOut");
|
||||
return; // 进行下一条处理
|
||||
if (sjkssj.after(latestAllowedTime)) {
|
||||
isTimeout = true;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 容错时长格式错误
|
||||
e.printStackTrace();
|
||||
item.setExecuteStatus("hisOk");
|
||||
}
|
||||
}
|
||||
|
||||
// 计算实际服务时长
|
||||
long sjfwsc = 0;
|
||||
if (sjkssj != null) {
|
||||
Date sjjssjDate = sjjssj;
|
||||
if (sjjssjDate == null) {
|
||||
// 如果实际结束时间为空,使用当前时间
|
||||
sjjssjDate = new Date();
|
||||
}
|
||||
|
||||
// 计算分钟数差值
|
||||
long diffInMillis = sjjssjDate.getTime() - sjkssj.getTime();
|
||||
sjfwsc = diffInMillis / (1000 * 60);
|
||||
}
|
||||
|
||||
// 判断实际服务时长是否超过服务时长
|
||||
if (fwsc != null) {
|
||||
// 条件2:如果实际结束时间-实际开始时间 > 服务时长
|
||||
if (!isTimeout && sjkssj != null && sjjssj != null && fwsc != null) {
|
||||
try {
|
||||
long actualServiceMinutes = (sjjssj.getTime() - sjkssj.getTime()) / (1000 * 60);
|
||||
int fwscInt = Integer.parseInt(fwsc);
|
||||
if (sjfwsc > fwscInt) {
|
||||
// 实际服务时长超过预定服务时长
|
||||
item.setExecuteStatus("hisTimeOut");
|
||||
} else {
|
||||
// 其他情况,视为成功
|
||||
item.setExecuteStatus("hisOk");
|
||||
|
||||
if (actualServiceMinutes > fwscInt) {
|
||||
isTimeout = true;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
// 服务时长格式错误,视为成功
|
||||
item.setExecuteStatus("hisOk");
|
||||
}
|
||||
}
|
||||
|
||||
if (isTimeout) {
|
||||
item.setExecuteStatus("hisTimeOut");
|
||||
} else {
|
||||
// 没有服务时长配置,视为成功
|
||||
item.setExecuteStatus("hisOk");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue