|
@ -54,7 +54,6 @@ import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
|
|
|
import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.*;
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
@ -72,7 +71,6 @@ import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.checkerframework.checker.units.qual.A;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -5208,7 +5206,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
|
|
|
|
|
|
public List<Map<String,Object>> selectByCondition(String hospital, String dept, String status, String startTime, String endTime, String nameInfo, Integer page, Integer pagesize, String wxId){
|
|
|
public List<Map<String,Object>> selectByCondition(String hospital, String dept, String checkStatus, String startTime, String endTime, String nameInfo, Integer page, Integer pagesize, String wxId){
|
|
|
List<Map<String,Object>> maps = new ArrayList<>();
|
|
|
String sql = "SELECT\n" +
|
|
|
"\tp.doctor as \"doctor\",\n" +
|
|
@ -5227,7 +5225,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}else{
|
|
|
sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' ) AS \"createTime\",";
|
|
|
}
|
|
|
sql +="\tp.`status` as \"status\"\n" +
|
|
|
sql +="\tp.status as \"status\",\n" +
|
|
|
"\tp.check_status as \"checkStatus\",\n" +
|
|
|
"\tp.check_reason as \"checkReason\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\twlyy_prescription P\n" +
|
|
|
"WHERE\n" +
|
|
@ -5241,9 +5241,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
sql +=" and p.dept =:dept";
|
|
|
params.put("dept",dept);
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(status)){
|
|
|
sql +=" and p.status =:status";
|
|
|
params.put("status",status);
|
|
|
if (StringUtils.isNoneBlank(checkStatus)){
|
|
|
sql +=" and p.check_status =:checkStatus";
|
|
|
params.put("checkStatus",checkStatus);
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(startTime)){
|
|
|
sql +=" and p.create_time >=:startTime";
|
|
@ -5270,9 +5270,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
sqlTotal +=" and p.dept =:dept";
|
|
|
params1.put("dept",dept);
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(status)){
|
|
|
sqlTotal +=" and p.status =:status";
|
|
|
params1.put("status",status);
|
|
|
if (StringUtils.isNoneBlank(checkStatus)){
|
|
|
sqlTotal +=" and p.check_status =:checkStatus";
|
|
|
params1.put("checkStatus",checkStatus);
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(startTime)){
|
|
|
sqlTotal +=" and p.create_time >=:startTime";
|
|
@ -5340,16 +5340,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
prescriptionCheckDO.setCreateUserName(operateName);
|
|
|
prescriptionCheckDO.setReason(reason);
|
|
|
prescriptionCheckDO.setStatus(status);
|
|
|
prescriptionCheckDO.setPrescriptionId(prescriptionId);
|
|
|
prescriptionCheckDO = prescriptionCheckDao.save(prescriptionCheckDO);
|
|
|
if (status==4){
|
|
|
prescriptionDao.updateStatus(prescriptionId,12);
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
if (status==2){
|
|
|
prescriptionDao.updateCheckStatus(prescriptionId,4,reason,12);
|
|
|
}else{
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
wlyyPrescriptionDO.setMkTime(new Date());
|
|
|
wlyyPrescriptionDO.setMkFailReason(reason);
|
|
|
wlyyPrescriptionDO.setCheckStatus(status);
|
|
|
wlyyPrescriptionDO.setCheckReason(reason);
|
|
|
wlyyPrescriptionDO.setStatus(11);
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
}
|
|
|
if (status==2||status==1){
|
|
|
sendCheckMessage(status,wlyyPrescriptionDO,operate,operateName);
|
|
|
}
|
|
|
return prescriptionCheckDO;
|
|
|
}
|
|
|
|
|
@ -5362,4 +5366,90 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
public List<WlyyPrescriptionCheckDO> findPrescriptionCheck(String prescriptionId){
|
|
|
return prescriptionCheckDao.findByPrescriptionId(prescriptionId);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 发送处方审核消息
|
|
|
* @param status
|
|
|
* @param prescriptionDO
|
|
|
* @param operate
|
|
|
* @param operateName
|
|
|
* @return
|
|
|
*/
|
|
|
public SystemMessageDO sendCheckMessage(Integer status,WlyyPrescriptionDO prescriptionDO,String operate,String operateName){
|
|
|
SystemMessageDO systemMessageDO = new SystemMessageDO();
|
|
|
try{
|
|
|
systemMessageDO.setType("5");
|
|
|
systemMessageDO.setReceiver(prescriptionDO.getDoctor());
|
|
|
systemMessageDO.setReceiverName(prescriptionDO.getDoctorName());
|
|
|
systemMessageDO.setRelationCode(prescriptionDO.getId());
|
|
|
systemMessageDO.setSender(operate);
|
|
|
systemMessageDO.setSenderName(operateName);
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("name",prescriptionDO.getPatientName());
|
|
|
data.put("age",IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard()));
|
|
|
data.put("gender",IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard()));
|
|
|
if (status==2){
|
|
|
systemMessageDO.setTitle("审方通过");
|
|
|
data.put("message","审方通过");
|
|
|
data.put("message","您为"+prescriptionDO.getPatientName()+"("+IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())+"岁 "+IdCardUtil.getSexForIdcard_new(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())+")开具的处方被审方退回,请尽快处理");
|
|
|
}
|
|
|
systemMessageDO.setData(data.toString());
|
|
|
systemMessageService.saveMessage(systemMessageDO);
|
|
|
}catch (Exception e){
|
|
|
logger.error("sendPatientGetDrugMes :"+e.toString());
|
|
|
}
|
|
|
return systemMessageDO;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询单条处方记录
|
|
|
* @param prescriptionId
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public WlyyPrescriptionVO selectByPrescriptionId(String prescriptionId) throws Exception {
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO= prescriptionDao.findOne(prescriptionId);
|
|
|
if (wlyyPrescriptionDO!=null){
|
|
|
com.alibaba.fastjson.JSONObject objectString = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(wlyyPrescriptionDO);
|
|
|
WlyyPrescriptionVO prescriptionVO = com.alibaba.fastjson.JSONObject.toJavaObject(objectString,WlyyPrescriptionVO.class);
|
|
|
List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId);
|
|
|
List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
|
|
|
for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
|
|
|
com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(wlyyPrescriptionInfoDO);
|
|
|
logger.info("wlyyPrescriptionInfoDO参数入参"+object.toJSONString());
|
|
|
WlyyPrescriptionInfoVO prescriptionInfoVO = com.alibaba.fastjson.JSONObject.toJavaObject(object,WlyyPrescriptionInfoVO.class);
|
|
|
wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
|
|
|
}
|
|
|
prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
|
|
|
List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId);
|
|
|
List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = new ArrayList<>();
|
|
|
for (WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO:wlyyPrescriptionDiagnosisDOS){
|
|
|
com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(prescriptionDiagnosisDO);
|
|
|
logger.info("prescriptionDiagnosisDO参数入参"+object.toJSONString());
|
|
|
WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = com.alibaba.fastjson.JSONObject.toJavaObject(object,WlyyPrescriptionDiagnosisVO.class);
|
|
|
wlyyPrescriptionDiagnosisVOS.add(prescriptionDiagnosisVO);
|
|
|
}
|
|
|
prescriptionVO.setDiagnosisVOs(wlyyPrescriptionDiagnosisVOS);
|
|
|
|
|
|
List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId);
|
|
|
List<WlyyInspectionVO> inspectionVOList = new ArrayList<>();
|
|
|
for (WlyyInspectionDO inspectionDO:inspectionDOS){
|
|
|
com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(inspectionDO);
|
|
|
logger.info("prescriptionDiagnosisDO参数入参"+object.toJSONString());
|
|
|
WlyyInspectionVO inspectionVO = com.alibaba.fastjson.JSONObject.toJavaObject(object,WlyyInspectionVO.class);
|
|
|
inspectionVOList.add(inspectionVO);
|
|
|
}
|
|
|
prescriptionVO.setInspectionVOs(inspectionVOList);
|
|
|
prescriptionVO.setAge(IdCardUtil.getAgeForIdcard(wlyyPrescriptionDO.getIdcard())+"");
|
|
|
prescriptionVO.setSex(IdCardUtil.getSexForIdcard_new(wlyyPrescriptionDO.getIdcard())+"");
|
|
|
return prescriptionVO;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
}
|