|
@@ -14,7 +14,6 @@ import cn.hnthyy.thmz.entity.his.zd.JcZdItem;
|
|
|
import cn.hnthyy.thmz.entity.his.zd.JyZdItem;
|
|
|
import cn.hnthyy.thmz.entity.his.zd.MzZdYpYsh;
|
|
|
import cn.hnthyy.thmz.entity.his.zd.ZdChargeItem;
|
|
|
-import cn.hnthyy.thmz.entity.jy.InspectionsIndex;
|
|
|
import cn.hnthyy.thmz.entity.thmz.*;
|
|
|
import cn.hnthyy.thmz.enums.*;
|
|
|
import cn.hnthyy.thmz.mapper.his.mz.*;
|
|
@@ -657,12 +656,13 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
returnMzChargeDetails.add(mzChargeDetail1);
|
|
|
}
|
|
|
//按时间倒序排序
|
|
|
- Collections.sort(returnMzChargeDetails, new Comparator(){
|
|
|
+ Collections.sort(returnMzChargeDetails, new Comparator() {
|
|
|
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
@Override
|
|
|
public int compare(Object o1, Object o2) {
|
|
|
- MzChargeDetail i1 =(MzChargeDetail)o1;
|
|
|
- MzChargeDetail i2 =(MzChargeDetail)o2;
|
|
|
+ MzChargeDetail i1 = (MzChargeDetail) o1;
|
|
|
+ MzChargeDetail i2 = (MzChargeDetail) o2;
|
|
|
return (i2.getPriceTime()).compareTo(i1.getPriceTime());
|
|
|
}
|
|
|
});
|
|
@@ -1134,8 +1134,31 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
return clinic;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
|
|
|
+ public int deletePrescription(Long clnicId,User tokenUser) throws MzException {
|
|
|
+ Clinic clinic = clinicMapper.selectById(clnicId);
|
|
|
+ if (clinic == null) {
|
|
|
+ throw new MzException("删除处方失败,患者就诊记录不存在!");
|
|
|
+ }
|
|
|
+ if (!ClinicStatusEnum.HAD_CLINIC.code.equals(clinic.getClinicStatus())) {
|
|
|
+ throw new MzException("删除处方失败,处方当前状态非未缴费状态,禁止删除!");
|
|
|
+ }
|
|
|
+ if(!clinic.getOpId().equals(tokenUser.getUserIdCode())){
|
|
|
+ throw new MzException("删除处方失败,禁止删除非本人开立处方!");
|
|
|
+ }
|
|
|
+ int num = clinicMapper.deleteById(clnicId);
|
|
|
+ mzVisitTableMapper.deleteByPatientIdAndTimes(clinic.getPatientId(), clinic.getTimes());
|
|
|
+ mzBaRecordMapper.deleteByPatientIdAndTimes(clinic.getPatientId(), clinic.getTimes());
|
|
|
+ mzBlRecordMapper.deleteNotPayBlRecordByPatientId(clinic.getPatientId(), clinic.getTimes());
|
|
|
+ mzChargeDetailMapper.deleteNotPayMzChargeDetailByPatientId(clinic.getPatientId(), clinic.getTimes());
|
|
|
+ mzYjReqMapper.deleteNotPayYjReByPatientId(clinic.getPatientId(), clinic.getTimes());
|
|
|
+ return num;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 判断当前患者的本次挂号是否是急诊号子
|
|
|
+ *
|
|
|
* @param mzPrescriptionVo
|
|
|
* @param mzPatientMi
|
|
|
* @return
|
|
@@ -1145,13 +1168,13 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
mzfzPatientOrder.setTableName(MzfzPatientOrder.MZFZ_PATIENT_ORDER);
|
|
|
mzfzPatientOrder.setPatientId(mzPatientMi.getPatientId());
|
|
|
mzfzPatientOrder.setDeptCode(mzPrescriptionVo.getVisitDeptCode());
|
|
|
- List<String> jzCodes=mzyZdChargeTypeService.queryCodesByReqType(Constants.JZ_CODE);
|
|
|
- if(jzCodes!=null && jzCodes.size()>0){
|
|
|
+ List<String> jzCodes = mzyZdChargeTypeService.queryCodesByReqType(Constants.JZ_CODE);
|
|
|
+ if (jzCodes != null && jzCodes.size() > 0) {
|
|
|
mzfzPatientOrder.setReqTypes(jzCodes);
|
|
|
}
|
|
|
mzfzPatientOrder.setEndTime(DateUtil.fomart(DateUtil.getLastSecond(new Date()), "yyyy-MM-dd HH:mm:ss"));
|
|
|
Integer total = mzfzPatientOrderService.querycountUnClinic(mzfzPatientOrder);
|
|
|
- return total>0?YesNoEnum.YES.code:YesNoEnum.NO.code;
|
|
|
+ return total > 0 ? YesNoEnum.YES.code : YesNoEnum.NO.code;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1272,7 +1295,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
tempMap.put("frequency", orderFrequencyEnum != null ? orderFrequencyEnum.name : "");
|
|
|
tempMap.put("cyJssm", mzChargeDetail.getCyJssm() != null ? mzChargeDetail.getCyJssm() : "");
|
|
|
//SupplyTypeEnum supplyTypeEnum = SupplyTypeEnum.getSupplyTypeByCode(mzChargeDetail.getCyDj());
|
|
|
- MzZdSupplyType mzZdSupplyType=mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getCyDj());
|
|
|
+ MzZdSupplyType mzZdSupplyType = mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getCyDj());
|
|
|
tempMap.put("cyDj", mzZdSupplyType != null ? mzZdSupplyType.getSupplyName() : "");
|
|
|
CyFysmEnum cyFysmEnum = CyFysmEnum.geteCyFysmByCode(mzChargeDetail.getCyFysm() == null ? null : mzChargeDetail.getCyFysm().toString());
|
|
|
tempMap.put("cyFysm", cyFysmEnum != null ? cyFysmEnum.name : "");
|
|
@@ -1406,7 +1429,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
name += mzChargeDetail.getQuantity() + UnitTypeEnum.getUnitTypeByCode(ypZdDict.getPackUnit()).name;
|
|
|
// name += " 共" + mzChargeDetail.getQuantity() + UnitTypeEnum.getUnitTypeByCode(ypZdDict.getPackUnit()).name;
|
|
|
if (StringUtils.isNotBlank(mzChargeDetail.getSupplyCode())) {
|
|
|
- MzZdSupplyType mzZdSupplyType=mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getSupplyCode());
|
|
|
+ MzZdSupplyType mzZdSupplyType = mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getSupplyCode());
|
|
|
//SupplyTypeEnum supplyTypeEnum = SupplyTypeEnum.getSupplyTypeByCode(mzChargeDetail.getSupplyCode());
|
|
|
if (mzZdSupplyType != null) {
|
|
|
name += " 用法:" + mzZdSupplyType.getSupplyName();
|
|
@@ -1962,11 +1985,11 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
throw new MzException("保存处方失败,第" + itemNo + "行药品频率不能为空");
|
|
|
}
|
|
|
if (needVerify) {
|
|
|
- String groupNo=Constants.XY_ZCY_GROUP_NO;
|
|
|
+ String groupNo = Constants.XY_ZCY_GROUP_NO;
|
|
|
if (Constants.CLF.equals(ypZdDict.getBillItemMz())) {
|
|
|
- groupNo=Constants.YC_GROUP_NO;
|
|
|
+ groupNo = Constants.YC_GROUP_NO;
|
|
|
}
|
|
|
- YpBaseYf ypBaseYf = ypBaseYfMapper.selectYpBaseYf(ypZdDict.getCode(), ypZdDict.getSerial(), groupNo,YesNoEnum.NO.code.toString());
|
|
|
+ YpBaseYf ypBaseYf = ypBaseYfMapper.selectYpBaseYf(ypZdDict.getCode(), ypZdDict.getSerial(), groupNo, YesNoEnum.NO.code.toString());
|
|
|
if (ypBaseYf == null) {
|
|
|
throw new MzException("无药品【" + ypZdDict.getName() + "】编码【" + ypZdDict.getCode() + "】的库存信息!");
|
|
|
}
|
|
@@ -1975,7 +1998,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
}
|
|
|
if (Constants.CLF.equals(ypZdDict.getBillItemMz())) {
|
|
|
- YpBaseYf ycBaseYf = ypBaseYfMapper.selectYpBaseYf(ypZdDict.getCode(), ypZdDict.getSerial(), Constants.YC_GROUP_NO,YesNoEnum.NO.code.toString());
|
|
|
+ YpBaseYf ycBaseYf = ypBaseYfMapper.selectYpBaseYf(ypZdDict.getCode(), ypZdDict.getSerial(), Constants.YC_GROUP_NO, YesNoEnum.NO.code.toString());
|
|
|
if (ycBaseYf != null) {
|
|
|
mzChargeDetail.setGroupNo(Constants.YC_GROUP_NO);
|
|
|
mzChargeDetail.setExecDept(Constants.YC_EXEC_CODE);
|
|
@@ -1986,7 +2009,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
mzChargeDetail.setSupplyAmount(mzChargeDetail.getOrderDays() * OrderFrequencyEnum.getOrderFrequencyByCode(mzChargeDetail.getFrequency()).times);
|
|
|
if (setEmrProcess) {
|
|
|
xyIndex++;
|
|
|
- MzZdSupplyType mzZdSupplyType=mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getSupplyCode());
|
|
|
+ MzZdSupplyType mzZdSupplyType = mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getSupplyCode());
|
|
|
//SupplyTypeEnum supplyType = SupplyTypeEnum.getSupplyTypeByCode(mzChargeDetail.getSupplyCode());
|
|
|
OrderFrequencyEnum orderFrequency = OrderFrequencyEnum.getOrderFrequencyByCode(mzChargeDetail.getFrequency());
|
|
|
String value = xyIndex + "." + mzChargeDetail.getTcName() + " " + mzChargeDetail.getQuantity() + ypZdDict.getPackUnit() + " 用法:" + (mzZdSupplyType != null ? mzZdSupplyType.getSupplyName() : "") + " 频次:" + (orderFrequency != null ? orderFrequency.name : "") + " ";
|
|
@@ -2064,7 +2087,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
mzChargeDetail.setGlPercent(BigDecimal.ONE);
|
|
|
mzChargeDetail.setDoctorCode(mzPrescriptionVo.getDoctorCode());
|
|
|
mzChargeDetail.setName(mzPatientMi.getName());
|
|
|
- mzChargeDetail.setResponceType(mzPatientMi==null?Constants.SELF_PAYING_RESPONCE_TYPE:mzPatientMi.getResponseType());
|
|
|
+ mzChargeDetail.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
|
|
|
mzChargeDetail.setYbbxFlag("");
|
|
|
mzChargeDetail.setTcNo("");
|
|
|
mzChargeDetail.setDetailFlag(YesNoEnum.NO.code.toString());
|
|
@@ -2094,19 +2117,19 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
mzZyReq.setIcdTextNew(mzPrescriptionVo.getIcdText());
|
|
|
if (mzZyReq.getIcdCodeNew() != null && mzZyReq.getIcdCodeNew().length() > 10) {
|
|
|
mzZyReq.setIcdCode(mzZyReq.getIcdCodeNew().substring(0, 9));
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
mzZyReq.setIcdCode(mzZyReq.getIcdCodeNew());
|
|
|
}
|
|
|
if (mzZyReq.getIcdTextNew() != null && mzZyReq.getIcdTextNew().length() > 25) {
|
|
|
mzZyReq.setIcdText(mzZyReq.getIcdTextNew().substring(0, 20));
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
mzZyReq.setIcdText(mzZyReq.getIcdTextNew());
|
|
|
}
|
|
|
if (StringUtils.isBlank(mzZyReq.getIcdText())) {
|
|
|
- if(StringUtils.isNotBlank(mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis())){
|
|
|
+ if (StringUtils.isNotBlank(mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis())) {
|
|
|
mzZyReq.setIcdTextNew(mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis());
|
|
|
mzZyReq.setIcdText(mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis());
|
|
|
- if(mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis().length()>25){
|
|
|
+ if (mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis().length() > 25) {
|
|
|
mzZyReq.setIcdText(mzZyReq.getIcdTextNew().substring(0, 20));
|
|
|
}
|
|
|
}
|
|
@@ -2171,7 +2194,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
|
|
|
@Override
|
|
|
public Integer queryCountMzChargeDetailByPatientIdAndChargeItemCode(String patientId, String chargeItemCode) {
|
|
|
- return mzChargeDetailMapper.selectCountMzChargeDetailByPatientIdAndChargeItemCode(patientId,chargeItemCode);
|
|
|
+ return mzChargeDetailMapper.selectCountMzChargeDetailByPatientIdAndChargeItemCode(patientId, chargeItemCode);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -2181,7 +2204,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
throw new MzException("当前挂号的病人信息不存在,请先保存病人信息!");
|
|
|
}
|
|
|
//自助开核酸的时候更新病人年龄
|
|
|
- if(mzPatientMi.getBirthDay()!=null){
|
|
|
+ if (mzPatientMi.getBirthDay() != null) {
|
|
|
int age = DateUtil.getAge(mzPatientMi.getBirthDay());
|
|
|
mzPatientMi.setAge(age);
|
|
|
mzPatientMiMapper.updateMzPatientMi(mzPatientMi);
|
|
@@ -2230,7 +2253,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
throw new MzException("当前挂号的病人信息不存在,请先保存病人信息!");
|
|
|
}
|
|
|
//自助开核酸的时候更新病人年龄
|
|
|
- if(mzPatientMi.getBirthDay()!=null){
|
|
|
+ if (mzPatientMi.getBirthDay() != null) {
|
|
|
int age = DateUtil.getAge(mzPatientMi.getBirthDay());
|
|
|
mzPatientMi.setAge(age);
|
|
|
mzPatientMiMapper.updateMzPatientMi(mzPatientMi);
|
|
@@ -2498,8 +2521,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
icdText += mzVisitTable.getIcdText();
|
|
|
}
|
|
|
//诊断太长导致处方分页
|
|
|
- if(icdText.length()>60){
|
|
|
- icdText=icdText.substring(0,60);
|
|
|
+ if (icdText.length() > 60) {
|
|
|
+ icdText = icdText.substring(0, 60);
|
|
|
}
|
|
|
mzPrescriptionVo.setIcdText(icdText);
|
|
|
mzPrescriptionVo.setMzBlRecord(mzBlRecord);
|
|
@@ -2533,9 +2556,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
//是给药方式产生的诊疗项目,不添加进构造的处方
|
|
|
if (supplyChargeItemCodeSet != null && supplyChargeItemCodeSet.contains(mzChargeDetail.getChargeItemCode())) {
|
|
|
supplyList.add(mzChargeDetail);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
YpZdDict ypZdDict = ypZdDictService.queryYpZdDictByCodeAndSerial(mzChargeDetail.getChargeItemCode(), mzChargeDetail.getSerial());
|
|
|
- if(ypZdDict!=null && StringUtils.isNotBlank(ypZdDict.getName())){
|
|
|
+ if (ypZdDict != null && StringUtils.isNotBlank(ypZdDict.getName())) {
|
|
|
mzChargeDetail.setTcName(ypZdDict.getName());
|
|
|
}
|
|
|
}
|
|
@@ -4086,7 +4109,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
newMzChargeDetail.setOrderBill(0);
|
|
|
newMzChargeDetail.setChargeBillCode(Constants.SSWR_BILL_ITEM_CODE);
|
|
|
newMzChargeDetail.setSelfFlag(YesNoEnum.NO.code.toString());
|
|
|
- newMzChargeDetail.setResponceType(mzPatientMi==null?Constants.SELF_PAYING_RESPONCE_TYPE:mzPatientMi.getResponseType());
|
|
|
+ newMzChargeDetail.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
|
|
|
newMzChargeDetail.setGlPercentFt(BigDecimal.ONE);
|
|
|
newMzChargeDetail.setOrigPrice(newMzChargeDetail.getUnitPrice());
|
|
|
newMzChargeDetail.setTcName("四舍五入");
|
|
@@ -4180,7 +4203,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
String chargeBillCode = Constants.BILL_ITEM_CODE_prev + zdChargeItem.getBillItemMz().substring(1);
|
|
|
newMzChargeDetail.setChargeBillCode(chargeBillCode);
|
|
|
newMzChargeDetail.setSelfFlag(YesNoEnum.NO.code.toString());
|
|
|
- newMzChargeDetail.setResponceType(mzPatientMi==null?Constants.SELF_PAYING_RESPONCE_TYPE:mzPatientMi.getResponseType());
|
|
|
+ newMzChargeDetail.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
|
|
|
newMzChargeDetail.setGlPercentFt(BigDecimal.ONE);
|
|
|
newMzChargeDetail.setReqYj(YesNoEnum.YES.code.toString());
|
|
|
newMzChargeDetail.setGroupId(YesNoEnum.NO.code);
|
|
@@ -4269,7 +4292,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
String chargeBillCode = Constants.BILL_ITEM_CODE_prev + zdChargeItem.getBillItemMz().substring(1);
|
|
|
newMzChargeDetail.setChargeBillCode(chargeBillCode);
|
|
|
newMzChargeDetail.setSelfFlag(YesNoEnum.NO.code.toString());
|
|
|
- newMzChargeDetail.setResponceType(mzPatientMi==null?Constants.SELF_PAYING_RESPONCE_TYPE:mzPatientMi.getResponseType());
|
|
|
+ newMzChargeDetail.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
|
|
|
newMzChargeDetail.setGlPercentFt(BigDecimal.ONE);
|
|
|
newMzChargeDetail.setReqYj(YesNoEnum.YES.code.toString());
|
|
|
newMzChargeDetail.setGroupId(YesNoEnum.YES.code);
|
|
@@ -4582,7 +4605,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
newMzChargeDetail.setOrderBill(0);
|
|
|
newMzChargeDetail.setChargeBillCode(newMzChargeDetail.getChargeItemCode());
|
|
|
newMzChargeDetail.setSelfFlag(YesNoEnum.NO.code.toString());
|
|
|
- newMzChargeDetail.setResponceType(mzPatientMi==null?Constants.SELF_PAYING_RESPONCE_TYPE:mzPatientMi.getResponseType());
|
|
|
+ newMzChargeDetail.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
|
|
|
newMzChargeDetail.setGlPercentFt(BigDecimal.ONE);
|
|
|
newMzChargeDetail.setOrigPrice(BigDecimal.ZERO);
|
|
|
newMzChargeDetail.setReqYj(YesNoEnum.YES.code.toString());
|
|
@@ -4669,7 +4692,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
String chargeBillCode = Constants.BILL_ITEM_CODE_prev + zdChargeItem.getBillItemMz().substring(1);
|
|
|
newMzChargeDetail.setChargeBillCode(chargeBillCode);
|
|
|
newMzChargeDetail.setSelfFlag(YesNoEnum.NO.code.toString());
|
|
|
- newMzChargeDetail.setResponceType(mzPatientMi==null?Constants.SELF_PAYING_RESPONCE_TYPE:mzPatientMi.getResponseType());
|
|
|
+ newMzChargeDetail.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
|
|
|
newMzChargeDetail.setGlPercentFt(BigDecimal.ONE);
|
|
|
newMzChargeDetail.setOrigPrice(zdChargeItem.getChargeAmount());
|
|
|
newMzChargeDetail.setReqYj(YesNoEnum.YES.code.toString());
|