|
@ -10,12 +10,13 @@ import com.yihu.jw.doctor.service.BaseDoctorInfoService;
|
|
|
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorPatientDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorVo;
|
|
|
|
|
|
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
|
|
|
import com.yihu.jw.entity.base.org.BaseOrgDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
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.hospital.consult.WlyyDoctorClinicRoomDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
|
|
@ -74,6 +75,8 @@ import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.utils.StringUtil;
|
|
|
import com.yihu.jw.utils.WebserviceUtil;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import com.yihu.utils.security.MD5;
|
|
|
import com.ylzinfo.ehc.EhcHandler;
|
|
@ -217,6 +220,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
private BasePatientMedicareCardDao patientMedicareCardDao;
|
|
|
@Autowired
|
|
|
private PatientMappingDao patientMappingDao;
|
|
|
@Autowired
|
|
|
private WechatDao wechatDao;
|
|
|
@Autowired
|
|
|
private BasePatientWechatDao patientWechatDao;
|
|
|
|
|
|
|
|
|
@Value("${demo.flag}")
|
|
@ -3044,7 +3051,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"WHERE " +
|
|
|
"a.relation_code=b.id " +
|
|
|
"AND b.doctor='"+doctor+"' " +
|
|
|
"GROUP BY a.score_type";
|
|
|
"GROUP BY a.score_type ORDER BY a.score_type ASC ";
|
|
|
List<Map<String,Object>> listscore = jdbcTemplate.queryForList(sqlscore);
|
|
|
|
|
|
Double doctorScore = new Double("0");
|
|
@ -3226,6 +3233,45 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
wlyyOutpatientDO.setDoctorCancelType(cancelType);
|
|
|
wlyyOutpatientDO.setDoctorCancelValue(cancelValue);
|
|
|
description = "医生拒绝接诊";
|
|
|
|
|
|
//系统消息 医生取消复诊
|
|
|
SystemMessageDO messageDO = new SystemMessageDO();
|
|
|
messageDO.setTitle("医生取消复诊");
|
|
|
messageDO.setType("12");
|
|
|
messageDO.setSender(wlyyOutpatientDO.getDoctor());
|
|
|
messageDO.setSenderName(wlyyOutpatientDO.getDoctorName());
|
|
|
messageDO.setRelationCode(wlyyOutpatientDO.getId());
|
|
|
messageDO.setReceiver(wlyyOutpatientDO.getPatient());
|
|
|
messageDO.setReceiverName(wlyyOutpatientDO.getPatientName());
|
|
|
net.sf.json.JSONObject data = new net.sf.json.JSONObject();
|
|
|
|
|
|
|
|
|
try {
|
|
|
data.put("name",wlyyOutpatientDO.getPatientName());
|
|
|
data.put("age",IdCardUtil.getAgeForIdcard(wlyyOutpatientDO.getIdcard()));
|
|
|
data.put("gender",IdCardUtil.getSexForIdcard(wlyyOutpatientDO.getIdcard()));
|
|
|
data.put("question",wlyyOutpatientDO.getIcd10Name());
|
|
|
String msg="";
|
|
|
if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
|
data.put("type","9");
|
|
|
msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个图文复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
|
|
|
}
|
|
|
if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
|
data.put("type","16");
|
|
|
msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个视频复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
|
|
|
}
|
|
|
data.put("msg",msg);
|
|
|
messageDO.setData(data.toString());
|
|
|
systemMessageService.saveMessage(messageDO);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
//推送消息到眼科通
|
|
|
BasePatientDO patient = basePatientDao.findById(wlyyOutpatientDO.getPatient());
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
ykyyService.pushNotificationToYktPatient(patient.getYktId(),messageDO.getTitle(),data.get("msg").toString());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
outpatientDao.save(wlyyOutpatientDO);
|
|
@ -3727,7 +3773,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
" d.outpatient_type AS \"outpatientType\"," +
|
|
|
" a.total AS \"consultTotal\"," +
|
|
|
" h.org_name AS \"orgName\"," +
|
|
|
" h.org_code AS \"orgCode\"" +
|
|
|
" h.org_code AS \"orgCode\"," +
|
|
|
" follow.id AS followid "+
|
|
|
" FROM " +
|
|
|
" base_doctor d " +
|
|
|
" JOIN base_doctor_hospital h ON h.doctor_code = d.id "+
|
|
@ -3739,6 +3786,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if ("0".equalsIgnoreCase(isAttention)) {
|
|
|
sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient !='" + patientid + "' ";
|
|
|
}
|
|
|
if (StringUtils.isEmpty(isAttention)){
|
|
|
sql+=" LEFT JOIN base_doctor_patient_follow follow ON follow.patient='"+patientid+"' AND follow.doctor = d.id ";
|
|
|
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(diseaseKey)){
|
|
|
sql+=" left join wlyy_doctor_special_disease sp on d.id = sp.doctor_code ";
|
|
|
}
|
|
@ -3830,7 +3881,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(workingTime)){
|
|
|
sql+=" AND wk.date = :workingTime ";
|
|
|
sql+=" AND wk.work_date = :workingTime ";
|
|
|
params.put("workingTime",workingTime);
|
|
|
}
|
|
|
|
|
@ -4071,6 +4122,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
rs.put("idcard",basePatientDO.getIdcard());
|
|
|
rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
|
|
|
rs.put("mobile",basePatientDO.getMobile());
|
|
|
rs.put("photo",basePatientDO.getPhoto());
|
|
|
rs.put("address",basePatientDO.getAddress());
|
|
|
if (patientMedicareCardDO!=null){
|
|
|
rs.put("ssc",patientMedicareCardDO.getCode());
|
|
|
}else {
|
|
@ -4157,6 +4210,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
rs.put("idcard",basePatientDO.getIdcard());
|
|
|
rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
|
|
|
rs.put("mobile",basePatientDO.getMobile());
|
|
|
rs.put("photo",basePatientDO.getPhoto());
|
|
|
rs.put("address",basePatientDO.getAddress());
|
|
|
if (patientMedicareCardDO!=null){
|
|
|
rs.put("ssc",patientMedicareCardDO.getCode());
|
|
|
}else {
|
|
@ -4722,6 +4777,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
systemMessageService.saveMessage(systemMessageDO);
|
|
|
|
|
|
|
|
|
BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
ykyyService.pushNotificationToYktPatient(patient.getYktId(),systemMessageDO.getTitle(),data.get("msg").toString());
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
|
logger.error("sendOutPatientMes :"+e.toString());
|
|
|
return null;
|
|
@ -4758,11 +4819,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
data.put("msg",msg);
|
|
|
data.put("type",type);
|
|
|
systemMessageDO.setData(data.toString());
|
|
|
|
|
|
systemMessageService.saveMessage(systemMessageDO);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
ykyyService.pushNotificationToYktPatient(patient.getYktId(),systemMessageDO.getTitle(),data.get("msg").toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
@ -5701,7 +5765,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
|
|
|
if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
|
|
|
try {
|
|
|
/*List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
|
|
|
List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
|
|
|
List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId,1);
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
|
|
|
|
|
@ -5716,7 +5780,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
|
|
|
}
|
|
|
Map<String,Object> map = sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
|
|
|
if (map.get("code").toString().equalsIgnoreCase("0")){*/
|
|
|
if (map.get("code").toString().equalsIgnoreCase("0")){
|
|
|
// * @param applyDepaName @param applyDoctorName
|
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
String patientCode = prescriptionDO.getPatientCode();
|
|
@ -5739,7 +5803,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patientCode,"1");
|
|
|
ylzPayService.msgPush("01",patientMedicareCardDO.getCode(),"01",patientDO.getMobile(),"03",userNo,userName,idcard,realerOrder,applyDepaName,applyDoctorName,recipeTime,free,"1");
|
|
|
/* }*/
|
|
|
}
|
|
|
//sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
|
|
|
|
|
|
} catch (Exception e) {
|
|
@ -5760,9 +5824,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
messageDO.setRelationCode(outpatientDO.getId()+","+wlyyPrescriptionDO.getId());
|
|
|
messageDO.setReceiver(outpatientDO.getPatient());
|
|
|
messageDO.setReceiverName(outpatientDO.getPatientName());
|
|
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
try {
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("name",outpatientDO.getPatientName());
|
|
|
data.put("age", IdCardUtil.getAgeForIdcard(outpatientDO.getIdcard()));
|
|
|
data.put("gender",IdCardUtil.getSexForIdcard_new(outpatientDO.getIdcard()));
|
|
@ -5771,9 +5834,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
data.put("msg",msg);
|
|
|
messageDO.setData(data.toString());
|
|
|
systemMessageService.saveMessage(messageDO);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
BasePatientDO patient = basePatientDao.findById(outpatientDO.getPatient());
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
ykyyService.pushNotificationToYktPatient(patient.getYktId(),messageDO.getTitle(),data.get("msg").toString());
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
wlyyPrescriptionDO.setCheckStatus(status);
|
|
@ -6062,7 +6130,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 电子病历html
|
|
|
* @param registerSn
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String readOutPatient(String registerSn) throws Exception {
|
|
|
String url = "";
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL");
|
|
@ -6088,16 +6161,44 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
net.sf.json.JSON json = xmlSerializer.read(returnValue);
|
|
|
logger.info("返回json"+json);
|
|
|
Object retInfo= ((JSONObject) json).get("HtResponse");
|
|
|
logger.info("retInfo:"+retInfo);
|
|
|
if(retInfo!=null){
|
|
|
JSONObject jsonObject = (JSONObject)retInfo;
|
|
|
String content =jsonObject.getString("XML_CONT");
|
|
|
Document doc = Jsoup.parse(content);
|
|
|
Elements rows = doc.select("table[class=list]").get(0).select("tr");
|
|
|
|
|
|
return json.toString();
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 电子病历xml
|
|
|
* @param registerSn
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String readOutPatientXml(String registerSn) throws Exception {
|
|
|
String url = "";
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL");
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
url = wlyyHospitalSysDictDO.getDictCode();
|
|
|
}
|
|
|
String xmlStr = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
|
|
|
"<HtRequest>\n";
|
|
|
xmlStr+="<REGISTER_SN>"+registerSn+"</REGISTER_SN>";
|
|
|
String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmssSSS");
|
|
|
xmlStr+="<REQ_TIME>"+reqTime+"</REQ_TIME>";
|
|
|
xmlStr+="</HtRequest>";
|
|
|
String returnValue = "";
|
|
|
Map<String, String> params = new HashedMap();
|
|
|
params.put("type","readOutPatientDetail");
|
|
|
params.put("xmlStr",xmlStr);
|
|
|
returnValue = com.yihu.jw.utils.WebserviceUtil.post(url,
|
|
|
"http://business.htemr.haitaiinc.com",
|
|
|
"manageOutRegister",
|
|
|
params);
|
|
|
|
|
|
return returnValue;
|
|
|
logger.info("调用电子病历查询接口请求成功,返回值xmlstr:" + returnValue);
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
net.sf.json.JSON json = xmlSerializer.read(returnValue);
|
|
|
logger.info("返回json"+json);
|
|
|
|
|
|
return json.toString();
|
|
|
}
|
|
|
|
|
|
public String writeOutPatient(String registerSn,String chiefComplaint,String hpi,String elapsemhis,String bodycheck,String assistanTcheck) throws Exception {
|
|
@ -6129,7 +6230,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
params);
|
|
|
|
|
|
logger.info("调用电子病历写入接口请求成功,返回值xmlstr:" + returnValue);
|
|
|
return returnValue;
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
net.sf.json.JSON json = xmlSerializer.read(returnValue);
|
|
|
logger.info("返回json"+json);
|
|
|
|
|
|
return json.toString();
|
|
|
}
|
|
|
|
|
|
|
|
@ -6405,6 +6510,49 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
rs.put("address",baseOrgDO.getAddress());
|
|
|
String distance = LatitudeUtils.getDistance(longitude, dimension, baseOrgDO.getLongitude(), baseOrgDO.getLatitude());
|
|
|
rs.put("distance",distance);
|
|
|
rs.put("longitude",baseOrgDO.getLongitude());
|
|
|
rs.put("dimension",baseOrgDO.getLatitude());
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,rs);
|
|
|
}
|
|
|
|
|
|
|
|
|
public MixEnvelop selectByUrl(String prescriptionId,String wxId) throws Exception {
|
|
|
WxWechatDO wxWechatDO = wechatDao.findById(wxId);
|
|
|
if (wxWechatDO==null){
|
|
|
throw new Exception("微信配置不存在!");
|
|
|
}
|
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
if (prescriptionDO==null){
|
|
|
throw new Exception("处方不存在!");
|
|
|
}
|
|
|
List<BasePatientWechatDo> patientWechatDos =patientWechatDao.findByWechatIdAndPatientId(wxId,prescriptionDO.getPatientCode());
|
|
|
if (patientWechatDos==null||patientWechatDos.size()==0){
|
|
|
throw new Exception("openid不存在!");
|
|
|
}
|
|
|
BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
|
|
|
PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",prescriptionDO.getPatientCode(),"1");
|
|
|
if (patientMedicareCardDO==null){
|
|
|
throw new Exception("就诊卡不存在!");
|
|
|
}
|
|
|
String url = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(),patientWechatDo.getOpenid(),patientMedicareCardDO.getCode(),"WX");
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(url);
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,object);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取居民openId
|
|
|
* @param patientCode
|
|
|
* @return
|
|
|
*/
|
|
|
public MixEnvelop findPatientOpenId(String patientCode) {
|
|
|
BasePatientWechatDo basePatientWechatDo = patientWechatDao.findByWechatIdAndPatientId(wechatId, patientCode).get(0);
|
|
|
if (basePatientWechatDo==null){
|
|
|
return MixEnvelop.getError("居民不存在");
|
|
|
}
|
|
|
String openid = basePatientWechatDo.getOpenid();
|
|
|
if (StringUtils.isEmpty(openid)){
|
|
|
return MixEnvelop.getError("居民openID不存在");
|
|
|
}
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,openid);
|
|
|
}
|
|
|
}
|