|
@ -1,8 +1,12 @@
|
|
|
package com.yihu.jw.service.channel;
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.wx.WxPushLogDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
|
|
|
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
|
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
@ -26,9 +30,15 @@ import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
|
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.status.EnvelopStatus;
|
|
|
import com.yihu.jw.sms.dao.HospitalSysDictDao;
|
|
|
import com.yihu.jw.util.DateUtil;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.http.HttpUtils;
|
|
|
import com.yihu.jw.utils.YkyySMSService;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import com.yihu.jw.wechat.dao.WxPushLogDao;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang.time.DateUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@ -87,6 +97,16 @@ public class PrescriptionStatusUpdateService {
|
|
|
private PrescriptionService prescriptionService;
|
|
|
@Autowired
|
|
|
private SystemMessageService systemMessageService;
|
|
|
@Autowired
|
|
|
private YkyyEntranceService ykyyEntranceService;
|
|
|
@Autowired
|
|
|
private HibenateUtils hibenateUtils;
|
|
|
@Autowired
|
|
|
private HospitalSysDictDao hospitalSysDictDao;
|
|
|
@Autowired
|
|
|
private WxPushLogDao wxPushLogDao;
|
|
|
@Autowired
|
|
|
private YkyySMSService ykyySMSService;
|
|
|
|
|
|
public void autoPush() throws Exception {
|
|
|
|
|
@ -831,6 +851,63 @@ public class PrescriptionStatusUpdateService {
|
|
|
return msgReurn;
|
|
|
}
|
|
|
|
|
|
|
|
|
public void unCheckPrescription() throws Exception {
|
|
|
String startTime= DateUtil.getStringDateShort() +" 00:00:00";
|
|
|
String endTime= DateUtil.getStringDateShort() +" 23:59:59";
|
|
|
JSONArray array = ykyyEntranceService.getUnCheckPrescription(startTime,endTime);
|
|
|
String sendMesControl = "1";//1 开启发送短信 0 关闭
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("ykSmsControl");
|
|
|
WlyyHospitalSysDictDO yunweiSysDict = hospitalSysDictDao.findById("yunweiMobile");
|
|
|
String remind = yunweiSysDict.getDictValue();
|
|
|
String mobiles = yunweiSysDict.getDictCode();
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
sendMesControl = wlyyHospitalSysDictDO.getDictValue();
|
|
|
}
|
|
|
if(array!=null&&array.size()>0) {
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
JSONObject json = array.getJSONObject(i);
|
|
|
String brid = json.getString("BRID");
|
|
|
String cfsb = json.getString("CFSB");
|
|
|
|
|
|
//查找居民信息
|
|
|
BasePatientDO patientDO = ykyyEntranceService.findPatientByMapingCode(brid);
|
|
|
if (patientDO != null) {
|
|
|
//查找对应的处方
|
|
|
String sql = "SELECT w.OUTPATIENT_ID,w.ID,w.DOCTOR_NAME,to_char(w.CREATE_TIME ,'yyyy/MM/dd hh24:mi:ss' ) as CREATE_TIME from WLYY_PRESCRIPTION w WHERE REAL_ORDER = '" + cfsb + "' ORDER BY w.CREATE_TIME desc";
|
|
|
List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
|
|
|
if(pre!=null && pre.size()>0){
|
|
|
String outpatientId = pre.get(0).get("OUTPATIENT_ID").toString();
|
|
|
String createTime =pre.get(0).get("CREATE_TIME").toString();
|
|
|
Date createDate = DateUtil.strToDateLong(createTime);
|
|
|
Calendar cal= Calendar.getInstance();
|
|
|
cal.setTime(createDate);
|
|
|
cal.add(Calendar.MINUTE,Integer.parseInt(remind));
|
|
|
Long now = new Date().getTime();
|
|
|
Long min = cal.getTime().getTime();
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
|
|
|
if (min<=now){
|
|
|
String mobileList[] = mobiles.split(",");
|
|
|
if ("1".equalsIgnoreCase(sendMesControl)){
|
|
|
for (int j=0;j<mobileList.length;j++){
|
|
|
WxPushLogDO wxPushLogDO = new WxPushLogDO();
|
|
|
wxPushLogDO.setTempName("未审核提醒");
|
|
|
wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
|
|
|
wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
|
|
|
wxPushLogDO.setCreateTime(new Date());
|
|
|
wxPushLogDao.save(wxPushLogDO);
|
|
|
ykyySMSService.ykyySendSMS(mobileList[j],wlyyOutpatientDO.getDoctorName()+"已为患者:开具处方,请尽快通知相关人员处理。");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public String finishOldConsult(String consult){
|
|
|
|
|
|
int resutl = imService.finish(consult,"admin",2);
|