|
@ -28,6 +28,8 @@ import net.sf.json.JSONArray;
|
|
import net.sf.json.xml.XMLSerializer;
|
|
import net.sf.json.xml.XMLSerializer;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
@ -51,6 +53,7 @@ import java.util.stream.Collectors;
|
|
@Service
|
|
@Service
|
|
@Transactional
|
|
@Transactional
|
|
public class EntranceService {
|
|
public class EntranceService {
|
|
|
|
private Logger logger= LoggerFactory.getLogger(EntranceService.class);
|
|
//门诊余额查询
|
|
//门诊余额查询
|
|
private static String BS15017="BS15017";
|
|
private static String BS15017="BS15017";
|
|
//门诊就诊卡列表
|
|
//门诊就诊卡列表
|
|
@ -1331,31 +1334,33 @@ public class EntranceService {
|
|
} else {
|
|
} else {
|
|
jsonArray= BS55010( windowsNo, code, chargeType, demoFlag);
|
|
jsonArray= BS55010( windowsNo, code, chargeType, demoFlag);
|
|
}
|
|
}
|
|
for(Object object:jsonArray){
|
|
|
|
net.sf.json.JSONObject jsonObjectBody=(net.sf.json.JSONObject)object;
|
|
|
|
String chareName="";
|
|
|
|
if(null!=jsonObjectBody){
|
|
|
|
String chareCode=null==jsonObjectBody.get("charge_type")?"":jsonObjectBody.get("charge_type").toString();
|
|
|
|
String winNo=null==jsonObjectBody.get("windows_no")?"":jsonObjectBody.get("windows_no").toString();
|
|
|
|
//WlyyChargeDictDO
|
|
|
|
if(!map.containsKey(chareCode+"_"+winNo)){
|
|
|
|
//查询号别
|
|
|
|
net.sf.json.JSONArray chares= MS02013(chareCode);
|
|
|
|
for(Object object1:chares) {
|
|
|
|
net.sf.json.JSONObject jsonObjectBody1 = (net.sf.json.JSONObject) object1;
|
|
|
|
chareName=null==jsonObjectBody1.get("name")?"":jsonObjectBody1.get("name").toString();
|
|
|
|
System.out.println(chareCode+chareName);
|
|
|
|
WlyyChargeDictDO wlyyChargeDictDO=new WlyyChargeDictDO();
|
|
|
|
wlyyChargeDictDO.setChargeType(chareCode);
|
|
|
|
wlyyChargeDictDO.setChargeName(chareName);
|
|
|
|
|
|
|
|
wlyyChargeDictDO.setDeptTypeCode(winNo);
|
|
|
|
Double free=null==jsonObjectBody.get("req_fee")?0:Double.parseDouble(jsonObjectBody.get("req_fee").toString());
|
|
|
|
wlyyChargeDictDO.setReqFee(free);
|
|
|
|
wlyyChargeDictDO.setCreateTime(new Date());
|
|
|
|
map.put(chareCode+"_"+winNo,chareName);
|
|
|
|
wlyyChargeDictDO=wlyyChargeDictDao.save(wlyyChargeDictDO);
|
|
|
|
wlyyChargeDictDOS.add(wlyyChargeDictDO);
|
|
|
|
|
|
if(null!=jsonArray){
|
|
|
|
for(Object object:jsonArray){
|
|
|
|
net.sf.json.JSONObject jsonObjectBody=(net.sf.json.JSONObject)object;
|
|
|
|
String chareName="";
|
|
|
|
if(null!=jsonObjectBody){
|
|
|
|
String chareCode=null==jsonObjectBody.get("charge_type")?"":jsonObjectBody.get("charge_type").toString();
|
|
|
|
String winNo=null==jsonObjectBody.get("windows_no")?"":jsonObjectBody.get("windows_no").toString();
|
|
|
|
//WlyyChargeDictDO
|
|
|
|
if(!map.containsKey(chareCode+"_"+winNo)){
|
|
|
|
//查询号别
|
|
|
|
net.sf.json.JSONArray chares= MS02013(chareCode);
|
|
|
|
for(Object object1:chares) {
|
|
|
|
net.sf.json.JSONObject jsonObjectBody1 = (net.sf.json.JSONObject) object1;
|
|
|
|
chareName=null==jsonObjectBody1.get("name")?"":jsonObjectBody1.get("name").toString();
|
|
|
|
System.out.println(chareCode+chareName);
|
|
|
|
WlyyChargeDictDO wlyyChargeDictDO=new WlyyChargeDictDO();
|
|
|
|
wlyyChargeDictDO.setChargeType(chareCode);
|
|
|
|
wlyyChargeDictDO.setChargeName(chareName);
|
|
|
|
|
|
|
|
wlyyChargeDictDO.setDeptTypeCode(winNo);
|
|
|
|
Double free=null==jsonObjectBody.get("req_fee")?0:Double.parseDouble(jsonObjectBody.get("req_fee").toString());
|
|
|
|
wlyyChargeDictDO.setReqFee(free);
|
|
|
|
wlyyChargeDictDO.setCreateTime(new Date());
|
|
|
|
map.put(chareCode+"_"+winNo,chareName);
|
|
|
|
wlyyChargeDictDO=wlyyChargeDictDao.save(wlyyChargeDictDO);
|
|
|
|
wlyyChargeDictDOS.add(wlyyChargeDictDO);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -1417,71 +1422,98 @@ public class EntranceService {
|
|
resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
|
|
resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
|
|
resp = MqSdkUtil.xml2jsonArrayRootRowMS02003(resp);
|
|
resp = MqSdkUtil.xml2jsonArrayRootRowMS02003(resp);
|
|
}
|
|
}
|
|
net.sf.json.JSONArray jsonArray = ConvertUtil.convertListEnvelopInBodyRowMS02003(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();
|
|
|
|
|
|
net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(resp);
|
|
|
|
if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
|
|
|
|
JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
|
|
|
|
if(null!=jsonObjectMgsInfo){
|
|
|
|
for (Object object : jsonObjectMgsInfo) {
|
|
|
|
net.sf.json.JSONObject jsonArraySub = (net.sf.json.JSONObject) object;
|
|
|
|
jsonObjectMgsInfo=(JSONArray)jsonArraySub.get("body");
|
|
|
|
if(jsonObjectMgsInfo instanceof JSONArray){
|
|
|
|
for (Object objectSub : jsonObjectMgsInfo) {
|
|
|
|
net.sf.json.JSONObject jsonObjectBody = (net.sf.json.JSONObject) objectSub;
|
|
|
|
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 = "";
|
|
|
|
if(null!=jsonArrayCharge){
|
|
|
|
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.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();
|
|
|
|
//互联网医院:1停用,0使用 转 i健康:1正常,0作废
|
|
|
|
baseDoctorDO.setDel("1".equals(disableFlag) ? "0" : "1");
|
|
|
|
//姓名
|
|
|
|
doctorName = null == jsonObjectBody.get("Emp_Name") ? "" : jsonObjectBody.get("Emp_Name").toString();
|
|
|
|
//号别
|
|
|
|
baseDoctorDO.setChargeType(chareType);
|
|
|
|
if (StringUtils.isNotBlank(idCard)) {
|
|
|
|
baseDoctorDO.setSalt(PwdUtil.randomString(5));
|
|
|
|
try {
|
|
|
|
baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex(baseDoctorDO.getIdcard().substring(baseDoctorDO.getIdcard().length()-6) + "{" + baseDoctorDO.getSalt() + "}"));
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error(e.getMessage()+"docotr="+doctorCode+";idcard="+baseDoctorDO.getIdcard());
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex("123456"+ "{" + baseDoctorDO.getSalt() + "}"));
|
|
|
|
}
|
|
|
|
baseDoctorDO.setName(doctorName);
|
|
|
|
baseDoctorDO.setIsFamous(0);
|
|
|
|
baseDoctorDO.setCreateTime(new Date());
|
|
|
|
baseDoctorDO.setUpdateTime(new Date());
|
|
|
|
baseDoctorDO.setMobile("0");
|
|
|
|
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++;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
//保存医生信息
|
|
|
|
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();
|
|
|
|
//互联网医院:1停用,0使用 转 i健康:1正常,0作废
|
|
|
|
baseDoctorDO.setDel("1".equals(disableFlag) ? "0" : "1");
|
|
|
|
//姓名
|
|
|
|
doctorName = null == jsonObjectBody.get("Emp_Name") ? "" : jsonObjectBody.get("Emp_Name").toString();
|
|
|
|
//号别
|
|
|
|
baseDoctorDO.setChargeType(chareType);
|
|
|
|
if (StringUtils.isNotBlank(idCard)) {
|
|
|
|
baseDoctorDO.setSalt(PwdUtil.randomString(5));
|
|
|
|
baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex(baseDoctorDO.getIdcard().substring(12, 18) + "{" + baseDoctorDO.getSalt() + "}"));
|
|
|
|
}
|
|
|
|
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++;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
}}
|
|
|
|
// net.sf.json.JSONArray jsonArray = ConvertUtil.convertListEnvelopInBodyRowMS02003(resp);
|
|
|
|
// for (Object object : jsonArray) { }
|
|
// }
|
|
// }
|
|
return i;
|
|
return i;
|
|
}
|
|
}
|