|
@ -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;
|
|
|
|
|
|
/**
|
|
|
* 获取本地示例返参
|
|
@ -123,7 +131,7 @@ public class EntranceService {
|
|
|
|
|
|
/**
|
|
|
* 查询门诊余额
|
|
|
* @param cardNo 身份证号码,必传参数
|
|
|
* @param cardNo 卡号,必传参数
|
|
|
* @param demoFlag 是否使用demo.不请求接口。true代表获取本地数据,false代表获取his数据
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@ -163,8 +171,8 @@ public class EntranceService {
|
|
|
|
|
|
/**
|
|
|
* 门诊就诊卡列表
|
|
|
* @param SOCIAL_NO 身份证号,二者不能都为空
|
|
|
* @param CARD_NO 就诊卡号,二者不能都为空
|
|
|
* @param SOCIAL_NO 身份证号
|
|
|
* @param CARD_NO 就诊卡号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
@ -280,6 +288,8 @@ public class EntranceService {
|
|
|
wlyyPrescriptionVO = initWlyyPrescriptionVo(new WlyyPrescriptionVO(), jsonObjectBody, realOrder);
|
|
|
wlyyPrescriptionVO.setHospital("350211A1002");
|
|
|
wlyyPrescriptionVO.setHospitalName("厦门市中山医院");
|
|
|
String doasgeTime=null != jsonObjectBody.get("DISP_DATE") ? jsonObjectBody.get("DISP_DATE").toString() : "";
|
|
|
wlyyPrescriptionVO.setDosageTime(DateUtil.strToDate((doasgeTime+" 00:00:00"),DateUtil.YYYY_MM_DD_HH_MM_SS));
|
|
|
wlyyPrescriptionVOMap.put(realOrder, wlyyPrescriptionVO);
|
|
|
//主诊断 毒蛇咬伤&T63.001
|
|
|
String[] icdName = jsonObjectBody.get("icd_name").toString().split("&");
|
|
@ -376,7 +386,7 @@ public class EntranceService {
|
|
|
|
|
|
wlyyPrescriptionVO.setPatientCode(patNo);
|
|
|
wlyyPrescriptionVO.setPatientName(patientName);
|
|
|
wlyyPrescriptionVO.setIdcard(patientMappingDo.getIdcard());
|
|
|
wlyyPrescriptionVO.setIdcard(null==patientMappingDo?null:patientMappingDo.getIdcard());
|
|
|
//TODO 社保卡号
|
|
|
wlyyPrescriptionVO.setSsc("");
|
|
|
wlyyPrescriptionVO.setHisDoctorCode(null != jsonObjectBody.get("PRESC_DOC") ? jsonObjectBody.get("PRESC_DOC").toString() : "");
|
|
@ -417,6 +427,8 @@ public class EntranceService {
|
|
|
public List<WlyyOutpatientVO> BS30025(String PAT_NO,String conNo,String startTime,String endTime,boolean demoFlag) throws Exception {
|
|
|
String fid = BS30025;
|
|
|
String resp = "";
|
|
|
String orgCode = "350211A1002";
|
|
|
String orgName = "厦门市中山医院";
|
|
|
if (demoFlag) {
|
|
|
resp = getJosnFileResullt(fid);
|
|
|
} else {
|
|
@ -452,8 +464,8 @@ public class EntranceService {
|
|
|
if (null != jsonObjectMgsInfo) {
|
|
|
wlyyOutpatientVO = new WlyyOutpatientVO();
|
|
|
//中山医院固定入参
|
|
|
wlyyOutpatientVO.setHospital("350211A1002");
|
|
|
wlyyOutpatientVO.setHospitalName("厦门市中山医院");
|
|
|
wlyyOutpatientVO.setHospital(orgCode);
|
|
|
wlyyOutpatientVO.setHospitalName(orgName);
|
|
|
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") + "");
|
|
@ -470,15 +482,60 @@ public class EntranceService {
|
|
|
wlyyOutpatientVO.setPatient(patNo);
|
|
|
wlyyOutpatientVO.setPatientName(patientName);
|
|
|
wlyyOutpatientVO.setConNo(null == jsonObjectMgsInfo.get("CON_NO") ? "" : jsonObjectMgsInfo.get("CON_NO") + "");
|
|
|
wlyyOutpatientVO.setDoctor(null == jsonObjectMgsInfo.get("CON_DOC") ? "" : jsonObjectMgsInfo.get("CON_DOC") + "");
|
|
|
String doctor=null == jsonObjectMgsInfo.get("CON_DOC") ? "" : jsonObjectMgsInfo.get("CON_DOC") + "";
|
|
|
|
|
|
//转化医生
|
|
|
String mappingCode = doctor.trim();
|
|
|
String doctorCode = "";
|
|
|
if(StringUtils.isNotBlank(mappingCode)){
|
|
|
List<DoctorMappingDO> mappingDOs =doctorMappingDao.findByOrgCodeAndMappingCode(orgCode,mappingCode);
|
|
|
if(mappingDOs!=null&&mappingDOs.size()>0){
|
|
|
doctorCode = mappingDOs.get(0).getDoctor();
|
|
|
}
|
|
|
}
|
|
|
wlyyOutpatientVO.setDoctor(doctorCode);
|
|
|
wlyyOutpatientVO.setDoctorName(null == jsonObjectMgsInfo.get("CON_DOC_NAME") ? "" : jsonObjectMgsInfo.get("CON_DOC_NAME") + "");
|
|
|
|
|
|
wlyyOutpatientVO.setIdcard(null == jsonObjectMgsInfo.get("social_no") ? "" : jsonObjectMgsInfo.get("social_no") + "");
|
|
|
wlyyOutpatientVO.setMjz(null == jsonObjectMgsInfo.get("MJZ") ? "" : jsonObjectMgsInfo.get("MJZ") + "");
|
|
|
String icds = null == jsonObjectMgsInfo.get("icd_name") ? "" : jsonObjectMgsInfo.get("icd_name") + "";
|
|
|
String[] icdcodeAndName = icds.split("&");
|
|
|
wlyyOutpatientVO.setIcd10(icdcodeAndName.length > 1 ? icdcodeAndName[1].toString() : "");
|
|
|
wlyyOutpatientVO.setIcd10Name(icdcodeAndName.length > 0 ? icdcodeAndName[0].toString() : "");
|
|
|
|
|
|
//主诊断 毒蛇咬伤&T63.001
|
|
|
String[] icdName = jsonObjectMgsInfo.get("icd_name").toString().split("&");
|
|
|
String[] diagTwo = jsonObjectMgsInfo.get("diag_two").toString().split("&");
|
|
|
String[] diagThree = jsonObjectMgsInfo.get("diag_three").toString().split("&");
|
|
|
String[] diagFour = jsonObjectMgsInfo.get("diag_four").toString().split("&");
|
|
|
String[] diagFive = jsonObjectMgsInfo.get("diag_five").toString().split("&");
|
|
|
|
|
|
String icdcodes = "";
|
|
|
String icdNames = "";
|
|
|
if(icdName.length>0){
|
|
|
icdcodes += icdName[1];
|
|
|
icdNames += icdName[0];
|
|
|
}
|
|
|
if(diagTwo.length>0){
|
|
|
icdcodes += ","+diagTwo[1];
|
|
|
icdNames += ","+diagTwo[0];
|
|
|
}
|
|
|
if(diagThree.length>0){
|
|
|
icdcodes += ","+diagThree[1];
|
|
|
icdNames += ","+diagThree[0];
|
|
|
}
|
|
|
if(diagFour.length>0){
|
|
|
icdcodes += ","+diagFour[1];
|
|
|
icdNames += ","+diagFour[0];
|
|
|
}
|
|
|
if(diagFive.length>0){
|
|
|
icdcodes += ","+diagFive[1];
|
|
|
icdNames += ","+diagFive[0];
|
|
|
}
|
|
|
|
|
|
// String icds = null == jsonObjectMgsInfo.get("icd_name") ? "" : jsonObjectMgsInfo.get("icd_name") + "";
|
|
|
// String[] icdcodeAndName = icds.split("&");
|
|
|
// wlyyOutpatientVO.setIcd10(icdcodeAndName.length > 1 ? icdcodeAndName[1].toString() : "");
|
|
|
// wlyyOutpatientVO.setIcd10Name(icdcodeAndName.length > 0 ? icdcodeAndName[0].toString() : "");
|
|
|
wlyyOutpatientVO.setIcd10(icdcodes);
|
|
|
wlyyOutpatientVO.setIcd10Name(icdNames);
|
|
|
|
|
|
String admDate = null == jsonObjectMgsInfo.get("ADM_DAT") ? "" : jsonObjectMgsInfo.get("ADM_DAT") + "";
|
|
|
String conDate = null == jsonObjectMgsInfo.get("CON_DATE") ? "" : jsonObjectMgsInfo.get("CON_DATE") + "";
|
|
|
wlyyOutpatientVO.setAdmDate(DateUtil.strToDate(admDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
|
|
@ -1335,59 +1392,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.setDoctorName(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++;
|
|
|
}
|
|
|
}
|