|
@ -15,8 +15,7 @@ import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
|
|
import com.yihu.jw.entity.base.org.BaseOrgDO;
|
|
import com.yihu.jw.entity.base.org.BaseOrgDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
|
|
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
|
|
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
|
|
|
|
import com.yihu.jw.entity.base.wx.WxWechatDO;
|
|
|
|
|
|
import com.yihu.jw.entity.base.wx.*;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
|
|
@ -72,11 +71,15 @@ import com.yihu.jw.rm.iot.IotRequestMapping;
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
import com.yihu.jw.util.common.LatitudeUtils;
|
|
import com.yihu.jw.util.common.LatitudeUtils;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
|
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import com.yihu.jw.utils.WebserviceUtil;
|
|
import com.yihu.jw.utils.WebserviceUtil;
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
|
|
import com.yihu.jw.wechat.dao.WxPushLogDao;
|
|
|
|
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
|
|
|
|
import com.yihu.jw.wechat.service.WxAccessTokenService;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import com.yihu.utils.security.MD5;
|
|
import com.yihu.utils.security.MD5;
|
|
import com.ylzinfo.ehc.EhcHandler;
|
|
import com.ylzinfo.ehc.EhcHandler;
|
|
@ -94,6 +97,7 @@ import org.jsoup.nodes.Document;
|
|
import org.jsoup.select.Elements;
|
|
import org.jsoup.select.Elements;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
@ -224,6 +228,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
private WechatDao wechatDao;
|
|
private WechatDao wechatDao;
|
|
@Autowired
|
|
@Autowired
|
|
private BasePatientWechatDao patientWechatDao;
|
|
private BasePatientWechatDao patientWechatDao;
|
|
|
|
@Autowired
|
|
|
|
private WxTemplateConfigDao wxTemplateConfigDao;
|
|
|
|
@Autowired
|
|
|
|
private WxAccessTokenService wxAccessTokenService;
|
|
|
|
@Autowired
|
|
|
|
private WeixinMessagePushUtils weixinMessagePushUtils;
|
|
|
|
@Autowired
|
|
|
|
private BasePatientWechatDao basePatientWechatDao;
|
|
|
|
@Autowired
|
|
|
|
private WxPushLogDao wxPushLogDao;
|
|
|
|
|
|
|
|
|
|
@Value("${demo.flag}")
|
|
@Value("${demo.flag}")
|
|
@ -431,7 +445,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
* @param outpatientId
|
|
* @param outpatientId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId,String prescriptionId) throws Exception {
|
|
|
|
|
|
public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId,String prescriptionId,String wxId) throws Exception {
|
|
com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
|
|
com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
|
|
|
|
|
|
//复诊信息
|
|
//复诊信息
|
|
@ -452,6 +466,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
rs.put("mobile",basePatientDO.getMobile());
|
|
rs.put("mobile",basePatientDO.getMobile());
|
|
rs.put("birthday",DateUtil.dateToStr(basePatientDO.getBirthday(),"yyyy-MM-dd"));
|
|
rs.put("birthday",DateUtil.dateToStr(basePatientDO.getBirthday(),"yyyy-MM-dd"));
|
|
|
|
|
|
|
|
Long time = new Date().getTime()-outpatientDO.getCreateTime().getTime();
|
|
|
|
rs.put("time",time);
|
|
|
|
|
|
//获取处方信息
|
|
//获取处方信息
|
|
List<WlyyPrescriptionDO> prescriptionDOs = null;
|
|
List<WlyyPrescriptionDO> prescriptionDOs = null;
|
|
@ -476,9 +492,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
|
|
List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
|
|
vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(),1),inspectionVOs,WlyyInspectionVO.class));
|
|
vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(),1),inspectionVOs,WlyyInspectionVO.class));
|
|
|
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = readOutPatientXml(outpatientDO.getOriginRegisterNo());
|
|
|
|
//电子病历
|
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO);
|
|
|
|
|
|
if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
|
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO1 = prescriptionEmrDao.findEmrByPrescriptionId(vo.getId());
|
|
|
|
if (wlyyPrescriptionEmrDO1!=null){
|
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO1);
|
|
|
|
}else {
|
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = readOutPatientXml(outpatientDO.getOriginRegisterNo());
|
|
|
|
//电子病历
|
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
rs.put("prescriptions",prescriptionVOs);
|
|
rs.put("prescriptions",prescriptionVOs);
|
|
@ -3257,10 +3281,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
data.put("type","9");
|
|
data.put("type","9");
|
|
msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个图文复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
|
|
msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个图文复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
|
|
|
|
// sendWxTemplateMsg(wechatId,wlyyOutpatientDO,"9");
|
|
}
|
|
}
|
|
if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
data.put("type","16");
|
|
data.put("type","16");
|
|
msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个视频复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
|
|
msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个视频复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
|
|
|
|
// sendWxTemplateMsg(wechatId,wlyyOutpatientDO,"16");
|
|
}
|
|
}
|
|
data.put("msg",msg);
|
|
data.put("msg",msg);
|
|
messageDO.setData(data.toString());
|
|
messageDO.setData(data.toString());
|
|
@ -3299,6 +3325,53 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
return rs;
|
|
return rs;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 发送微信模板消息 本地无法测试消息是否发送成功
|
|
|
|
* @param wxId
|
|
|
|
* @param outpatientDO
|
|
|
|
* @param type
|
|
|
|
*/
|
|
|
|
public void sendWxTemplateMsg(String wxId,WlyyOutpatientDO outpatientDO,String type){
|
|
|
|
List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getPatient());
|
|
|
|
if(ps.isEmpty()){
|
|
|
|
logger.info("该用户"+outpatientDO.getPatientName()+"没有openid,无法推送模版消息,用户ID:"+outpatientDO.getPatient()+"wechatId:"+wxId);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
|
ps.stream().forEach(one->{
|
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
|
|
|
|
WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_doctor_notice","ysqxjz",1);
|
|
|
|
WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
|
|
|
|
BeanUtils.copyProperties(config,newConfig);
|
|
|
|
newConfig.setFirst(config.getFirst().replace("key1",outpatientDO.getPatientName()));
|
|
|
|
if ("9".equals(type)){
|
|
|
|
newConfig.setFirst(newConfig.getFirst().replace("key2","图文复诊"));
|
|
|
|
}
|
|
|
|
if ("16".equals(type)){
|
|
|
|
newConfig.setFirst(newConfig.getFirst().replace("key2","视频复诊"));
|
|
|
|
}
|
|
|
|
newConfig.setUrl(config.getUrl()+""+outpatientDO.getId());
|
|
|
|
newConfig.setKeyword1(config.getKeyword1()+outpatientDO.getHospitalName());
|
|
|
|
newConfig.setKeyword2(config.getKeyword2()+outpatientDO.getDoctorName());
|
|
|
|
newConfig.setKeyword3(config.getKeyword3()+doctorDO.getFee());
|
|
|
|
WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
|
|
|
|
logger.info("=======setUrl========"+newConfig.getUrl());
|
|
|
|
weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(),one.getOpenid(),newConfig);
|
|
|
|
|
|
|
|
//保存发送模板记录,
|
|
|
|
WxPushLogDO wxPushLogDO = new WxPushLogDO();
|
|
|
|
wxPushLogDO.setCreateTime(new Date());
|
|
|
|
wxPushLogDO.setOpenid(one.getOpenid());
|
|
|
|
wxPushLogDO.setReceiver(outpatientDO.getPatient());
|
|
|
|
wxPushLogDO.setWechatId(wechatId);
|
|
|
|
wxPushLogDO.setReceiverName(outpatientDO.getPatientName());
|
|
|
|
wxPushLogDO.setScene("ysqxjz");
|
|
|
|
wxPushLogDao.save(wxPushLogDO);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public List<WlyyHospitalSysDictDO> findCancelReasonList(){
|
|
public List<WlyyHospitalSysDictDO> findCancelReasonList(){
|
|
return sysDictDao.findByDictName("PatientCancel");
|
|
return sysDictDao.findByDictName("PatientCancel");
|
|
}
|
|
}
|
|
@ -4391,6 +4464,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
for (Map<String,Object> map:list){
|
|
for (Map<String,Object> map:list){
|
|
if (!map.get("id").toString().equalsIgnoreCase(outpatientId)){
|
|
if (!map.get("id").toString().equalsIgnoreCase(outpatientId)){
|
|
waitCount+=1;
|
|
waitCount+=1;
|
|
|
|
}else{
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return waitCount.toString();
|
|
return waitCount.toString();
|
|
@ -4799,6 +4874,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
*/
|
|
*/
|
|
public SystemMessageDO sendOutPatientMes(WlyyOutpatientDO outpatient){
|
|
public SystemMessageDO sendOutPatientMes(WlyyOutpatientDO outpatient){
|
|
SystemMessageDO systemMessageDO = new SystemMessageDO();
|
|
SystemMessageDO systemMessageDO = new SystemMessageDO();
|
|
|
|
String msg="";
|
|
|
|
JSONObject data = new JSONObject();
|
|
try{
|
|
try{
|
|
//1.在线复诊2.协同门诊
|
|
//1.在线复诊2.协同门诊
|
|
if("2".equals(outpatient.getOutpatientType())){
|
|
if("2".equals(outpatient.getOutpatientType())){
|
|
@ -4814,27 +4891,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
systemMessageDO.setTitle("视频复诊预约成功");
|
|
systemMessageDO.setTitle("视频复诊预约成功");
|
|
systemMessageDO.setType("2");
|
|
systemMessageDO.setType("2");
|
|
saveInquirySystemMessage(outpatient);
|
|
saveInquirySystemMessage(outpatient);
|
|
|
|
msg="您的视频复诊已预约成功。\n" +
|
|
|
|
"预计"+outpatient.getDoctorName()+"医生将于"+outpatient.getRegisterDate()+" 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
|
|
|
|
systemMessageDO.setReceiver(outpatient.getDoctor());
|
|
|
|
systemMessageDO.setReceiverName(outpatient.getDoctorName());
|
|
|
|
systemMessageDO.setRelationCode(outpatient.getId());
|
|
|
|
systemMessageDO.setSender(outpatient.getPatient());
|
|
|
|
systemMessageDO.setSenderName(outpatient.getPatientName());
|
|
|
|
systemMessageDO.setRelationCode(outpatient.getId());
|
|
|
|
|
|
|
|
|
|
|
|
data.put("name",outpatient.getPatientName());
|
|
|
|
data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
|
|
|
|
data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
|
|
|
|
data.put("question",outpatient.getDescription());
|
|
|
|
data.put("msg",msg);
|
|
|
|
systemMessageDO.setData(data.toString());
|
|
|
|
|
|
|
|
systemMessageService.saveMessage(systemMessageDO);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
systemMessageDO.setReceiver(outpatient.getDoctor());
|
|
|
|
systemMessageDO.setReceiverName(outpatient.getDoctorName());
|
|
|
|
systemMessageDO.setRelationCode(outpatient.getId());
|
|
|
|
systemMessageDO.setSender(outpatient.getPatient());
|
|
|
|
systemMessageDO.setSenderName(outpatient.getPatientName());
|
|
|
|
systemMessageDO.setRelationCode(outpatient.getId());
|
|
|
|
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
|
data.put("name",outpatient.getPatientName());
|
|
|
|
data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
|
|
|
|
data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
|
|
|
|
data.put("question",outpatient.getDescription());
|
|
|
|
String msg="您的视频复诊已预约成功。\n" +
|
|
|
|
"预计"+outpatient.getDoctorName()+"医生将于"+outpatient.getRegisterDate()+" 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
|
|
|
|
data.put("msg",msg);
|
|
|
|
systemMessageDO.setData(data.toString());
|
|
|
|
|
|
|
|
systemMessageService.saveMessage(systemMessageDO);
|
|
|
|
|
|
|
|
|
|
|
|
BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
|
|
BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
@ -5848,7 +5924,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
if (prescriptionEmrDO!=null){
|
|
if (prescriptionEmrDO!=null){
|
|
writeOutPatient(outpatientDO.getRegisterNo(),prescriptionEmrDO.getComplaint(),prescriptionEmrDO.getMedicalHistory(),prescriptionEmrDO.getPastHistory(),prescriptionEmrDO.getPhysicalExamination(),prescriptionEmrDO.getAssistExamination());
|
|
writeOutPatient(outpatientDO.getRegisterNo(),prescriptionEmrDO.getComplaint(),prescriptionEmrDO.getMedicalHistory(),prescriptionEmrDO.getPastHistory(),prescriptionEmrDO.getPhysicalExamination(),prescriptionEmrDO.getAssistExamination());
|
|
}
|
|
}
|
|
if (map.get("code").toString().equalsIgnoreCase("0")){
|
|
|
|
|
|
if (map.get("code").toString().equalsIgnoreCase("1")){
|
|
// * @param applyDepaName @param applyDoctorName
|
|
// * @param applyDepaName @param applyDoctorName
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
String patientCode = prescriptionDO.getPatientCode();
|
|
String patientCode = prescriptionDO.getPatientCode();
|
|
@ -5880,11 +5956,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
prescriptionLogService.addPrescriptionLog(prescriptionId,20,2,operate,operateName,reason,new Date());
|
|
prescriptionLogService.addPrescriptionLog(prescriptionId,20,2,operate,operateName,reason,new Date());
|
|
wlyyPrescriptionDO.setCheckStatus(2);
|
|
wlyyPrescriptionDO.setCheckStatus(2);
|
|
wlyyPrescriptionDO.setCheckReason(reason);
|
|
wlyyPrescriptionDO.setCheckReason(reason);
|
|
wlyyPrescriptionDO.setStatus(20);
|
|
wlyyPrescriptionDO.setStatus(20);
|
|
|
|
wlyyPrescriptionDO.setPrescribeTime(new Date());
|
|
|
|
|
|
//发送系统消息 处方支付提醒
|
|
//发送系统消息 处方支付提醒
|
|
SystemMessageDO messageDO = new SystemMessageDO();
|
|
SystemMessageDO messageDO = new SystemMessageDO();
|
|
@ -6525,40 +6603,43 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
*/
|
|
*/
|
|
public PageEnvelop findPatientAllPrescription(String keyName,String status,Integer page, Integer size) {
|
|
public PageEnvelop findPatientAllPrescription(String keyName,String status,Integer page, Integer size) {
|
|
String uid = userAgent.getUID();
|
|
String uid = userAgent.getUID();
|
|
StringBuffer sql = new StringBuffer("select a.* from wlyy_prescription a,wlyy_prescription_info b where a.patient_code ='");
|
|
|
|
StringBuffer countSql = new StringBuffer("select COUNT(a.id) count from wlyy_prescription a,wlyy_prescription_info b where a.patient_code ='");
|
|
|
|
sql.append(uid).append("' and a.status >= 0 AND a.id = b.prescription_id");
|
|
|
|
countSql.append(uid).append("' and a.status >= 0 AND a.id = b.prescription_id ");
|
|
|
|
|
|
StringBuffer sql = new StringBuffer("SELECT b.*, c.oneself_pickup_flg FROM (SELECT a.* FROM wlyy_prescription a WHERE a.patient_code = '");
|
|
|
|
StringBuffer countSql = new StringBuffer("select COUNT(b.id) count FROM (SELECT a.* FROM wlyy_prescription a WHERE a.patient_code = '");
|
|
|
|
sql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id");
|
|
|
|
countSql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id ");
|
|
|
|
|
|
if (StringUtils.isNotEmpty(keyName)){
|
|
if (StringUtils.isNotEmpty(keyName)){
|
|
sql.append(" AND (" +
|
|
sql.append(" AND (" +
|
|
" a.doctor_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR a.dept_name LIKE'%"+keyName+"%' " +
|
|
|
|
" OR a.hospital_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR b.drug_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR a.real_order LIKE '%"+keyName+"%' " +
|
|
|
|
|
|
" b.doctor_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR b.dept_name LIKE'%"+keyName+"%' " +
|
|
|
|
" OR b.hospital_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR d.drug_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR b.real_order LIKE '%"+keyName+"%' " +
|
|
")");
|
|
")");
|
|
countSql.append(" AND (" +
|
|
countSql.append(" AND (" +
|
|
" a.doctor_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR a.dept_name LIKE'%"+keyName+"%' " +
|
|
|
|
" OR a.hospital_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR b.drug_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR a.real_order LIKE '%"+keyName+"%' " +
|
|
|
|
|
|
" b.doctor_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR b.dept_name LIKE'%"+keyName+"%' " +
|
|
|
|
" OR b.hospital_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR d.drug_name LIKE '%"+keyName+"%' " +
|
|
|
|
" OR b.real_order LIKE '%"+keyName+"%' " +
|
|
")");
|
|
")");
|
|
}
|
|
}
|
|
if (StringUtils.isNotEmpty(status)){
|
|
if (StringUtils.isNotEmpty(status)){
|
|
|
|
|
|
status= status.substring(1, status.length() - 1);
|
|
status= status.substring(1, status.length() - 1);
|
|
sql.append(" AND a.status IN(").append(status).append(")");
|
|
|
|
countSql.append(" AND a.status IN(").append(status).append(")");
|
|
|
|
|
|
sql.append(" AND b.status IN(").append(status).append(")");
|
|
|
|
countSql.append(" AND b.status IN(").append(status).append(")");
|
|
|
|
}else {
|
|
|
|
sql.append(" and b.status IN(20,21,30,31,32,100,101)");
|
|
|
|
countSql.append(" and b.status IN(20,21,30,31,32,100,101) ");
|
|
}
|
|
}
|
|
sql.append(" order by a.prescribe_time limit ").append((page-1)*size).append(",").append(size);
|
|
|
|
List<WlyyPrescriptionDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionDO.class));
|
|
|
|
|
|
sql.append(" order by b.prescribe_time limit ").append((page-1)*size).append(",").append(size);
|
|
|
|
List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
|
|
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
|
|
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
|
|
long count = Long.parseLong(mapList.get(0).get("count").toString());
|
|
long count = Long.parseLong(mapList.get(0).get("count").toString());
|
|
logger.info("sql="+sql.toString());
|
|
logger.info("sql="+sql.toString());
|
|
logger.info("countSql="+countSql.toString());
|
|
logger.info("countSql="+countSql.toString());
|
|
return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,size,count);
|
|
|
|
|
|
return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, list,page,size,count);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|