|
@ -180,6 +180,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
|
|
|
@Autowired
|
|
|
private PrescriptionCheckDao prescriptionCheckDao;
|
|
|
@Autowired
|
|
|
private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
|
|
|
|
|
|
|
|
|
@Value("${demo.flag}")
|
|
@ -442,7 +444,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}else{
|
|
|
rs.put("expressage",null);
|
|
|
}
|
|
|
/*
|
|
|
|
|
|
//物流配送新
|
|
|
List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
|
|
@ -452,7 +453,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}else{
|
|
|
rs.put("expressageLogs",null);
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
//预约记录
|
|
|
List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId);
|
|
@ -1847,10 +1847,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
//============================下诊断==============================================================
|
|
|
//删除之前诊断
|
|
|
List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(prescription.getId());
|
|
|
/* List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(prescription.getId());
|
|
|
if (ds != null && ds.size() > 0) {
|
|
|
prescriptionDiagnosisDao.delete(ds);
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = (List<WlyyPrescriptionDiagnosisDO>) com.alibaba.fastjson.JSONArray.parseArray(diagnosisJson, WlyyPrescriptionDiagnosisDO.class);
|
|
|
String Icd10 = "";
|
|
@ -1884,15 +1884,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
throw new RuntimeException("未找到医生映射信息");
|
|
|
}
|
|
|
|
|
|
//his处方拼接开方条件
|
|
|
com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
|
|
|
|
|
|
|
|
|
//===================药品操作======================================================
|
|
|
// 删除原有药品信息
|
|
|
List<WlyyPrescriptionInfoDO> oldInfos = prescriptionInfoDao.findByPrescriptionId(prescription.getId());
|
|
|
/*List<WlyyPrescriptionInfoDO> oldInfos = prescriptionInfoDao.findByPrescriptionId(prescription.getId());
|
|
|
if (oldInfos != null && oldInfos.size() > 0) {
|
|
|
prescriptionInfoDao.delete(oldInfos);
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
//存储药品,构建his开方入参
|
|
|
if (StringUtils.isNotBlank(infoJsons)) {
|
|
@ -1904,8 +1903,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
info.setDel(1);
|
|
|
info.setPrescriptionId(prescription.getId());
|
|
|
|
|
|
//设置his药品查询条件
|
|
|
setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, Icd10);
|
|
|
|
|
|
}
|
|
|
//保存药品信息
|
|
|
prescriptionInfoDao.save(infoDOs);
|
|
@ -1921,10 +1919,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
//=====================检查检验=======================================================================
|
|
|
//存储检查检验,构建his开方入参
|
|
|
//删除之前检查检验
|
|
|
List<WlyyInspectionDO> inspectionDels = wlyyInspectionDao.findByOutpatientId(outPatientId);
|
|
|
/*List<WlyyInspectionDO> inspectionDels = wlyyInspectionDao.findByOutpatientId(outPatientId);
|
|
|
if (inspectionDels != null && inspectionDels.size() > 0) {
|
|
|
wlyyInspectionDao.delete(inspectionDels);
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
if (StringUtils.isNotBlank(inspectionJson)) {
|
|
|
List<WlyyInspectionDO> inspections = (List<WlyyInspectionDO>) com.alibaba.fastjson.JSONArray.parseArray(inspectionJson, WlyyInspectionDO.class);
|
|
@ -1934,8 +1932,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
ins.setPrescriptionId(prescription.getId());
|
|
|
ins.setOutpatientId(outPatientId);
|
|
|
|
|
|
//设置his药品查询条件
|
|
|
setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, Icd10);
|
|
|
|
|
|
}
|
|
|
//保存检查检验。
|
|
|
wlyyInspectionDao.save(inspections);
|
|
@ -1947,6 +1944,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
//保存挂号费用
|
|
|
prescription.setRegFee(getChargeFee(outpatientDO.getDoctor()));
|
|
|
//=====================保存日志 start=========================================================
|
|
|
List<WlyyPrescriptionCheckDO> prescriptionCheckDOS = prescriptionCheckDao.findByStatus(prescription.getId(),5);
|
|
|
if (prescriptionCheckDOS==null || prescriptionCheckDOS.size() ==0){
|
|
|
savePrescriptionCheck(prescription.getDoctor(),"开具处方",5,prescription.getId());
|
|
|
}
|
|
|
|
|
|
//=====================保存日志 end=========================================================
|
|
|
//保存费用
|
|
|
prescriptionDao.save(prescription);
|
|
|
if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
|
|
@ -1971,13 +1975,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
Double price = 0.01;
|
|
|
businessOrderService.recharge(prescription.getId(),"处方收费","4","处方收费",prescription.getPatientCode(),prescription.getPatientName(),prescription.getDoctor(),price);
|
|
|
//上传his开方
|
|
|
return sendHisDiagnosis(jsonData, outpatientDO, prescription);
|
|
|
//sendHisDiagnosis(jsonData, outpatientDO, prescription)
|
|
|
//zsSynHis(prescription.getId());
|
|
|
return null;
|
|
|
}else {
|
|
|
result.put("code", 1);
|
|
|
result.put("mes", "诊断完成");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
} else {
|
|
|
outpatientDO.setStatus("2");
|
|
|
outpatientDao.save(outpatientDO);
|
|
@ -5227,7 +5234,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
sql +="\tp.status as \"status\",\n" +
|
|
|
"\tp.check_status as \"checkStatus\",\n" +
|
|
|
"\tp.check_reason as \"checkReason\"\n" +
|
|
|
"\tp.check_reason as \"checkReason\",\n" +
|
|
|
"\tp.pay_type as \"payType\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\twlyy_prescription P\n" +
|
|
|
"WHERE\n" +
|
|
@ -5330,7 +5338,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @param prescriptionId
|
|
|
* @return
|
|
|
*/
|
|
|
public WlyyPrescriptionCheckDO saveCheck(String operate,String operateName,String reason,Integer status,String prescriptionId){
|
|
|
public WlyyPrescriptionCheckDO saveCheck(String operate,String operateName,String reason,Integer status,String prescriptionId,String wxId){
|
|
|
WlyyPrescriptionCheckDO prescriptionCheckDO = new WlyyPrescriptionCheckDO();
|
|
|
prescriptionCheckDO.setCreateTime(new Date());
|
|
|
prescriptionCheckDO.setOperate(operate);
|
|
@ -5344,7 +5352,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
prescriptionCheckDO = prescriptionCheckDao.save(prescriptionCheckDO);
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
if (status==2){
|
|
|
prescriptionDao.updateCheckStatus(prescriptionId,4,reason,12);
|
|
|
prescriptionDao.updateCheckStatus(prescriptionId,2,reason,12);
|
|
|
/*if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
|
|
|
try {
|
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId);
|
|
|
List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId);
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
|
|
|
|
|
|
//his处方拼接开方条件
|
|
|
com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
|
|
|
for (WlyyPrescriptionInfoDO info:infoDOS){
|
|
|
//设置his药品查询条件
|
|
|
setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, outpatientDO.getIcd10());
|
|
|
}
|
|
|
|
|
|
for (WlyyInspectionDO ins:inspectionDOS){
|
|
|
//设置his药品查询条件
|
|
|
setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, outpatientDO.getIcd10());
|
|
|
}
|
|
|
sendHisDiagnosis(jsonData, outpatientDO, prescriptionDO);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}*/
|
|
|
}else{
|
|
|
wlyyPrescriptionDO.setCheckStatus(status);
|
|
|
wlyyPrescriptionDO.setCheckReason(reason);
|
|
@ -5403,7 +5435,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
wlyyPrescriptionDO.setCheckReason("未审核");
|
|
|
wlyyPrescriptionDO.setDealStatus(2);
|
|
|
wlyyPrescriptionDO.setDealReason(reason);
|
|
|
}else if (status==5){
|
|
|
wlyyPrescriptionDO.setCheckStatus(0);
|
|
|
wlyyPrescriptionDO.setCheckReason("未审核");
|
|
|
}
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
return prescriptionCheckDO;
|
|
|
}
|
|
|
|
|
@ -5442,11 +5478,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if (status==2){
|
|
|
systemMessageDO.setTitle("审方通过");
|
|
|
data.put("message","审方通过");
|
|
|
data.put("message","您为"+prescriptionDO.getPatientName()+"("+IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())+"岁 "+IdCardUtil.getSexForIdcard_new(prescriptionDO.getIdcard())+")开具的处方已审核通过。");
|
|
|
data.put("message","您为"+prescriptionDO.getPatientName()+"("+IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())+"岁 "+IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard())+")开具的处方已审核通过。");
|
|
|
} else if (status==1) {
|
|
|
systemMessageDO.setTitle("审方退回");
|
|
|
data.put("message","审方退回");
|
|
|
data.put("message","您为"+prescriptionDO.getPatientName()+"("+IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())+"岁 "+IdCardUtil.getSexForIdcard_new(prescriptionDO.getIdcard())+")开具的处方被审方退回,请尽快处理");
|
|
|
data.put("message","您为"+prescriptionDO.getPatientName()+"("+IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())+"岁 "+IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard())+")开具的处方被审方退回,请尽快处理");
|
|
|
}
|
|
|
systemMessageDO.setData(data.toString());
|
|
|
systemMessageService.saveMessage(systemMessageDO);
|
|
@ -5504,4 +5540,49 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void deleteById(Integer flag,String id){
|
|
|
if (flag ==1){
|
|
|
//药品
|
|
|
prescriptionInfoDao.deleteById(id);
|
|
|
}else if (flag==2){
|
|
|
//诊断
|
|
|
prescriptionDiagnosisDao.deleteById(id);
|
|
|
}else if (flag==3){
|
|
|
//检查检验
|
|
|
wlyyInspectionDao.deleteById(id);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void zsSynHis(String prescriptionId){
|
|
|
try {
|
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId);
|
|
|
List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId);
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
|
|
|
|
|
|
//his处方拼接开方条件
|
|
|
com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
|
|
|
for (WlyyPrescriptionInfoDO info:infoDOS){
|
|
|
//设置his药品查询条件
|
|
|
setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, outpatientDO.getIcd10());
|
|
|
}
|
|
|
|
|
|
for (WlyyInspectionDO ins:inspectionDOS){
|
|
|
//设置his药品查询条件
|
|
|
setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, outpatientDO.getIcd10());
|
|
|
}
|
|
|
sendHisDiagnosis(jsonData, outpatientDO, prescriptionDO);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|