|
@ -1,5 +1,7 @@
|
|
package com.yihu.jw.hospital.module.common.service;
|
|
package com.yihu.jw.hospital.module.common.service;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
@ -12,8 +14,13 @@ import com.yihu.jw.label.WlyyPatientLabelDao;
|
|
import com.yihu.jw.label.WlyyPatientLabelLogDao;
|
|
import com.yihu.jw.label.WlyyPatientLabelLogDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
|
import com.yihu.jw.sign.dao.WlyySignDao;
|
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.entity.ServiceException;
|
|
import com.yihu.jw.util.entity.ServiceException;
|
|
|
|
import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
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.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
@ -28,6 +35,8 @@ import java.util.*;
|
|
@Service
|
|
@Service
|
|
public class LabelService {
|
|
public class LabelService {
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(LabelService.class);
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
|
|
private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
|
|
@Autowired
|
|
@Autowired
|
|
@ -40,10 +49,56 @@ public class LabelService {
|
|
private BaseDoctorDao doctorDao;
|
|
private BaseDoctorDao doctorDao;
|
|
@Autowired
|
|
@Autowired
|
|
private JdbcTemplate jdbcTemplate;
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
@Autowired
|
|
|
|
private WlyyHttpService wlyyHttpService;
|
|
|
|
@Autowired
|
|
|
|
private WlyySignDao wlyySignDao;
|
|
|
|
|
|
//同步签约信息
|
|
|
|
public void sysSign(Long id){
|
|
|
|
|
|
|
|
|
|
//同步签约信息
|
|
|
|
public void synSign(String idcards){
|
|
|
|
try {
|
|
|
|
String configId = "commonGet";
|
|
|
|
String param = "?type=2&idcards="+idcards;
|
|
|
|
JSONObject re = wlyyHttpService.sendWlyyMesGet(configId, "findSignAll" + param);
|
|
|
|
if(re!=null&&re.getInteger("status")==200){
|
|
|
|
String idcardTmp = idcards.replaceAll(",","','");
|
|
|
|
String sql = "select * from wlyy_sign where idcard in ('"+idcardTmp+"')";
|
|
|
|
List<WlyySign> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(WlyySign.class));
|
|
|
|
JSONArray jsonArray = re.getJSONArray("data");
|
|
|
|
if(jsonArray.size()>0){
|
|
|
|
for (WlyySign sign:list){
|
|
|
|
sign.setStatus("-4");
|
|
|
|
sign.setSysTime(DateUtil.getStringDate());
|
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
|
JSONObject json = jsonArray.getJSONObject(i);
|
|
|
|
String idcard = json.getString("idcard");
|
|
|
|
if(sign.getIdcard().equals(idcard)){
|
|
|
|
sign.setStatus(json.getString("status"));
|
|
|
|
sign.setYearNum(json.getString("year_num"));
|
|
|
|
sign.setHospitalName(json.getString("hospital_name"));
|
|
|
|
sign.setDoctorName(json.getString("doctor_name"));
|
|
|
|
sign.setHealthDoctorName(json.getString("doctor_health_name"));
|
|
|
|
sign.setBegin(json.getString("begin"));
|
|
|
|
sign.setEnd(json.getString("end"));
|
|
|
|
sign.setSignYear(json.getString("sign_year"));
|
|
|
|
sign.setSignSource(json.getString("sign_source"));
|
|
|
|
jsonArray.remove(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
for (WlyySign sign:list){
|
|
|
|
sign.setStatus("-4");
|
|
|
|
sign.setSysTime(DateUtil.getStringDate());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wlyySignDao.saveAll(list);
|
|
|
|
}
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -59,7 +114,8 @@ public class LabelService {
|
|
String filter = " from wlyy_sign a inner join base_patient p on a.patient=p.id " +
|
|
String filter = " from wlyy_sign a inner join base_patient p on a.patient=p.id " +
|
|
" left join wlyy_patient_label l on l.patient = p.id "+
|
|
" left join wlyy_patient_label l on l.patient = p.id "+
|
|
" left join wlyy_hospital_sys_dict d1 on d1.dict_name='ijk_sign_source' and d1.dict_code = a.sign_source "+
|
|
" left join wlyy_hospital_sys_dict d1 on d1.dict_name='ijk_sign_source' and d1.dict_code = a.sign_source "+
|
|
" left join wlyy_hospital_sys_dict d2 on d2.dict_name='ijk_sign_status' and d2.dict_code = a.status ";
|
|
|
|
|
|
" left join wlyy_hospital_sys_dict d2 on d2.dict_name='ijk_sign_status' and d2.dict_code = a.status " +
|
|
|
|
" where a.is_ncd=1 ";
|
|
String orderBy = " limit "+(page-1)*size+","+size;
|
|
String orderBy = " limit "+(page-1)*size+","+size;
|
|
if(StringUtils.isNotBlank(name)){
|
|
if(StringUtils.isNotBlank(name)){
|
|
filter += " and a.name like '%"+name+"%' ";
|
|
filter += " and a.name like '%"+name+"%' ";
|
|
@ -92,7 +148,7 @@ public class LabelService {
|
|
if(StringUtils.isNotBlank(zdyGroup)){
|
|
if(StringUtils.isNotBlank(zdyGroup)){
|
|
filter += " and l.label_type='4' and l.label_name = '"+zdyGroup+"' ";
|
|
filter += " and l.label_type='4' and l.label_name = '"+zdyGroup+"' ";
|
|
}
|
|
}
|
|
List<WlyySign> list = jdbcTemplate.query(sql+filter+"GROUP BY a.id"+orderBy,new BeanPropertyRowMapper<>(WlyySign.class));
|
|
|
|
|
|
List<WlyySign> list = jdbcTemplate.query(sql+filter+" GROUP BY a.id "+orderBy,new BeanPropertyRowMapper<>(WlyySign.class));
|
|
long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
|
|
long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
|
|
return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
|
|
return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
|
|
}
|
|
}
|