|
@@ -191,10 +191,10 @@ public class YiZhuLuRuServer {
|
|
|
* @param code 拼音首字母,中文,编码来进行搜索
|
|
|
* @return 返回项目信息
|
|
|
*/
|
|
|
- public ResultVo<List<YiZhuMingChen>> huoQuXiangMu(String code) {
|
|
|
+ public ResultVo<List<YiZhuMingChen>> huoQuXiangMu(String code, String groupNo) {
|
|
|
code = StringUtil.isContainChinese(code);
|
|
|
// 药品
|
|
|
- List<YiZhuMingChen> list = dao.yiZhuYaoPing(code, publicServer.getGroupNo());
|
|
|
+ List<YiZhuMingChen> list = dao.yiZhuYaoPing(code, groupNo);
|
|
|
// 项目
|
|
|
list.addAll(dao.yiZhuXiangMu(code));
|
|
|
// 模板
|
|
@@ -929,56 +929,58 @@ public class YiZhuLuRuServer {
|
|
|
}
|
|
|
|
|
|
private Map<String, Object> checkData(XinZhenYzActOrder item, Map<String, XinZhenYzActOrder> drug, Map<String, List<XinZhenYzActOrder>> project, XinZhenYiZhu huanZheXinXi, Integer 医生级别) {
|
|
|
- boolean 严格校验 = huanZheXinXi != null;
|
|
|
- List<String> 错误信息 = new ArrayList<>();
|
|
|
- List<String> 警告信息 = new ArrayList<>();
|
|
|
-
|
|
|
+ boolean strictVerification = huanZheXinXi != null;
|
|
|
+ List<String> errorMessage = new ArrayList<>();
|
|
|
+ List<String> warningMessage = new ArrayList<>();
|
|
|
+ if (StringUtil.isBlank(item.getGroupNo())) {
|
|
|
+ errorMessage.add("没有药房请重新开。");
|
|
|
+ }
|
|
|
if (ITEM.equals(item.getSerial())) {
|
|
|
- List<XinZhenYzActOrder> 项目明细 = project.get(item.getOrderCode());
|
|
|
+ List<XinZhenYzActOrder> projectDetails = project.get(item.getOrderCode());
|
|
|
// 如果这个项目下面没有费用明细,那么这就是一条口头医,口头医嘱每次只能开一个
|
|
|
- if (ListUtil.notBlank(项目明细)) {
|
|
|
- for (XinZhenYzActOrder 明细 : 项目明细) {
|
|
|
- if (明细.getDelFlag() == 1) {
|
|
|
- 错误信息.add(String.format("项目:【%s】,已经被物价停用了", 明细.getOrderName()));
|
|
|
+ if (ListUtil.notBlank(projectDetails)) {
|
|
|
+ for (XinZhenYzActOrder detailed : projectDetails) {
|
|
|
+ if (detailed.getDelFlag() == 1) {
|
|
|
+ errorMessage.add(String.format("项目:【%s】,已经被物价停用了", detailed.getOrderName()));
|
|
|
}
|
|
|
- if (StringUtil.isBlank(明细.getNationalCode())) {
|
|
|
- 警告信息.add(String.format("项目:【%s】,没有匹配医保码", 明细.getOrderName()));
|
|
|
+ if (StringUtil.isBlank(detailed.getNationalCode())) {
|
|
|
+ warningMessage.add(String.format("项目:【%s】,没有匹配医保码", detailed.getOrderName()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
item.setDrugOcc(item.getDrugQuan());
|
|
|
} else {
|
|
|
- XinZhenYzActOrder feiYongXinXi = drug.get(item.getOrderCode().trim() + item.getSerial().trim() + item.getGroupNo().trim());
|
|
|
- if (feiYongXinXi != null) {
|
|
|
- if (feiYongXinXi.getDelFlag() == 1) {
|
|
|
- 错误信息.add("药品已经被停用了,请联系药剂科");
|
|
|
+ XinZhenYzActOrder detailsOfDrugs = drug.get(item.getOrderCode().trim() + item.getSerial().trim() + item.getGroupNo().trim());
|
|
|
+ if (detailsOfDrugs != null) {
|
|
|
+ if (detailsOfDrugs.getDelFlag() == 1) {
|
|
|
+ errorMessage.add("药品已经被停用了,请联系药剂科");
|
|
|
}
|
|
|
- if (feiYongXinXi.getYpLevel() > 医生级别) {
|
|
|
- 错误信息.add("您没有开此药品的权限");
|
|
|
+ if (detailsOfDrugs.getYpLevel() > 医生级别) {
|
|
|
+ errorMessage.add("您没有开此药品的权限");
|
|
|
}
|
|
|
- if (StringUtil.isBlank(feiYongXinXi.getNationalCode())) {
|
|
|
- 警告信息.add("该药品没有医保编码");
|
|
|
+ if (StringUtil.isBlank(detailsOfDrugs.getNationalCode())) {
|
|
|
+ warningMessage.add("该药品没有医保编码");
|
|
|
}
|
|
|
- if (BigUtils.bigXiaoYu(feiYongXinXi.getStockAmount(), 10)) {
|
|
|
- 警告信息.add(String.format("该药品剩余数量为:【%s】", feiYongXinXi.getStockAmount().stripTrailingZeros().toPlainString()));
|
|
|
+ if (BigUtils.bigXiaoYu(detailsOfDrugs.getStockAmount(), 10)) {
|
|
|
+ warningMessage.add(String.format("该药品剩余数量为:【%s】", detailsOfDrugs.getStockAmount().stripTrailingZeros().toPlainString()));
|
|
|
}
|
|
|
- if (BigUtils.bigDaYu(item.getDrugQuan(), feiYongXinXi.getStockAmount())) {
|
|
|
- 错误信息.add("药品领量大于药品的库存,当前库存量" + feiYongXinXi.getStockAmount().stripTrailingZeros().toPlainString());
|
|
|
+ if (BigUtils.bigDaYu(item.getDrugQuan(), detailsOfDrugs.getStockAmount())) {
|
|
|
+ errorMessage.add("药品领量大于药品的库存,当前库存量" + detailsOfDrugs.getStockAmount().stripTrailingZeros().toPlainString());
|
|
|
}
|
|
|
- if (严格校验) {
|
|
|
- if (feiYongXinXi.getDeptRestrictions() > 0) {
|
|
|
- 错误信息.add("该药品禁止在患者所在的科室使用。");
|
|
|
+ if (strictVerification) {
|
|
|
+ if (detailsOfDrugs.getDeptRestrictions() > 0) {
|
|
|
+ errorMessage.add("该药品禁止在患者所在的科室使用。");
|
|
|
}
|
|
|
- if (feiYongXinXi.getVisibleFlagZy() == 1) {
|
|
|
- 错误信息.add("该药品禁止住院患者使用。");
|
|
|
+ if (detailsOfDrugs.getVisibleFlagZy() == 1) {
|
|
|
+ errorMessage.add("该药品禁止住院患者使用。");
|
|
|
}
|
|
|
- item.setKjywFlag(feiYongXinXi.getKjywFlag());
|
|
|
- if (feiYongXinXi.getKjywFlag() == 1) {
|
|
|
+ item.setKjywFlag(detailsOfDrugs.getKjywFlag());
|
|
|
+ if (detailsOfDrugs.getKjywFlag() == 1) {
|
|
|
if (item.getYyfs() == null) {
|
|
|
- 错误信息.add("请填写抗菌药物医嘱附注信息录入");
|
|
|
+ errorMessage.add("请填写抗菌药物医嘱附注信息录入");
|
|
|
} else if (item.getYyfs() == 1 || item.getYyfs() == 2) {
|
|
|
if (item.getSsqk() == null) {
|
|
|
- 错误信息.add("当用药方式为 1 或 2 时,手术切口和用药时间不能为空");
|
|
|
+ errorMessage.add("当用药方式为 1 或 2 时,手术切口和用药时间不能为空");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -989,101 +991,101 @@ public class YiZhuLuRuServer {
|
|
|
item.setEndTime(item.getStartTime());
|
|
|
}
|
|
|
if (dao.dischargeWithMedicationAdministration(item.getSupplyCode()) == 0) {
|
|
|
- 错误信息.add("出院带药给药方式不能包含费用。");
|
|
|
+ errorMessage.add("出院带药给药方式不能包含费用。");
|
|
|
}
|
|
|
|
|
|
int day = 1;
|
|
|
if (item.getStartTime() == null) {
|
|
|
- 错误信息.add("出院带药请输入开始时间。");
|
|
|
+ errorMessage.add("出院带药请输入开始时间。");
|
|
|
}
|
|
|
if (item.getEndTime() == null) {
|
|
|
- 错误信息.add("出院带药请输入结束时间。");
|
|
|
+ errorMessage.add("出院带药请输入结束时间。");
|
|
|
} else {
|
|
|
long cha = item.getEndTime().getTime() - item.getStartTime().getTime();
|
|
|
long nd = 1000 * 24 * 60 * 60;
|
|
|
day = (int) (cha / nd);
|
|
|
if (day > 出院带药限制天数) {
|
|
|
- 错误信息.add("出院带药天数不得超过 15 天,计算方式结束时间减去开始时间。");
|
|
|
+ errorMessage.add("出院带药天数不得超过 15 天,计算方式结束时间减去开始时间。");
|
|
|
}
|
|
|
}
|
|
|
BigDecimal total = getTotal(item, day);
|
|
|
- if (StringUtil.notBlank(feiYongXinXi.getDrugWeightUnit()) && item.getDoseUnit().trim().equals(feiYongXinXi.getDrugWeightUnit().trim())) {
|
|
|
- item.setDrugQuan(DecimalUtil.multiply(item.getDose(), total).divide(feiYongXinXi.getDrugWeight(), 0, RoundingMode.UP));
|
|
|
+ if (StringUtil.notBlank(detailsOfDrugs.getDrugWeightUnit()) && item.getDoseUnit().trim().equals(detailsOfDrugs.getDrugWeightUnit().trim())) {
|
|
|
+ item.setDrugQuan(DecimalUtil.multiply(item.getDose(), total).divide(detailsOfDrugs.getDrugWeight(), 0, RoundingMode.UP));
|
|
|
item.setDrugOcc(item.getDrugQuan());
|
|
|
- } else if (StringUtil.notBlank(feiYongXinXi.getDrugVolUnit()) && item.getDoseUnit().trim().equals(feiYongXinXi.getDrugVolUnit())) {
|
|
|
- item.setDrugQuan(DecimalUtil.multiply(item.getDose(), total).divide(feiYongXinXi.getDrugVolume(), 0, RoundingMode.UP));
|
|
|
+ } else if (StringUtil.notBlank(detailsOfDrugs.getDrugVolUnit()) && item.getDoseUnit().trim().equals(detailsOfDrugs.getDrugVolUnit())) {
|
|
|
+ item.setDrugQuan(DecimalUtil.multiply(item.getDose(), total).divide(detailsOfDrugs.getDrugVolume(), 0, RoundingMode.UP));
|
|
|
item.setDrugOcc(item.getDrugQuan());
|
|
|
- } else if (StringUtil.notBlank(feiYongXinXi.getPackUnit()) && item.getDoseUnit().trim().equals(feiYongXinXi.getPackUnit())) {
|
|
|
+ } else if (StringUtil.notBlank(detailsOfDrugs.getPackUnit()) && item.getDoseUnit().trim().equals(detailsOfDrugs.getPackUnit())) {
|
|
|
if (new BigDecimal(item.getDose().intValue()).compareTo(item.getDose()) != 0) {
|
|
|
- 错误信息.add("已经是最小单位了请不要带小数点");
|
|
|
+ errorMessage.add("已经是最小单位了请不要带小数点");
|
|
|
}
|
|
|
- item.setDrugQuan(DecimalUtil.multiply(item.getDose(), total).divide(feiYongXinXi.getPackSize(), 0, RoundingMode.UP));
|
|
|
+ item.setDrugQuan(DecimalUtil.multiply(item.getDose(), total).divide(detailsOfDrugs.getPackSize(), 0, RoundingMode.UP));
|
|
|
item.setDrugOcc(item.getDrugQuan());
|
|
|
}
|
|
|
} else {
|
|
|
// 计算普通药品的领量 durg_quan durg_occ
|
|
|
- calculateDrugAmount(item, feiYongXinXi, 错误信息);
|
|
|
+ calculateDrugAmount(item, detailsOfDrugs, errorMessage);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (StringUtil.isBlank(item.getOrderCode())) {
|
|
|
- 错误信息.add("项目编码不能为空");
|
|
|
+ errorMessage.add("项目编码不能为空");
|
|
|
}
|
|
|
if (StringUtil.isBlank(item.getOrderName())) {
|
|
|
- 错误信息.add("项目名称不能为空");
|
|
|
+ errorMessage.add("项目名称不能为空");
|
|
|
}
|
|
|
if (StringUtil.isBlank(item.getExecUnit())) {
|
|
|
- 错误信息.add("执行科室不能为空");
|
|
|
+ errorMessage.add("执行科室不能为空");
|
|
|
} else if (item.getExecUnit().startsWith("8")) {
|
|
|
- 错误信息.add("执行科室不能选择为病区");
|
|
|
+ errorMessage.add("执行科室不能选择为病区");
|
|
|
}
|
|
|
|
|
|
if (ZK_CODE.equals(item.getOrderCode())) {
|
|
|
if (StringUtil.isBlank(item.getZkWardCode())) {
|
|
|
- 错误信息.add("转科病房不能为空");
|
|
|
+ errorMessage.add("转科病房不能为空");
|
|
|
}
|
|
|
if (StringUtil.isBlank(item.getZkDeptCode())) {
|
|
|
- 错误信息.add("转科科室不能为空");
|
|
|
+ errorMessage.add("转科科室不能为空");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (StringUtil.isBlank(item.getFrequCode())) {
|
|
|
- 错误信息.add("频次不能为空");
|
|
|
+ errorMessage.add("频次不能为空");
|
|
|
}
|
|
|
|
|
|
// 药品的校验
|
|
|
if (!ITEM.equals(item.getSerial().trim())) {
|
|
|
if (StringUtil.isBlank(item.getDrugSpecification())) {
|
|
|
- 错误信息.add("药品规格不能为空");
|
|
|
+ errorMessage.add("药品规格不能为空");
|
|
|
}
|
|
|
if (StringUtil.isBlank(item.getSupplyCode())) {
|
|
|
- 错误信息.add("给药方式不能为空");
|
|
|
+ errorMessage.add("给药方式不能为空");
|
|
|
}
|
|
|
if (item.getDose() == null || BigUtils.dengYu(item.getDose(), 0)) {
|
|
|
- 错误信息.add("一次计量不能为空");
|
|
|
+ errorMessage.add("一次计量不能为空");
|
|
|
}
|
|
|
if (StringUtil.isBlank(item.getDoseUnit())) {
|
|
|
- 错误信息.add("计量单位不能为空");
|
|
|
+ errorMessage.add("计量单位不能为空");
|
|
|
}
|
|
|
if (StringUtil.isBlank(item.getSerial())) {
|
|
|
- 错误信息.add("包装大小不能为空");
|
|
|
+ errorMessage.add("包装大小不能为空");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (严格校验) {
|
|
|
+ if (strictVerification) {
|
|
|
// 获取患者的入院时间
|
|
|
if (item.getOrderTime() == null) {
|
|
|
- 错误信息.add("医嘱时间不能为空");
|
|
|
+ errorMessage.add("医嘱时间不能为空");
|
|
|
} else if (item.getStartTime() == null) {
|
|
|
- 错误信息.add("开始时间不能为空");
|
|
|
+ errorMessage.add("开始时间不能为空");
|
|
|
} else if (huanZheXinXi.getAdmissDate() == null) {
|
|
|
- 错误信息.add("没有查询到患者的入院时间");
|
|
|
+ errorMessage.add("没有查询到患者的入院时间");
|
|
|
} else if (DateUtil.shiJianDaXiao(item.getStartTime(), huanZheXinXi.getAdmissDate(), "<")) {
|
|
|
- 错误信息.add("开始时间不能在患者入院之前,患者入院时间" + DateUtil.formatDatetime(huanZheXinXi.getAdmissDate()));
|
|
|
+ errorMessage.add("开始时间不能在患者入院之前,患者入院时间" + DateUtil.formatDatetime(huanZheXinXi.getAdmissDate()));
|
|
|
} else if (DateUtil.shiJianDaXiao(item.getStartTime(), item.getOrderTime(), "<")) {
|
|
|
- 错误信息.add("开始时间不能在开医嘱之前");
|
|
|
+ errorMessage.add("开始时间不能在开医嘱之前");
|
|
|
}
|
|
|
|
|
|
if (item.getEndTime() != null) {
|
|
@@ -1091,18 +1093,18 @@ public class YiZhuLuRuServer {
|
|
|
item.setEndTime(null);
|
|
|
} else {
|
|
|
if (DateUtil.shiJianDaXiao(item.getEndTime(), item.getStartTime(), "<")) {
|
|
|
- 错误信息.add("结束时间不能在开始时间之前");
|
|
|
+ errorMessage.add("结束时间不能在开始时间之前");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(Capacity.TWO);
|
|
|
- if (ListUtil.notBlank(错误信息)) {
|
|
|
- map.put("error", 错误信息);
|
|
|
+ if (ListUtil.notBlank(errorMessage)) {
|
|
|
+ map.put("error", errorMessage);
|
|
|
}
|
|
|
- if (ListUtil.notBlank(警告信息)) {
|
|
|
- map.put("warning", 警告信息);
|
|
|
+ if (ListUtil.notBlank(warningMessage)) {
|
|
|
+ map.put("warning", warningMessage);
|
|
|
}
|
|
|
return map;
|
|
|
}
|