|
@ -38,6 +38,7 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
|
|
import com.yihu.jw.rm.iot.IotRequestMapping;
|
|
import com.yihu.jw.rm.iot.IotRequestMapping;
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
import com.yihu.utils.network.HttpResponse;
|
|
import com.yihu.utils.network.HttpResponse;
|
|
@ -70,6 +71,10 @@ public class YkyyEntranceService {
|
|
|
|
|
|
private final static String saveUrl="http://192.168.20.55:10023/ykyy/save";
|
|
private final static String saveUrl="http://192.168.20.55:10023/ykyy/save";
|
|
|
|
|
|
|
|
private final static String updateUrl="http://192.168.20.55:10023/ykyy/updateBySql";
|
|
|
|
|
|
|
|
private final static String updateEntityUrl="http://192.168.20.55:10023/ykyy/update";
|
|
|
|
|
|
private final static String orgCode ="350211A5004";
|
|
private final static String orgCode ="350211A5004";
|
|
|
|
|
|
private final static String orgName ="厦门大学附属厦门眼科中心";
|
|
private final static String orgName ="厦门大学附属厦门眼科中心";
|
|
@ -101,9 +106,6 @@ public class YkyyEntranceService {
|
|
@Autowired
|
|
@Autowired
|
|
private PrescriptionDao prescriptionDao;
|
|
private PrescriptionDao prescriptionDao;
|
|
|
|
|
|
@Autowired
|
|
|
|
private PrescriptionInfoDao prescriptionInfoDao;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private BaseEvaluateScoreDao baseEvaluateScoreDao;
|
|
private BaseEvaluateScoreDao baseEvaluateScoreDao;
|
|
|
|
|
|
@ -114,11 +116,14 @@ public class YkyyEntranceService {
|
|
private HibenateUtils hibenateUtils;
|
|
private HibenateUtils hibenateUtils;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ObjectMapper objectMapper;
|
|
|
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private YkDictIcd10Dao ykDictIcd10Dao;
|
|
private YkDictIcd10Dao ykDictIcd10Dao;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private PrescriptionInfoDao prescriptionInfoDao;
|
|
|
|
|
|
|
|
|
|
public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
|
|
public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
|
|
return hibenateUtils.createSQLQuery(sql,params,page,size);
|
|
return hibenateUtils.createSQLQuery(sql,params,page,size);
|
|
@ -129,8 +134,8 @@ public class YkyyEntranceService {
|
|
hibenateUtils.save(object);
|
|
hibenateUtils.save(object);
|
|
}
|
|
}
|
|
|
|
|
|
public void update(String id,Integer status){
|
|
|
|
hibenateUtils.update(id,status);
|
|
|
|
|
|
public void update(Object object){
|
|
|
|
hibenateUtils.update(object);
|
|
}
|
|
}
|
|
|
|
|
|
public void updateBySql(String sql){
|
|
public void updateBySql(String sql){
|
|
@ -434,6 +439,130 @@ public class YkyyEntranceService {
|
|
return "success";
|
|
return "success";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String updateYkTDoctor()throws Exception{
|
|
|
|
String response="";
|
|
|
|
String url = "http://www.yanketong.com:133/api/doc_jkzl/doctor_list_had_bind_account?hospital_code=sb&page=1";
|
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
|
logger.info("response:"+response);
|
|
|
|
JSONObject rs = JSON.parseObject(response);
|
|
|
|
Integer status = rs.getInteger("code");
|
|
|
|
if(status!=null&&status == 200){
|
|
|
|
JSONObject object = rs.getJSONObject("data");
|
|
|
|
JSONArray array = object.getJSONArray("list");
|
|
|
|
logger.info("doctor size:"+array.size());
|
|
|
|
if(array!=null&&array.size()>0) {
|
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
|
JSONObject doctorJson = array.getJSONObject(i);
|
|
|
|
String idcard = doctorJson.getString("idcard");
|
|
|
|
|
|
|
|
//过滤身份证脏数据
|
|
|
|
if(idcard.length()>=15){
|
|
|
|
|
|
|
|
List<BaseDoctorDO> doctorDOs = baseDoctorDao.findByIdcard(idcard);
|
|
|
|
|
|
|
|
if(doctorDOs!=null&&doctorDOs.size()>0){
|
|
|
|
|
|
|
|
BaseDoctorDO doctor = doctorDOs.get(0);
|
|
|
|
|
|
|
|
String salt = randomString(5);
|
|
|
|
String pw = idcard.substring(idcard.length() - 6);
|
|
|
|
doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
|
doctor.setSalt(salt);
|
|
|
|
|
|
|
|
doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
|
|
|
|
doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
|
|
|
|
// doctor.setExpertise(doctorJson.getString("expertise"));
|
|
|
|
// doctor.setIntroduce(doctorJson.getString("introduce"));
|
|
|
|
// doctor.setMobile(doctorJson.getString("mobile"));
|
|
|
|
|
|
|
|
BaseDoctorDO temp = baseDoctorDao.save(doctor);
|
|
|
|
|
|
|
|
List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByOrgCodeAndDeptCodeAndDoctorCode(orgCode,doctorJson.getString("dept"),doctor.getId());
|
|
|
|
if(hospitalDOs!=null&&hospitalDOs.size()>0){
|
|
|
|
//机构信息部门信息
|
|
|
|
BaseDoctorHospitalDO hospitalDO = hospitalDOs.get(0);
|
|
|
|
hospitalDO.setDeptCode(doctorJson.getString("dept"));
|
|
|
|
hospitalDO.setDeptName(doctorJson.getString("deptName"));
|
|
|
|
hospitalDO.setDel("1");
|
|
|
|
baseDoctorHospitalDao.save(hospitalDO);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
//新增医生
|
|
|
|
BaseDoctorDO doctor = new BaseDoctorDO();
|
|
|
|
doctor.setName(doctorJson.getString("name"));
|
|
|
|
doctor.setIdcard(idcard);
|
|
|
|
|
|
|
|
doctor.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)));
|
|
|
|
doctor.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
|
|
|
|
|
|
|
|
doctor.setProvinceCode("350000");
|
|
|
|
doctor.setProvinceName("福建省");
|
|
|
|
doctor.setTownCode("350203");
|
|
|
|
doctor.setTownName("思明区");
|
|
|
|
doctor.setCityCode("350200");
|
|
|
|
doctor.setCityName("厦门市");
|
|
|
|
// doctor.setExpertise(doctorJson.getString("expertise"));
|
|
|
|
// doctor.setIntroduce(doctorJson.getString("introduce"));
|
|
|
|
// doctor.setMobile(doctorJson.getString("mobile"));
|
|
|
|
//认证信息设置
|
|
|
|
String salt = randomString(5);
|
|
|
|
String pw = idcard.substring(idcard.length() - 6);
|
|
|
|
doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
|
doctor.setSalt(salt);
|
|
|
|
doctor.setDel("1");
|
|
|
|
doctor.setEnabled(1);
|
|
|
|
doctor.setLocked(0);
|
|
|
|
doctor.setCreateTime(new Date());
|
|
|
|
|
|
|
|
doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
|
|
|
|
doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
|
|
|
|
|
|
|
|
BaseDoctorDO temp = baseDoctorDao.save(doctor);
|
|
|
|
|
|
|
|
//机构信息部门信息
|
|
|
|
BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
|
|
|
|
hospitalDO.setDoctorCode(temp.getId());
|
|
|
|
hospitalDO.setOrgCode(orgCode);
|
|
|
|
hospitalDO.setOrgName(orgName);
|
|
|
|
hospitalDO.setDeptCode(doctorJson.getString("dept"));
|
|
|
|
hospitalDO.setDeptName(doctorJson.getString("deptName"));
|
|
|
|
hospitalDO.setDel("1");
|
|
|
|
baseDoctorHospitalDao.save(hospitalDO);
|
|
|
|
|
|
|
|
//保存角色
|
|
|
|
BaseDoctorRoleDO role = new BaseDoctorRoleDO();
|
|
|
|
role.setDoctorCode(temp.getId());
|
|
|
|
role.setRoleCode("specialist");
|
|
|
|
baseDoctorRoleDao.save(role);
|
|
|
|
|
|
|
|
//保存mapping
|
|
|
|
DoctorMappingDO mappingDO = new DoctorMappingDO();
|
|
|
|
mappingDO.setIdcard(idcard);
|
|
|
|
mappingDO.setDoctor(temp.getId());
|
|
|
|
mappingDO.setDoctorName(temp.getName());
|
|
|
|
|
|
|
|
mappingDO.setOrgCode(orgCode);
|
|
|
|
mappingDO.setOrgName(orgName);
|
|
|
|
|
|
|
|
mappingDO.setMappingCode(doctorJson.getString("code"));
|
|
|
|
mappingDO.setMappingName(temp.getName());
|
|
|
|
mappingDO.setCreateTime(new Date());
|
|
|
|
|
|
|
|
doctorMappingDao.save(mappingDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "success";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String randomString(int length) {
|
|
public String randomString(int length) {
|
|
String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
StringBuffer buffer = new StringBuffer();
|
|
StringBuffer buffer = new StringBuffer();
|
|
@ -1032,7 +1161,7 @@ public class YkyyEntranceService {
|
|
hlwCf01DO.setZJFLAG(0);
|
|
hlwCf01DO.setZJFLAG(0);
|
|
hlwCf01DO.setLSCFBZ(0);
|
|
hlwCf01DO.setLSCFBZ(0);
|
|
hlwCf01DO.setZJFLAG(0);
|
|
hlwCf01DO.setZJFLAG(0);
|
|
hlwCf01DO.setFKZT(1);
|
|
|
|
|
|
hlwCf01DO.setFKZT(0);
|
|
hlwCf01DO.setSCDDH(wlyyPrescriptionVO.getOrderNo());
|
|
hlwCf01DO.setSCDDH(wlyyPrescriptionVO.getOrderNo());
|
|
String patient = wlyyPrescriptionVO.getPatientCode();
|
|
String patient = wlyyPrescriptionVO.getPatientCode();
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
@ -1047,36 +1176,62 @@ public class YkyyEntranceService {
|
|
hlwCf01DO.setSJLY(1);
|
|
hlwCf01DO.setSJLY(1);
|
|
hlwCf01DO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
|
|
hlwCf01DO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
|
|
/* hibenateUtils.save(hlwCf01DO);*/
|
|
/* hibenateUtils.save(hlwCf01DO);*/
|
|
|
|
if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getRealOrder())){
|
|
|
|
hlwCf01DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getOriginRealOrder())){
|
|
|
|
hlwCf01DO.setCFHM(wlyyPrescriptionVO.getOriginRealOrder());
|
|
|
|
}
|
|
|
|
|
|
String jsonString = JSONObject.toJSONString(hlwCf01DO);
|
|
String jsonString = JSONObject.toJSONString(hlwCf01DO);
|
|
Map<String,Object> params = new HashedMap();
|
|
Map<String,Object> params = new HashedMap();
|
|
params.put("json",jsonString);
|
|
params.put("json",jsonString);
|
|
params.put("table","HLW_CF01");
|
|
params.put("table","HLW_CF01");
|
|
logger.info("HLW_CF01:"+jsonString);
|
|
logger.info("HLW_CF01:"+jsonString);
|
|
HttpResponse response = HttpUtils.doGet(saveUrl,params);
|
|
|
|
String cfsb = "";
|
|
|
|
if (response.getStatus()==200){
|
|
|
|
logger.info("content"+response.getContent());
|
|
|
|
String content = response.getContent();
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
|
JSONObject object = jsonObject.getJSONObject("obj");
|
|
|
|
if (object!=null){
|
|
|
|
cfsb = object.getString("cfsb");
|
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
|
|
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
|
|
wlyyPrescriptionDO.setRealOrder(cfsb);
|
|
|
|
wlyyPrescriptionVO.setRealOrder(cfsb);
|
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
|
|
|
/**
|
|
|
|
{"message":null,"status":200,"obj":{"cfhm":1898356,"cfsb":5390518}}
|
|
|
|
|
|
|
|
*/
|
|
|
|
String cfsb = null;
|
|
|
|
String cfhm = null;
|
|
|
|
if (!StringUtils.isNoneBlank(wlyyPrescriptionVO.getRealOrder())){
|
|
|
|
HttpResponse response = HttpUtils.doGet(saveUrl,params);
|
|
|
|
if (response.getStatus()==200){
|
|
|
|
logger.info("content"+response.getContent());
|
|
|
|
String content = response.getContent();
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
|
JSONObject object = jsonObject.getJSONObject("obj");
|
|
|
|
if (object!=null){
|
|
|
|
cfsb = object.getString("cfsb");
|
|
|
|
cfhm = object.getString("cfhm");
|
|
|
|
logger.info("kaishi=========="+cfsb);
|
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
|
|
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
|
|
wlyyPrescriptionDO.setRealOrder(cfsb);
|
|
|
|
wlyyPrescriptionDO.setOriginRealOrder(cfhm);
|
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
logger.info("表HLW_CF01同步成功!");
|
|
|
|
|
|
logger.info("表HLW_CF01同步成功!");
|
|
|
|
|
|
|
|
}else {
|
|
|
|
logger.info("表HLW_CF01同步失败!"+response.getErrorMsg());
|
|
|
|
}
|
|
}else {
|
|
}else {
|
|
logger.info("表HLW_CF01同步失败!"+response.getErrorMsg());
|
|
|
|
|
|
cfsb = wlyyPrescriptionVO.getRealOrder();
|
|
|
|
HttpResponse response = HttpUtils.doGet(updateEntityUrl,params);
|
|
|
|
if (response.getStatus()==200){
|
|
|
|
logger.info("content"+response.getContent());
|
|
|
|
logger.info("表HLW_CF01更新成功!");
|
|
|
|
|
|
|
|
}else {
|
|
|
|
logger.info("表HLW_CF01更新失败!"+response.getErrorMsg());
|
|
|
|
}
|
|
}
|
|
}
|
|
logger.info("处方:"+wlyyPrescriptionVO);
|
|
|
|
if (!StringUtils.isNoneBlank(cfsb)){
|
|
|
|
|
|
|
|
|
|
logger.info("处方:"+cfsb);
|
|
|
|
if (StringUtils.isEmpty(cfsb)){
|
|
throw new Exception("添加失败");
|
|
throw new Exception("添加失败");
|
|
}
|
|
}
|
|
List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
|
|
List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
|
|
@ -1104,6 +1259,9 @@ public class YkyyEntranceService {
|
|
hlwCf02DO.setGYTJ(wlyyPrescriptionInfoVO.getYpyf());
|
|
hlwCf02DO.setGYTJ(wlyyPrescriptionInfoVO.getYpyf());
|
|
hlwCf02DO.setPSPB(0);
|
|
hlwCf02DO.setPSPB(0);
|
|
hlwCf02DO.setYYTS(1);
|
|
hlwCf02DO.setYYTS(1);
|
|
|
|
if (wlyyPrescriptionInfoVO.getHisCode()!=null){
|
|
|
|
hlwCf02DO.setSBXH(wlyyPrescriptionInfoVO.getHisCode());
|
|
|
|
}
|
|
/*hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));*/
|
|
/*hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));*/
|
|
hlwCf02DO.setYFGG(wlyyPrescriptionInfoVO.getSpecification());
|
|
hlwCf02DO.setYFGG(wlyyPrescriptionInfoVO.getSpecification());
|
|
/* hibenateUtils.save(hlwCf02DO);*/
|
|
/* hibenateUtils.save(hlwCf02DO);*/
|
|
@ -1113,12 +1271,37 @@ public class YkyyEntranceService {
|
|
params1.put("json",jsonString1);
|
|
params1.put("json",jsonString1);
|
|
params1.put("table","HLW_CF02");
|
|
params1.put("table","HLW_CF02");
|
|
logger.info("HLW_CF02:"+jsonString1);
|
|
logger.info("HLW_CF02:"+jsonString1);
|
|
HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
|
|
|
|
if (response1.getStatus()==200){
|
|
|
|
logger.info("表HLW_CF02同步成功!");
|
|
|
|
|
|
if (wlyyPrescriptionInfoVO.getHisCode()==null){
|
|
|
|
HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
|
|
|
|
Integer sbxh = null;
|
|
|
|
if (response1.getStatus()==200){
|
|
|
|
logger.info("content"+response1.getContent());
|
|
|
|
String content = response1.getContent();
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
|
JSONObject object = jsonObject.getJSONObject("obj");
|
|
|
|
if (object!=null){
|
|
|
|
sbxh = object.getInteger("sbxh");
|
|
|
|
logger.info("kaishi=========="+cfsb);
|
|
|
|
WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO = prescriptionInfoDao.findOne(wlyyPrescriptionInfoVO.getId());
|
|
|
|
if (wlyyPrescriptionInfoDO!=null){
|
|
|
|
wlyyPrescriptionInfoDO.setHisCode(sbxh);
|
|
|
|
prescriptionInfoDao.save(wlyyPrescriptionInfoDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("表HLW_CF02同步成功!");
|
|
|
|
}else {
|
|
|
|
logger.info("表HLW_CF02同步失败!"+response1.getErrorMsg());
|
|
|
|
}
|
|
}else {
|
|
}else {
|
|
logger.info("表HLW_CF02同步失败!"+response1.getErrorMsg());
|
|
|
|
|
|
HttpResponse response1 = HttpUtils.doGet(updateEntityUrl,params1);
|
|
|
|
if (response1.getStatus()==200){
|
|
|
|
logger.info("content"+response1.getContent());
|
|
|
|
logger.info("表HLW_CF02更新成功!");
|
|
|
|
}else {
|
|
|
|
logger.info("表HLW_CF02更新失败!"+response1.getErrorMsg());
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
e.getMessage();
|
|
e.getMessage();
|
|
@ -1136,6 +1319,18 @@ public class YkyyEntranceService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String updateHisStatus(String sql) throws Exception {
|
|
|
|
Map<String,Object> params1 = new HashedMap();
|
|
|
|
params1.put("sql",sql);
|
|
|
|
HttpResponse response1 = HttpUtils.doGet(updateUrl,params1);
|
|
|
|
logger.info(response1.getContent());
|
|
|
|
if (response1.getStatus()==200){
|
|
|
|
logger.info("更新his支付状态!");
|
|
|
|
}else {
|
|
|
|
logger.info("更新his支付状态!"+response1.getErrorMsg());
|
|
|
|
}
|
|
|
|
return response1.getContent();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|