|
@ -5,7 +5,9 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
|
|
|
import com.yihu.jw.dict.service.DictHospitalDeptService;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.HospitalDeptMappingDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
|
|
@ -17,6 +19,8 @@ import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.util.WebserviceUtil;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.*;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.util.idcard.IdCardUtil;
|
|
|
import com.yihu.jw.util.security.MD5;
|
|
|
import net.sf.json.JSON;
|
|
|
import net.sf.json.JSONArray;
|
|
|
import net.sf.json.xml.XMLSerializer;
|
|
@ -83,6 +87,8 @@ public class EntranceService {
|
|
|
private PatientMappingDao patientMappingDao;
|
|
|
@Autowired
|
|
|
private WlyyChargeDictDao wlyyChargeDictDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
|
|
|
/**
|
|
|
* 获取本地示例返参
|
|
@ -448,8 +454,10 @@ public class EntranceService {
|
|
|
net.sf.json.JSONObject jsonObjectMgsInfo = (net.sf.json.JSONObject) object;
|
|
|
if (null != jsonObjectMgsInfo) {
|
|
|
wlyyOutpatientVO = new WlyyOutpatientVO();
|
|
|
//中山医院固定入参
|
|
|
wlyyOutpatientVO.setHospital("350211A1002");
|
|
|
wlyyOutpatientVO.setHospitalName("厦门市中山医院");
|
|
|
wlyyOutpatientVO.setWinNo("6");
|
|
|
wlyyOutpatientVO.setAdmNo(null == jsonObjectMgsInfo.get("ADM_NO") ? "" : jsonObjectMgsInfo.get("ADM_NO") + "");
|
|
|
wlyyOutpatientVO.setRegisterNo(null == jsonObjectMgsInfo.get("REGISTER_SN") ? "" : jsonObjectMgsInfo.get("REGISTER_SN") + "");
|
|
|
wlyyOutpatientVO.setDept(null == jsonObjectMgsInfo.get("ADM_SPEC") ? "" : jsonObjectMgsInfo.get("ADM_SPEC") + "");
|
|
@ -1241,35 +1249,27 @@ public class EntranceService {
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<WlyyChargeDictDO> BS55010(String windowsNo,String code,String chargeType,boolean demoFlag) throws Exception {
|
|
|
String fid="BS55010";
|
|
|
/**
|
|
|
* 诊查费字典同步
|
|
|
* @param windowsNo 分部号
|
|
|
* @param code 医生code
|
|
|
* @param chargeType 号别
|
|
|
* @param demoFlag 是否获取demo数据
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public List<WlyyChargeDictDO> chargeDict(String windowsNo,String code,String chargeType,boolean demoFlag) throws Exception {
|
|
|
String resp="";
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
List<WlyyChargeDictDO> wlyyChargeDictDOS=new ArrayList<>();
|
|
|
net.sf.json.JSONArray jsonArray=new JSONArray();
|
|
|
if (demoFlag) {
|
|
|
String fid="BS55010";
|
|
|
resp = getJosnFileResullt(fid);
|
|
|
jsonArray= ConvertUtil.convertListEnvelopInBodyRow(resp);
|
|
|
} else {
|
|
|
StringBuffer sbs = new StringBuffer();
|
|
|
//AccessControl :用户、密码、服务id
|
|
|
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("<MsgInfo><endNum>20000</endNum><Msg/>");
|
|
|
if (StringUtils.isNotBlank(windowsNo)) {
|
|
|
sbs.append("<query compy=\"=\" item=\"windows_no\" splice=\"and\" value=\"'"+windowsNo+"'\"/>");
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(chargeType)) {
|
|
|
sbs.append("<query compy=\"=\" item=\"charge_type\" splice=\"and\" value=\"'"+chargeType+"'\"/>");
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(code)) {
|
|
|
sbs.append("<query compy=\"=\" item=\"code\" splice=\"and\" value=\"'"+code+"'\"/>");
|
|
|
}
|
|
|
sbs.append("<startNum>1</startNum></MsgInfo></ESBEntry>");
|
|
|
resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
|
|
|
resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
|
|
|
jsonArray= BS55010( windowsNo, code, chargeType, demoFlag);
|
|
|
}
|
|
|
net.sf.json.JSONArray jsonArray= ConvertUtil.convertListEnvelopInBodyRow(resp);
|
|
|
for(Object object:jsonArray){
|
|
|
net.sf.json.JSONObject jsonObjectBody=(net.sf.json.JSONObject)object;
|
|
|
String chareName="";
|
|
@ -1302,5 +1302,97 @@ public class EntranceService {
|
|
|
return wlyyChargeDictDOS;
|
|
|
}
|
|
|
|
|
|
public net.sf.json.JSONArray BS55010(String windowsNo,String code,String chargeType,boolean demoFlag) throws Exception {
|
|
|
String fid="BS55010";
|
|
|
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>");
|
|
|
//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("<MsgInfo><endNum>20000</endNum><Msg/>");
|
|
|
if (StringUtils.isNotBlank(windowsNo)) {
|
|
|
sbs.append("<query compy=\"=\" item=\"windows_no\" splice=\"and\" value=\"'"+windowsNo+"'\"/>");
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(chargeType)) {
|
|
|
sbs.append("<query compy=\"=\" item=\"charge_type\" splice=\"and\" value=\"'"+chargeType+"'\"/>");
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(code)) {
|
|
|
sbs.append("<query compy=\"=\" item=\"code\" splice=\"and\" value=\"'"+code+"'\"/>");
|
|
|
}
|
|
|
sbs.append("<startNum>1</startNum></MsgInfo></ESBEntry>");
|
|
|
resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
|
|
|
resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
|
|
|
}
|
|
|
return ConvertUtil.convertListEnvelopInBodyRow(resp);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 同步医生到本地库,获取到医生的时候需要调用BS55010 查询医生的诊查费
|
|
|
* @param demoFlag
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray MS02003(boolean demoFlag) throws Exception {
|
|
|
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>");
|
|
|
//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("<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){
|
|
|
//获取中山医院的医生
|
|
|
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 chareCode="";
|
|
|
for(Object objectCharge:jsonArrayCharge){
|
|
|
net.sf.json.JSONObject jsonObjectBodyCharge=(net.sf.json.JSONObject)objectCharge;
|
|
|
if(null!=jsonObjectBodyCharge){
|
|
|
chareCode=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.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.setDel("1".equals(disableFlag)?"0":"1");
|
|
|
baseDoctorDO.setName(null==jsonObjectBody.get("Emp_Name")?"":jsonObjectBody.get("Emp_Name").toString());
|
|
|
// baseDoctorDO.setch
|
|
|
if(StringUtils.isNotBlank(idCard)){
|
|
|
String salt = UUID.randomUUID().toString().replaceAll("-","");
|
|
|
baseDoctorDO.setSalt(salt);
|
|
|
String password = MD5.GetMD5Code(idCard.substring(idCard.length()-6) + salt);
|
|
|
baseDoctorDO.setPassword(password);
|
|
|
}
|
|
|
baseDoctorDao.save(baseDoctorDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return ConvertUtil.convertListEnvelopInBodyRow(resp);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|