|
@ -34,10 +34,12 @@ import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
|
|
|
import com.yihu.jw.rm.base.BaseRequestMapping;
|
|
|
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
|
|
|
import com.yihu.jw.rm.iot.IotRequestMapping;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
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.hibernate.HibenateUtils;
|
|
|
import com.yihu.utils.network.HttpResponse;
|
|
@ -49,6 +51,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.transaction.Transactional;
|
|
@ -70,6 +73,12 @@ public class YkyyEntranceService {
|
|
|
|
|
|
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 jdbcUrl="http://192.168.20.55:10023/ykyy/jdbcSQLQuery";
|
|
|
|
|
|
private final static String orgCode ="350211A5004";
|
|
|
|
|
|
private final static String orgName ="厦门大学附属厦门眼科中心";
|
|
@ -101,9 +110,6 @@ public class YkyyEntranceService {
|
|
|
@Autowired
|
|
|
private PrescriptionDao prescriptionDao;
|
|
|
|
|
|
@Autowired
|
|
|
private PrescriptionInfoDao prescriptionInfoDao;
|
|
|
|
|
|
@Autowired
|
|
|
private BaseEvaluateScoreDao baseEvaluateScoreDao;
|
|
|
|
|
@ -114,23 +120,32 @@ public class YkyyEntranceService {
|
|
|
private HibenateUtils hibenateUtils;
|
|
|
|
|
|
@Autowired
|
|
|
private ObjectMapper objectMapper;
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
|
|
@Autowired
|
|
|
private YkDictIcd10Dao ykDictIcd10Dao;
|
|
|
|
|
|
@Autowired
|
|
|
private PrescriptionInfoDao prescriptionInfoDao;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
|
|
|
public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
|
|
|
return hibenateUtils.createSQLQuery(sql,params,page,size);
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> jdbcSQLQuery(String sql){
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
|
}
|
|
|
|
|
|
|
|
|
public void save(Object 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){
|
|
@ -215,9 +230,6 @@ public class YkyyEntranceService {
|
|
|
if (jsonArray.size() == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
// String tmp = "{\"JZXH\":2395594,\"SFZH\":\"350203201411221635\",\"ZDMC\":\"结膜炎\",\"YSDM\":\"1785\",\"BRXZ\":\"医保\",\"JZKH\":\"DA6736810\",\"KDYS\":\"况坤\",\"KSDM\":112,\"BRID\":1175116,\"BRXM\":\"王竣皓\",\"SJHM\":null,\"KSSJ\":\"2020/04/28 20:56:34\",\"KSMC\":\"眼整形专科\"}";
|
|
|
// JSONArray jsonArray = new JSONArray();
|
|
|
// jsonArray.add(JSONObject.parse(tmp));
|
|
|
|
|
|
List<WlyyOutpatientVO> wlyyOutpatientVOS = new ArrayList<>();
|
|
|
WlyyOutpatientVO wlyyOutpatientVO;
|
|
@ -270,10 +282,13 @@ public class YkyyEntranceService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getUnsettledPrescription() throws Exception{
|
|
|
String sql = "SELECT h.BRID,h.CFSB from HLW_CF01 h WHERE h.SPZT = 1 and h.FKZT = 0";
|
|
|
String sql = "SELECT h.BRID,h.CFSB,h.SJLY from v_ms_dd01 h WHERE h.SPZT = 1 and h.FKZT = 0 order by h.KFRQ desc ";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
HttpResponse response = HttpUtils.doGet(url,params);
|
|
|
params.put("page","1");
|
|
|
params.put("size","60");
|
|
|
HttpResponse response = HttpUtils.doGet(jdbcUrl,params);
|
|
|
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
@ -437,6 +452,37 @@ public class YkyyEntranceService {
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
|
|
|
public String updateYkTDoctor()throws Exception{
|
|
|
List<BaseDoctorDO> baseDoctorDOS = baseDoctorDao.findByDel();
|
|
|
for (BaseDoctorDO baseDoctorDO:baseDoctorDOS){
|
|
|
String response="";
|
|
|
String url = "http://www.yanketong.com:133/api/doc_jkzl/doctor_list_had_bind_account?hospital_code=sb&page=1&id_card="+baseDoctorDO.getIdcard();
|
|
|
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");
|
|
|
if (array!=null&&array.size()!=0){
|
|
|
JSONObject jsonObject = array.getJSONObject(0);
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(baseDoctorDO.getId());
|
|
|
String mappingCode = jsonObject.getString("DOCTORCODE");
|
|
|
doctorMappingDO.setMappingCode(mappingCode);
|
|
|
doctorMappingDao.save(doctorMappingDO);
|
|
|
}else {
|
|
|
baseDoctorDO.setDel("0");
|
|
|
baseDoctorDao.save(baseDoctorDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String randomString(int length) {
|
|
|
String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
|
StringBuffer buffer = new StringBuffer();
|
|
@ -1035,7 +1081,7 @@ public class YkyyEntranceService {
|
|
|
hlwCf01DO.setZJFLAG(0);
|
|
|
hlwCf01DO.setLSCFBZ(0);
|
|
|
hlwCf01DO.setZJFLAG(0);
|
|
|
hlwCf01DO.setFKZT(1);
|
|
|
hlwCf01DO.setFKZT(0);
|
|
|
hlwCf01DO.setSCDDH(wlyyPrescriptionVO.getOrderNo());
|
|
|
String patient = wlyyPrescriptionVO.getPatientCode();
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
@ -1048,38 +1094,66 @@ public class YkyyEntranceService {
|
|
|
hlwCf01DO.setJZKH(wlyyPrescriptionVO.getSsc());
|
|
|
hlwCf01DO.setGUID(getCode());
|
|
|
hlwCf01DO.setSJLY(1);
|
|
|
hlwCf01DO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
|
|
|
if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
|
|
|
hlwCf01DO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
|
|
|
}
|
|
|
/* 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);
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("json",jsonString);
|
|
|
params.put("table","HLW_CF01");
|
|
|
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 {
|
|
|
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("添加失败");
|
|
|
}
|
|
|
List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
|
|
@ -1107,6 +1181,9 @@ public class YkyyEntranceService {
|
|
|
hlwCf02DO.setGYTJ(wlyyPrescriptionInfoVO.getYpyf());
|
|
|
hlwCf02DO.setPSPB(0);
|
|
|
hlwCf02DO.setYYTS(1);
|
|
|
if (wlyyPrescriptionInfoVO.getHisCode()!=null){
|
|
|
hlwCf02DO.setSBXH(wlyyPrescriptionInfoVO.getHisCode());
|
|
|
}
|
|
|
/*hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));*/
|
|
|
hlwCf02DO.setYFGG(wlyyPrescriptionInfoVO.getSpecification());
|
|
|
/* hibenateUtils.save(hlwCf02DO);*/
|
|
@ -1116,12 +1193,37 @@ public class YkyyEntranceService {
|
|
|
params1.put("json",jsonString1);
|
|
|
params1.put("table","HLW_CF02");
|
|
|
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 {
|
|
|
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){
|
|
|
e.printStackTrace();
|
|
|
e.getMessage();
|
|
@ -1139,6 +1241,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();
|
|
|
}
|
|
|
|
|
|
|
|
|
|