|
@ -12,6 +12,7 @@ import com.yihu.jw.util.date.DateUtil;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
@ -43,6 +44,8 @@ public class SpecialistService{
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Value("${basedb.name}")
|
|
|
private String basedb;
|
|
|
@Autowired
|
|
|
private StringRedisTemplate redisTemplate;
|
|
|
|
|
|
public MixEnvelop<Boolean, Boolean> createSpecialistsPatientRelation(SpecialistPatientRelationDO specialistPatientRelationDO){
|
|
|
specialistPatientRelationDao.save(specialistPatientRelationDO);
|
|
@ -231,7 +234,7 @@ public class SpecialistService{
|
|
|
" t.label_type = '8' " +
|
|
|
" AND t.`status` = '1' " +
|
|
|
" ) h ON h.patient = lb.patient " +
|
|
|
" WHERE s.doctor ='"+doctor+"' AND s.status >=0 AND s.sign_status >0"+
|
|
|
" WHERE s.doctor ='"+doctor+ " AND h.label='"+labelCode+"' AND s.status >=0 AND s.sign_status >0"+
|
|
|
" LIMIT "+(page-1)*size+","+size;
|
|
|
|
|
|
if("7".equals(labelType)){
|
|
@ -249,7 +252,7 @@ public class SpecialistService{
|
|
|
"FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
|
|
|
"JOIN "+basedb+".wlyy_patient_disease_server b ON a.id=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+
|
|
|
"JOIN "+basedb+".wlyy_patient c ON a.patient=c.CODE " +
|
|
|
"LEFT JOIN "+basedb+".wlyy_sign_patient_label_info d ON a.patient=d.patient AND d.label_type=8 AND d.`status`=1" +
|
|
|
"LEFT JOIN "+basedb+".wlyy_sign_patient_label_info d ON a.patient=d.patient AND d.label_type=" +labelType+" AND d.`status`=1" +
|
|
|
" WHERE a.sign_status> 0 AND a.`status`>=0 AND a.doctor='"+doctor+"'"+
|
|
|
" LIMIT "+(page-1)*size+","+size;
|
|
|
}
|
|
@ -504,6 +507,9 @@ public class SpecialistService{
|
|
|
relation.setHealthAssistantName(health_assistant_name);
|
|
|
relation.setSignDate(new Date());
|
|
|
specialistPatientRelationDao.save(relation);
|
|
|
//签约成功之后,将签约关系保存在redis中
|
|
|
String key = "specialist_patient_relation:" + relation.getPatient() +"_"+ ":text";
|
|
|
redisTemplate.opsForValue().set(key,"true");
|
|
|
}
|
|
|
return MixEnvelop.getSuccess(SpecialistMapping.api_success,relation);
|
|
|
}
|
|
@ -838,7 +844,7 @@ public class SpecialistService{
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
//1、获取居民基础信息
|
|
|
String preSql = "SELECT p.name as name, p.photo as photo,p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
|
|
|
" CASE WHEN wsf.doctor_name is null THEN '无' ELSE wsf.doctor_name END as doctorName,CASE WHEN wsf.hospital_name is NULL THEN '无' ELSE wsf.hospital_name END as hospitalName,CASE WHEN wsf.mobile is NULL THEN '无' ELSE wsf.mobile END as doctorMobole ";
|
|
|
" CASE WHEN wd.doctor_name is null THEN '无' ELSE wd.doctor_name END as doctorName,CASE WHEN wd.hospital_name is NULL THEN '无' ELSE wd.hospital_name END as hospitalName,CASE WHEN wd.mobile is NULL THEN '无' ELSE wd.mobile END as doctorMobole ";
|
|
|
String patientSql = " from " + basedb + ".wlyy_patient p LEFT JOIN " + basedb + ".wlyy_sign_family wsf " +
|
|
|
" ON p.code=wsf.patient AND wsf.type='2' AND wsf.status='1' " +
|
|
|
" LEFT JOIN " + basedb + ".wlyy_doctor wd ON wsf.doctor =wd.code WHERE p.code='" + patientCode + "'";
|
|
@ -911,7 +917,24 @@ public class SpecialistService{
|
|
|
specialistPatientRelationDO.setSignYear(String.valueOf(DateUtil.getNowYear()));
|
|
|
specialistPatientRelationDO.setSignDate(new Date());
|
|
|
specialistPatientRelationDO = specialistPatientRelationDao.save(specialistPatientRelationDO);
|
|
|
//签约成功之后,将签约关系保存在redis中
|
|
|
String key = "specialist_patient_relation:" + specialistPatientRelationDO.getPatient() +"_"+ ":text";
|
|
|
redisTemplate.opsForValue().set(key,"true");
|
|
|
|
|
|
return ObjEnvelop.getSuccess("success", specialistPatientRelationDO);
|
|
|
}
|
|
|
|
|
|
public Integer updateRedisFindPatientTeamList(){
|
|
|
List<SpecialistPatientRelationDO> specialistPatientRelationDOList=specialistPatientRelationDao.findAllBySignStatus("1");
|
|
|
List<SpecialistPatientRelationDO> unique = specialistPatientRelationDOList.stream().collect(
|
|
|
Collectors.collectingAndThen(
|
|
|
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SpecialistPatientRelationDO::getPatient))), ArrayList::new)
|
|
|
);
|
|
|
unique.stream().forEach(item->{
|
|
|
//签约成功之后,将签约关系保存在redis中
|
|
|
String key = "specialist_patient_relation:" + item.getPatient() +"_"+ ":text";
|
|
|
redisTemplate.opsForValue().set(key,"true");
|
|
|
});
|
|
|
return null==unique?0:unique.size();
|
|
|
}
|
|
|
}
|