|
@ -5,11 +5,15 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
|
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.hospital.dict.WlyyChargeDictDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
|
|
|
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
|
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
|
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
|
|
@ -86,6 +90,10 @@ public class EntranceService {
|
|
|
private WlyyChargeDictDao wlyyChargeDictDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
@Autowired
|
|
|
private DoctorMappingDao doctorMappingDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorHospitalDao baseDoctorHospitalDao;
|
|
|
|
|
|
/**
|
|
|
* 获取本地示例返参
|
|
@ -1335,59 +1343,84 @@ public class EntranceService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public int MS02003(boolean demoFlag) throws Exception {
|
|
|
int i=0;
|
|
|
String fid="MS02003";
|
|
|
String resp="";
|
|
|
int i = 0;
|
|
|
String fid = "MS02003";
|
|
|
String resp = "";
|
|
|
if (demoFlag) {
|
|
|
resp = getJosnFileResullt(fid);
|
|
|
} else {
|
|
|
StringBuffer sbs = new StringBuffer();
|
|
|
//AccessControl :用户、密码、服务id
|
|
|
sbs.append("<ESBEntry><AccessControl><Fid>" + fid + "</Fid><UserName>"+mqUser+"</UserName><Password>"+mqPwd+"</Password></AccessControl>");
|
|
|
sbs.append("<ESBEntry><AccessControl><Fid>" + fid + "</Fid><UserName>" + mqUser + "</UserName><Password>" + mqPwd + "</Password></AccessControl>");
|
|
|
//MessageHeader :固定值 消费方系统编号 S60,提供方系统编号 S01
|
|
|
sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>"+sourceSysCode+"</SourceSysCode><TargetSysCode>"+targetSysCode+"</TargetSysCode></MessageHeader>");
|
|
|
sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>" + sourceSysCode + "</SourceSysCode><TargetSysCode>" + targetSysCode + "</TargetSysCode></MessageHeader>");
|
|
|
//查询信息拼接
|
|
|
sbs.append("<MsgInfo><endNum>10000</endNum><Msg></Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
|
|
|
|
|
|
resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
|
|
|
resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
|
|
|
net.sf.json.JSONArray jsonArray= ConvertUtil.convertListEnvelopInBodyRow(resp);
|
|
|
for(Object object:jsonArray){
|
|
|
net.sf.json.JSONObject jsonObjectBody=(net.sf.json.JSONObject)object;
|
|
|
String doctorCode="";
|
|
|
if(null!=jsonObjectBody){
|
|
|
net.sf.json.JSONArray jsonArray = ConvertUtil.convertListEnvelopInBodyRow(resp);
|
|
|
for (Object object : jsonArray) {
|
|
|
net.sf.json.JSONObject jsonObjectBody = (net.sf.json.JSONObject) object;
|
|
|
String doctorCode = "";
|
|
|
String doctorName = "";
|
|
|
if (null != jsonObjectBody) {
|
|
|
//获取中山医院的医生
|
|
|
String winNo="6";
|
|
|
doctorCode=null==jsonObjectBody.get("Emp_Code")?"":jsonObjectBody.get("Emp_Code").toString();
|
|
|
//根据医生及分部,获取医生号别
|
|
|
net.sf.json.JSONArray jsonArrayCharge= BS55010(winNo,doctorCode,null,false);
|
|
|
String chareType="";
|
|
|
for(Object objectCharge:jsonArrayCharge){
|
|
|
net.sf.json.JSONObject jsonObjectBodyCharge=(net.sf.json.JSONObject)objectCharge;
|
|
|
if(null!=jsonObjectBodyCharge){
|
|
|
chareType=null==jsonObjectBodyCharge.get("charge_type")?"":jsonObjectBodyCharge.get("charge_type").toString();
|
|
|
String winNo = "6";
|
|
|
doctorCode = null == jsonObjectBody.get("Emp_Code") ? "" : jsonObjectBody.get("Emp_Code").toString();
|
|
|
//根据医生及分部,获取医生号别
|
|
|
net.sf.json.JSONArray jsonArrayCharge = BS55010(winNo, doctorCode, null, false);
|
|
|
String chareType = "";
|
|
|
for (Object objectCharge : jsonArrayCharge) {
|
|
|
net.sf.json.JSONObject jsonObjectBodyCharge = (net.sf.json.JSONObject) objectCharge;
|
|
|
if (null != jsonObjectBodyCharge) {
|
|
|
chareType = null == jsonObjectBodyCharge.get("charge_type") ? "" : jsonObjectBodyCharge.get("charge_type").toString();
|
|
|
}
|
|
|
}
|
|
|
//保存医生信息
|
|
|
BaseDoctorDO baseDoctorDO=new BaseDoctorDO();
|
|
|
String idCard=null==jsonObjectBody.get("Card_Id")?"":jsonObjectBody.get("Card_Id").toString();
|
|
|
BaseDoctorDO baseDoctorDO = new BaseDoctorDO();
|
|
|
String idCard = null == jsonObjectBody.get("Card_Id") ? "" : jsonObjectBody.get("Card_Id").toString();
|
|
|
baseDoctorDO.setIdcard(idCard);
|
|
|
baseDoctorDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
|
|
|
baseDoctorDO.setSex(Integer.valueOf(IdCardUtil.getSexForIdcard(idCard)));
|
|
|
//拼音码
|
|
|
baseDoctorDO.setSpell(null==jsonObjectBody.get("PinYin_Code")?"":jsonObjectBody.get("PinYin_Code").toString());
|
|
|
String disableFlag=null==jsonObjectBody.get("Disable_Flag")?"":jsonObjectBody.get("Disable_Flag").toString();
|
|
|
baseDoctorDO.setSpell(null == jsonObjectBody.get("PinYin_Code") ? "" : jsonObjectBody.get("PinYin_Code").toString());
|
|
|
String disableFlag = null == jsonObjectBody.get("Disable_Flag") ? "" : jsonObjectBody.get("Disable_Flag").toString();
|
|
|
//互联网医院:1停用,0使用 转 i健康:1正常,0作废
|
|
|
baseDoctorDO.setDel("1".equals(disableFlag)?"0":"1");
|
|
|
baseDoctorDO.setDel("1".equals(disableFlag) ? "0" : "1");
|
|
|
//姓名
|
|
|
baseDoctorDO.setName(null==jsonObjectBody.get("Emp_Name")?"":jsonObjectBody.get("Emp_Name").toString());
|
|
|
doctorName = null == jsonObjectBody.get("Emp_Name") ? "" : jsonObjectBody.get("Emp_Name").toString();
|
|
|
//号别
|
|
|
baseDoctorDO.setChargeType(chareType);
|
|
|
if(StringUtils.isNotBlank(idCard)){
|
|
|
if (StringUtils.isNotBlank(idCard)) {
|
|
|
baseDoctorDO.setSalt(PwdUtil.randomString(5));
|
|
|
baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex(baseDoctorDO.getIdcard().substring(12, 18) + "{" + baseDoctorDO.getSalt() + "}"));
|
|
|
}
|
|
|
baseDoctorDao.save(baseDoctorDO);
|
|
|
baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
|
|
|
//根据医生和机构判断数据是否存在,若不存在则在mapping中追加记录
|
|
|
List<DoctorMappingDO> doctorMappingDOS = doctorMappingDao.findByDoctorAndOrgCode(baseDoctorDO.getId(), "350211A1002");
|
|
|
if (!(null != doctorMappingDOS && doctorMappingDOS.size() > 0)) {
|
|
|
DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
|
|
|
doctorMappingDO.setDoctor(baseDoctorDO.getId());
|
|
|
doctorMappingDO.setDoctor_name(doctorName);
|
|
|
doctorMappingDO.setMappingCode(doctorCode);
|
|
|
doctorMappingDO.setMappingName(doctorName);
|
|
|
doctorMappingDO.setOrgCode("350211A1002");
|
|
|
doctorMappingDO.setOrgName("厦门市中山医院");
|
|
|
doctorMappingDao.save(doctorMappingDO);
|
|
|
}
|
|
|
// 用医生和机构id、部门判断数据是否存在,若不存在则保存医生机构关联关系
|
|
|
String deptCode = null == jsonObjectBody.get("Dept_Code") ? "" : jsonObjectBody.get("Dept_Code").toString();
|
|
|
List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByOrgCodeAndDeptCodeAndDoctorCode("350211A1002", deptCode, baseDoctorDO.getId());
|
|
|
if (!(null != baseDoctorHospitalDOS && baseDoctorHospitalDOS.size() > 0)) {
|
|
|
BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
|
|
|
baseDoctorHospitalDO.setOrgCode("350211A1002");
|
|
|
baseDoctorHospitalDO.setOrgName("厦门市中山医院");
|
|
|
baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
|
|
|
baseDoctorHospitalDO.setDeptCode(deptCode);
|
|
|
baseDoctorHospitalDO.setDel("1");
|
|
|
baseDoctorHospitalDao.save(baseDoctorHospitalDO);
|
|
|
}
|
|
|
i++;
|
|
|
}
|
|
|
}
|