|
|
@@ -223,7 +223,7 @@ public class PrintInfusionCardService {
|
|
|
return ResultVoUtil.success(response);
|
|
|
}
|
|
|
|
|
|
- public ResultVo<String> checkInfusionByScan(String scanContent) {
|
|
|
+ public ResultVo<String> checkInfusionByScan(String scanContent, Integer scanType) {
|
|
|
String[] summary = scanContent.split("\\|");
|
|
|
if (summary.length != 4) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请扫描正确的二维码!");
|
|
|
@@ -257,14 +257,28 @@ public class PrintInfusionCardService {
|
|
|
caMsbBuilder
|
|
|
.append("为患者【")
|
|
|
.append(drugs.get(0).getInpatientName().trim())
|
|
|
- .append("】执行输液:");
|
|
|
+ .append(scanType == 1 ? "】执行输液:" : "】结束输液:");
|
|
|
for (int i = 0; i < drugs.size(); i++) {
|
|
|
YzActOcc occ = drugs.get(i);
|
|
|
- if (StringUtil.notBlank(occ.getExecuteStaff()) && null != occ.getExecuteTime()) {
|
|
|
- String executeTime = DateUtil.formatDatetime(occ.getExecuteTime());
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR,
|
|
|
- "本次输液已于 <br/>" + executeTime + " <br/> 核对执行过。");
|
|
|
+
|
|
|
+ if (scanType == 1) {
|
|
|
+ if (StringUtil.notBlank(occ.getExecuteStaff()) && null != occ.getExecuteTime()) {
|
|
|
+ String executeTime = DateUtil.formatDatetime(occ.getExecuteTime());
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR,
|
|
|
+ "本次输液已于 <br/>" + executeTime + " <br/> 核对执行过。");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtil.isBlank(occ.getExecuteStaff()) || null == occ.getExecuteTime()) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR,
|
|
|
+ "本次输液尚未开始执行,无法结束执行。");
|
|
|
+ }
|
|
|
+ if (StringUtil.notBlank(occ.getEndExecutor()) && null != occ.getEndExecuteTime()) {
|
|
|
+ String time = DateUtil.formatDatetime(occ.getEndExecuteTime());
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR,
|
|
|
+ "本次输液已于 <br/>" + time + " <br/> 结束执行。");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
BigDecimal mapQuan = drugMap.get(occ.getChargeCode());
|
|
|
if (null == mapQuan) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR, "用药与医嘱不匹配,请检查!");
|
|
|
@@ -287,15 +301,23 @@ public class PrintInfusionCardService {
|
|
|
CaSignClass.Send caParams = new CaSignClass.Send();
|
|
|
caParams.setId(staff);
|
|
|
caParams.setMsg(caMsbBuilder.toString());
|
|
|
- caParams.setDesc("执行输液医嘱。");
|
|
|
+ caParams.setDesc(scanType == 1 ? "执行输液医嘱。" : "结束输液。");
|
|
|
log.info("执行输液CA签名入参:{}", caParams);
|
|
|
CaReturn.CaSignReturn caRes = caService.sendByCode(caParams);
|
|
|
log.info("执行输液CA签名返回:{}", caRes);
|
|
|
|
|
|
- int updatedRows = dao.updateExecutor(patNo, actOrderNo, occTime, staff, caRes.getId());
|
|
|
- if (updatedRows > 0) {
|
|
|
- return ResultVoUtil.success("核对执行成功。");
|
|
|
+ if (scanType == 1) {
|
|
|
+ int updatedRows = dao.updateExecutor(patNo, actOrderNo, occTime, staff, caRes.getId());
|
|
|
+ if (updatedRows > 0) {
|
|
|
+ return ResultVoUtil.success("核对执行成功。");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ int updatedRows = dao.updateEndExecute(patNo, actOrderNo, occTime, staff);
|
|
|
+ if (updatedRows > 0) {
|
|
|
+ return ResultVoUtil.success("结束执行成功。");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR, "数据库出错,核对执行失败!");
|
|
|
}
|
|
|
return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR, "用药与医嘱不匹配,请检查!");
|