|
@ -42,6 +42,7 @@ import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
|
|
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
|
|
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
|
|
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
|
|
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
|
|
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
|
|
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
|
|
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
|
|
@ -75,7 +76,8 @@ 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.util.wechat.WeixinMessagePushUtils;
|
|
import com.yihu.jw.utils.EntityUtils;
|
|
|
|
|
|
import com.yihu.jw.utils.Pkis.PKIService_PortType;
|
|
|
|
import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
|
|
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;
|
|
@ -94,6 +96,7 @@ import jxl.write.*;
|
|
import net.sf.json.JSONArray;
|
|
import net.sf.json.JSONArray;
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.xml.XMLSerializer;
|
|
import net.sf.json.xml.XMLSerializer;
|
|
|
|
import org.apache.commons.codec.binary.*;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@ -108,12 +111,16 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
import javax.xml.rpc.ServiceException;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.OutputStream;
|
|
import java.io.OutputStream;
|
|
import java.lang.Boolean;
|
|
import java.lang.Boolean;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
import java.net.URL;
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
import java.util.Base64;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Created by Trick on 2019/5/17.
|
|
* Created by Trick on 2019/5/17.
|
|
@ -247,6 +254,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
private BaseBannerDoctorDao baseBannerDoctorDao;
|
|
private BaseBannerDoctorDao baseBannerDoctorDao;
|
|
@Autowired
|
|
@Autowired
|
|
private BaseDrugStoreDao baseDrugStoreDao;
|
|
private BaseDrugStoreDao baseDrugStoreDao;
|
|
|
|
@Autowired
|
|
|
|
private DoctorMappingDao doctorMappingDao;
|
|
|
|
@Autowired
|
|
|
|
private PrescriptionSignDao prescriptionSignDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -314,7 +326,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
}
|
|
}
|
|
//BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
|
|
//BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
|
|
logger.info("findOriginPrescriptionList: registerSn:" + registerSn + " patient" + patient + " patNo:" + patNo + " realOrder:" + realOrder + " admNo:" + admNo);
|
|
logger.info("findOriginPrescriptionList: registerSn:" + registerSn + " patient" + patient + " patNo:" + patNo + " realOrder:" + realOrder + " admNo:" + admNo);
|
|
return entranceService.BS16017(registerSn, realOrder, patNo, admNo, demoFlag);
|
|
|
|
|
|
List<WlyyPrescriptionVO> prescriptionVOS = entranceService.BS16017(registerSn, realOrder, patNo, admNo, demoFlag);
|
|
|
|
for (WlyyPrescriptionVO prescriptionVO:prescriptionVOS){
|
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = readOutPatientXml(registerSn);//电子病历
|
|
|
|
prescriptionVO.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO);
|
|
|
|
}
|
|
|
|
return prescriptionVOS;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -486,6 +503,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
rs.put("patientCancelValue", outpatientDO.getPatientCancelValue());
|
|
rs.put("patientCancelValue", outpatientDO.getPatientCancelValue());
|
|
rs.put("patientCancelRemark", outpatientDO.getPatientCancelRemark());
|
|
rs.put("patientCancelRemark", outpatientDO.getPatientCancelRemark());
|
|
rs.put("operator",outpatientDO.getOperator());
|
|
rs.put("operator",outpatientDO.getOperator());
|
|
|
|
rs.put("status",outpatientDO.getStatus());
|
|
|
|
rs.put("createTime",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));
|
|
//居民详情
|
|
//居民详情
|
|
BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
|
|
BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
|
|
rs.put("patientName", basePatientDO.getName());
|
|
rs.put("patientName", basePatientDO.getName());
|
|
@ -3494,12 +3513,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.getId(),null, "9", "doctorRefuseRemind", "");
|
|
|
|
|
|
sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "doctorRefuseRemind", cancelRemark);
|
|
}
|
|
}
|
|
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.getId(),null, "16", "doctorRefuseRemind", "");
|
|
|
|
|
|
sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "doctorRefuseRemind", cancelRemark);
|
|
}
|
|
}
|
|
data.put("msg", msg);
|
|
data.put("msg", msg);
|
|
messageDO.setData(data.toString());
|
|
messageDO.setData(data.toString());
|
|
@ -3600,6 +3619,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
}
|
|
}
|
|
logger.info("doctorRefuseRemind医生拒诊入参:outpatientId="+outpatientId);
|
|
logger.info("doctorRefuseRemind医生拒诊入参:outpatientId="+outpatientId);
|
|
msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
|
|
msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
|
|
|
|
} else if("outPatientTimeOutRemind".equalsIgnoreCase(titelType)) {
|
|
|
|
contentMsg = "您邀请的医师暂无应答,您可以选择继续等待或者取消邀请。";
|
|
|
|
first = outpatientDO.getPatientName() + ",您好!";
|
|
|
|
msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId= "+outpatientId;
|
|
} else if ("payRemind".equalsIgnoreCase(titelType)) {
|
|
} else if ("payRemind".equalsIgnoreCase(titelType)) {
|
|
|
|
|
|
if ("9".equals(type)) {
|
|
if ("9".equals(type)) {
|
|
@ -3722,6 +3745,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
//发起微信消息模板推送
|
|
//发起微信消息模板推送
|
|
newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
|
|
newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
|
|
logger.info("眼科微信消息模板推送 医生拒诊开始");
|
|
logger.info("眼科微信消息模板推送 医生拒诊开始");
|
|
|
|
}else if("outPatientTimeOutRemind".equals(titelType)){
|
|
|
|
//就诊等待过长提示
|
|
|
|
scene="jzddgcts";
|
|
|
|
WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_timeout_remind", scene, 1);
|
|
|
|
BeanUtils.copyProperties(config, newConfig);
|
|
|
|
newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
|
|
|
|
logger.info("就诊等待过长提示");
|
|
} else if ("payRemind".equalsIgnoreCase(titelType)) {
|
|
} else if ("payRemind".equalsIgnoreCase(titelType)) {
|
|
scene = "zxzfts";
|
|
scene = "zxzfts";
|
|
//就诊支付
|
|
//就诊支付
|
|
@ -3898,7 +3928,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
} else if ("xm_xzzx_wx".equalsIgnoreCase(wxId)) {
|
|
} else if ("xm_xzzx_wx".equalsIgnoreCase(wxId)) {
|
|
|
|
|
|
String responseMsg="";
|
|
String responseMsg="";
|
|
String prefix="https://www.xmheart.com";
|
|
|
|
|
|
//String prefix="https://www.xmheart.com";
|
|
|
|
String prefix = "https://ih.xmheart.com";
|
|
if(StringUtils.isNotEmpty(outpatientId)){
|
|
if(StringUtils.isNotEmpty(outpatientId)){
|
|
responseMsg = xzzxEntranceService.sendXCXMes(wxId,
|
|
responseMsg = xzzxEntranceService.sendXCXMes(wxId,
|
|
patientDO.getId(),
|
|
patientDO.getId(),
|
|
@ -3920,7 +3951,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
prefix+msgUrl,
|
|
prefix+msgUrl,
|
|
"wx53f6bb4ac081d840");
|
|
"wx53f6bb4ac081d840");
|
|
}
|
|
}
|
|
|
|
|
|
logger.info("url="+prefix+msgUrl);
|
|
logger.info("url="+prefix+msgUrl);
|
|
String msg="first:"+first+"contentMsg:"+contentMsg+"remark:"+remark;
|
|
String msg="first:"+first+"contentMsg:"+contentMsg+"remark:"+remark;
|
|
logger.info("发送的信息="+msg);
|
|
logger.info("发送的信息="+msg);
|
|
@ -3930,6 +3960,76 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
if ("prescriptionPayRemind".equalsIgnoreCase(titelType)){
|
|
if ("prescriptionPayRemind".equalsIgnoreCase(titelType)){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>();
|
|
|
|
if (StringUtils.isNotEmpty(outpatientId)){
|
|
|
|
ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getPatient());
|
|
|
|
}
|
|
|
|
if (consultTeam!=null){
|
|
|
|
ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, consultTeam.getPatient());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.isEmpty()) {
|
|
|
|
logger.info("该用户" + outpatientDO.getPatientName() + "没有openid,无法推送模版消息,用户ID:" + outpatientDO.getPatient() + "wechatId:" + wxId);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
String scene = "";
|
|
|
|
WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
|
|
|
|
if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
|
|
|
|
scene = "zsysqxts";
|
|
|
|
WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_doctor_notice", scene, 1);
|
|
|
|
BeanUtils.copyProperties(config, newConfig);
|
|
|
|
newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getPatientName()));
|
|
|
|
if ("9".equals(type)) {
|
|
|
|
newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊")+"取消原因为:"+remindMsg);
|
|
|
|
} else if ("16".equals(type)) {
|
|
|
|
newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊")+"取消原因为:"+remindMsg);
|
|
|
|
}
|
|
|
|
newConfig.setKeyword1( outpatientDO.getHospitalName());
|
|
|
|
newConfig.setKeyword2(outpatientDO.getDoctorName());
|
|
|
|
newConfig.setKeyword3( doctorDO.getFee());
|
|
|
|
//发起微信消息模板推送
|
|
|
|
newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
|
|
|
|
logger.info("中山医院消息模板推送 医生拒诊开始");
|
|
|
|
}else if("outPatientTimeOutRemind".equalsIgnoreCase(titelType)){
|
|
|
|
scene = "hzsjgctx";
|
|
|
|
WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_doctor_notice", scene, 1);
|
|
|
|
BeanUtils.copyProperties(config, newConfig);
|
|
|
|
newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getPatientName()));
|
|
|
|
if ("9".equals(type)) {
|
|
|
|
newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
|
|
|
|
} else if ("16".equals(type)) {
|
|
|
|
newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
|
|
|
|
}
|
|
|
|
newConfig.setKeyword1( outpatientDO.getHospitalName());
|
|
|
|
newConfig.setKeyword2(outpatientDO.getDoctorName());
|
|
|
|
newConfig.setKeyword3( doctorDO.getFee());
|
|
|
|
//发起微信消息模板推送
|
|
|
|
newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
|
|
|
|
logger.info("中山医院消息模板推送 候诊时间过长开始");
|
|
|
|
}
|
|
|
|
logger.info("=======setUrl========" + newConfig.getUrl());
|
|
|
|
WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
|
|
|
|
for (BasePatientWechatDo one : ps) {
|
|
|
|
logger.info("发送的消息="+ com.alibaba.fastjson.JSONObject.toJSONString(newConfig));
|
|
|
|
try {
|
|
|
|
logger.info("调用中山微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+one.getOpenid());
|
|
|
|
weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newConfig);
|
|
|
|
logger.info("发送成功");
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
logger.info("发送失败,error="+e.getMessage());
|
|
|
|
}
|
|
|
|
|
|
|
|
//保存发送模板记录,
|
|
|
|
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(scene);
|
|
|
|
wxPushLogDao.save(wxPushLogDO);
|
|
|
|
}
|
|
String responseMsg="";
|
|
String responseMsg="";
|
|
String prefix="https://hlwyy.xmzsh.com";
|
|
String prefix="https://hlwyy.xmzsh.com";
|
|
if(StringUtils.isNotEmpty(outpatientId)){
|
|
if(StringUtils.isNotEmpty(outpatientId)){
|
|
@ -7060,11 +7160,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
|
|
setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
|
|
}
|
|
}
|
|
Map<String, Object> map = sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
|
|
Map<String, Object> map = sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
|
|
|
|
//处方签名
|
|
|
|
logger.info("处方签名");
|
|
|
|
SOF_SignDataWithExtraInfo(wlyyPrescriptionDO);
|
|
//同步电子病历
|
|
//同步电子病历
|
|
WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionId);
|
|
WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionId);
|
|
if (prescriptionEmrDO != null) {
|
|
if (prescriptionEmrDO != null) {
|
|
String doctorId = doctorMappingDO.getMappingCode();
|
|
String doctorId = doctorMappingDO.getMappingCode();
|
|
String doctorName = doctorMappingDO.getDoctorName();
|
|
String doctorName = doctorMappingDO.getDoctorName();
|
|
|
|
logger.info("电子病历签名");
|
|
|
|
SOF_SignDataWithExtraInfoEmr(prescriptionEmrDO);
|
|
writeOutPatient(outpatientDO.getRegisterNo(), prescriptionEmrDO.getComplaint(), prescriptionEmrDO.getMedicalHistory(), prescriptionEmrDO.getPastHistory(), prescriptionEmrDO.getPhysicalExamination(), prescriptionEmrDO.getAssistExamination(), doctorId, doctorName);
|
|
writeOutPatient(outpatientDO.getRegisterNo(), prescriptionEmrDO.getComplaint(), prescriptionEmrDO.getMedicalHistory(), prescriptionEmrDO.getPastHistory(), prescriptionEmrDO.getPhysicalExamination(), prescriptionEmrDO.getAssistExamination(), doctorId, doctorName);
|
|
}
|
|
}
|
|
if (map.get("code").toString().equalsIgnoreCase("1")) {
|
|
if (map.get("code").toString().equalsIgnoreCase("1")) {
|
|
@ -7620,10 +7725,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
}
|
|
}
|
|
String returnValue = "";
|
|
String returnValue = "";
|
|
Map<String, String> params = new HashedMap();
|
|
Map<String, String> params = new HashedMap();
|
|
|
|
params.put("type", "getPatInfoDataXml");
|
|
params.put("data", data);
|
|
params.put("data", data);
|
|
returnValue = com.yihu.jw.utils.WebserviceUtil.post(url,
|
|
returnValue = com.yihu.jw.utils.WebserviceUtil.post(url,
|
|
"http://business.htemr.haitaiinc.com",
|
|
"http://business.htemr.haitaiinc.com",
|
|
"getPatInfoDataXml",
|
|
|
|
|
|
"manageEmrDataAll",
|
|
params);
|
|
params);
|
|
|
|
|
|
logger.info("门诊病历列表信息,返回值xmlstr:" + returnValue);
|
|
logger.info("门诊病历列表信息,返回值xmlstr:" + returnValue);
|
|
@ -8080,4 +8186,139 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, res);
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, res);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 处方签名
|
|
|
|
* @param prescriptionDO
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public void SOF_SignDataWithExtraInfo(WlyyPrescriptionDO prescriptionDO) throws Exception {
|
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
|
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(prescriptionDO.getDoctor());
|
|
|
|
BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode());
|
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
|
|
|
|
PKIService_ServiceLocator locator = new PKIService_ServiceLocator();
|
|
|
|
URL portAddress = new URL("http://192.0.33.91:8080/pkis/services/v1?wsdl");
|
|
|
|
PKIService_PortType service = locator.getPKIServiceImplPort(portAddress);
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
|
|
|
|
List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(), 1);
|
|
|
|
List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionDO.getId(), 1);
|
|
|
|
|
|
|
|
//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());
|
|
|
|
}
|
|
|
|
// 1.1.1 服务端签名(带取证查询扩展信息)
|
|
|
|
// inData 参数
|
|
|
|
String inData = jsonData.toJSONString();
|
|
|
|
inData = org.apache.commons.codec.binary.Base64.encodeBase64String(inData.getBytes("gbk"));
|
|
|
|
// extInfo 参数
|
|
|
|
String idCardNo = "123502004266006872;"+doctorDO.getIdcard();
|
|
|
|
Map<String, String> extInfoMap = new HashMap<String, String>();
|
|
|
|
extInfoMap.put("busSys", "ZhongJianXinLianHLWYY");
|
|
|
|
extInfoMap.put("doctorNo", doctorMappingDO!=null?doctorMappingDO.getMappingCode():null);
|
|
|
|
extInfoMap.put("doctorName", doctorMappingDO!=null?doctorMappingDO.getDoctorName():null);
|
|
|
|
extInfoMap.put("deptName", "部门");
|
|
|
|
extInfoMap.put("patientName", patientDO!=null?patientDO.getName():null);
|
|
|
|
extInfoMap.put("patientSex", patientDO!=null?IdCardUtil.getSexForIdcard(patientDO.getIdcard()):null);
|
|
|
|
extInfoMap.put("hospitalNo", wlyyOutpatientDO!=null?wlyyOutpatientDO.getOriginAdmNo():null);
|
|
|
|
extInfoMap.put("hospitalNumber", wlyyOutpatientDO!=null?wlyyOutpatientDO.getOriginConNo():null);
|
|
|
|
extInfoMap.put("diagnostic", wlyyOutpatientDO!=null?wlyyOutpatientDO.getIcd10Name():null);
|
|
|
|
String extInfo = org.apache.commons.codec.binary.Base64.encodeBase64String(JSON.toJSONString(extInfoMap).getBytes("GBK"));
|
|
|
|
String result = service.SOF_SignDataWithExtraInfo(idCardNo, inData, extInfo);
|
|
|
|
logger.info("请求返参"+result);
|
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
|
|
|
|
if ("1000".equalsIgnoreCase(object.getString("code"))){
|
|
|
|
com.alibaba.fastjson.JSONArray array = com.alibaba.fastjson.JSONArray.parseArray(object.getString("data"));
|
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = array.getJSONObject(i);
|
|
|
|
String signData = jsonObject.getString("signData");
|
|
|
|
String signResult = jsonObject.getString("signResult");
|
|
|
|
String certData = jsonObject.getString("certData");
|
|
|
|
WlyyPrescriptionSignDO prescriptionSignDO = new WlyyPrescriptionSignDO();
|
|
|
|
prescriptionSignDO.setCertData(certData);
|
|
|
|
prescriptionSignDO.setPrescriptionId(prescriptionDO.getId());
|
|
|
|
prescriptionSignDO.setSignData(signData);
|
|
|
|
prescriptionSignDO.setSignResult(signResult);
|
|
|
|
prescriptionSignDO.setCreateTime(new Date());
|
|
|
|
prescriptionSignDO.setUpdateTime(new Date());
|
|
|
|
prescriptionSignDao.save(prescriptionSignDO);
|
|
|
|
}
|
|
|
|
prescriptionDO.setSignFlag(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 电子病历签名
|
|
|
|
* @param prescriptionDO
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public void SOF_SignDataWithExtraInfoEmr(WlyyPrescriptionEmrDO prescriptionEmrDO) throws Exception {
|
|
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionEmrDO.getId());
|
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
|
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(prescriptionDO.getDoctor());
|
|
|
|
BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode());
|
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
|
|
|
|
PKIService_ServiceLocator locator = new PKIService_ServiceLocator();
|
|
|
|
URL portAddress = new URL("http://192.0.33.91:8080/pkis/services/v1?wsdl");
|
|
|
|
PKIService_PortType service = locator.getPKIServiceImplPort(portAddress);
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
|
|
|
|
List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(), 1);
|
|
|
|
List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionDO.getId(), 1);
|
|
|
|
|
|
|
|
//电子病历签名
|
|
|
|
com.alibaba.fastjson.JSONObject jsonData = new com.alibaba.fastjson.JSONObject();
|
|
|
|
jsonData.put("CHIEF_COMPLAINT",prescriptionEmrDO.getComplaint());
|
|
|
|
jsonData.put("HPI",prescriptionEmrDO.getMedicalHistory());
|
|
|
|
jsonData.put("ELAPSEMHIS",prescriptionEmrDO.getPastHistory());
|
|
|
|
jsonData.put("BODYCHECK",prescriptionEmrDO.getPhysicalExamination());
|
|
|
|
jsonData.put("ASSISTANTCHECK",prescriptionEmrDO.getAssistExamination());
|
|
|
|
// 1.1.1 服务端签名(带取证查询扩展信息)
|
|
|
|
// inData 参数
|
|
|
|
String inData = jsonData.toJSONString();
|
|
|
|
inData = org.apache.commons.codec.binary.Base64.encodeBase64String(inData.getBytes("gbk"));
|
|
|
|
// extInfo 参数
|
|
|
|
String idCardNo = "123502004266006872;"+doctorDO.getIdcard();
|
|
|
|
Map<String, String> extInfoMap = new HashMap<String, String>();
|
|
|
|
extInfoMap.put("busSys", "ZhongJianXinLianHLWYY");
|
|
|
|
extInfoMap.put("doctorNo", doctorMappingDO!=null?doctorMappingDO.getMappingCode():null);
|
|
|
|
extInfoMap.put("doctorName", doctorMappingDO!=null?doctorMappingDO.getDoctorName():null);
|
|
|
|
extInfoMap.put("deptName", "部门");
|
|
|
|
extInfoMap.put("patientName", patientDO!=null?patientDO.getName():null);
|
|
|
|
extInfoMap.put("patientSex", patientDO!=null?IdCardUtil.getSexForIdcard(patientDO.getIdcard()):null);
|
|
|
|
extInfoMap.put("hospitalNo", wlyyOutpatientDO!=null?wlyyOutpatientDO.getOriginAdmNo():null);
|
|
|
|
extInfoMap.put("hospitalNumber", wlyyOutpatientDO!=null?wlyyOutpatientDO.getOriginConNo():null);
|
|
|
|
extInfoMap.put("diagnostic", wlyyOutpatientDO!=null?wlyyOutpatientDO.getIcd10Name():null);
|
|
|
|
String extInfo = org.apache.commons.codec.binary.Base64.encodeBase64String(JSON.toJSONString(extInfoMap).getBytes("GBK"));
|
|
|
|
String result = service.SOF_SignDataWithExtraInfo(idCardNo, inData, extInfo);
|
|
|
|
logger.info("请求返参"+result);
|
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
|
|
|
|
if ("1000".equalsIgnoreCase(object.getString("code"))){
|
|
|
|
com.alibaba.fastjson.JSONArray array = com.alibaba.fastjson.JSONArray.parseArray(object.getString("data"));
|
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = array.getJSONObject(i);
|
|
|
|
String signData = jsonObject.getString("signData");
|
|
|
|
String signResult = jsonObject.getString("signResult");
|
|
|
|
String certData = jsonObject.getString("certData");
|
|
|
|
WlyyPrescriptionSignDO prescriptionSignDO = new WlyyPrescriptionSignDO();
|
|
|
|
prescriptionSignDO.setCertData(certData);
|
|
|
|
prescriptionSignDO.setPrescriptionId(prescriptionDO.getId());
|
|
|
|
prescriptionSignDO.setSignData(signData);
|
|
|
|
prescriptionSignDO.setSignResult(signResult);
|
|
|
|
prescriptionSignDO.setCreateTime(new Date());
|
|
|
|
prescriptionSignDO.setUpdateTime(new Date());
|
|
|
|
prescriptionSignDO.setRelationCode(prescriptionEmrDO.getId());
|
|
|
|
prescriptionSignDao.save(prescriptionSignDO);
|
|
|
|
}
|
|
|
|
prescriptionDO.setSignFlag(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|