|
@ -5,19 +5,16 @@
|
|
|
*******************************************************************************/
|
|
|
package com.yihu.wlyy.service.common.account;
|
|
|
|
|
|
import com.yihu.wlyy.entity.doctor.DoctorSwitch;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatient;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.ServerLabelTree;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamilyRenew;
|
|
|
import com.yihu.wlyy.entity.patient.*;
|
|
|
import com.yihu.wlyy.entity.security.Token;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorPatientDao;
|
|
|
import com.yihu.wlyy.repository.doctor.*;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.repository.patient.TrackPatientDao;
|
|
|
import com.yihu.wlyy.repository.security.TokenDao;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.EncodesUtil;
|
|
@ -65,6 +62,14 @@ public class PatientService extends TokenService {
|
|
|
@Autowired
|
|
|
private DoctorAdminTeamDao doctorAdminTeamDao;
|
|
|
@Autowired
|
|
|
private DoctorSwitchDao doctorSwitchDao;
|
|
|
@Autowired
|
|
|
private TrackPatientDao trackPatientDao;
|
|
|
@Autowired
|
|
|
private PatientAimBloodSuggerDao patientAimBloodSuggerDao;
|
|
|
@Autowired
|
|
|
private PatientAimBloodPressureDao patientAimBloodPressureDao;
|
|
|
@Autowired
|
|
|
TokenDao tokenDao;
|
|
|
@Autowired
|
|
|
JdbcTemplate jdbcTemplate;
|
|
@ -1019,4 +1024,118 @@ public class PatientService extends TokenService {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* //1.4.2加入重点关注逻辑
|
|
|
* 红色定标居民加入重点关注
|
|
|
* @param idcard_red_diseasecontion_map
|
|
|
*/
|
|
|
public void setTrackPatientByDoctor(HashMap<String, Integer> idcard_red_diseasecontion_map) {
|
|
|
|
|
|
Set<String> patient_idcards = idcard_red_diseasecontion_map.keySet();
|
|
|
|
|
|
for (String idcard: patient_idcards) {
|
|
|
Patient p = patientDao.findByIdcard(idcard);
|
|
|
if(p==null){
|
|
|
logger.info("居民idcard:"+idcard+";未找到该居民");
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
SignFamily signFamily = signFamilyDao.findByjiatingPatientYes(p.getCode());
|
|
|
if(signFamily==null){
|
|
|
logger.info("居民idcard:"+idcard+";该居民未签约家庭医生");
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
//医生是否自动追踪居民
|
|
|
DoctorSwitch sw = doctorSwitchDao.findByDoctor(signFamily.getDoctor());
|
|
|
DoctorSwitch swh = doctorSwitchDao.findByDoctor(signFamily.getDoctorHealth());
|
|
|
|
|
|
if(sw!=null){
|
|
|
if("1".equals(sw.getAlertPatientSwitch())){
|
|
|
//查询是否与医生建立重点跟踪关系,诺无关系则建立
|
|
|
TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(signFamily.getDoctor(),p.getCode());
|
|
|
|
|
|
if(trackPatient == null){
|
|
|
TrackPatient t = new TrackPatient();
|
|
|
t.setCreateTime(new Date());
|
|
|
t.setDoctorCode(signFamily.getDoctor());
|
|
|
t.setDoctorName(signFamily.getDoctorName());
|
|
|
t.setIdcard(signFamily.getIdcard());
|
|
|
t.setSsc(signFamily.getSsc());
|
|
|
t.setTeamCode(signFamily.getAdminTeamId().intValue());
|
|
|
t.setPatientCode(p.getCode());
|
|
|
t.setPatientName(p.getName());
|
|
|
t.setDel("1");
|
|
|
trackPatientDao.save(t);
|
|
|
//设置默认控制目标
|
|
|
setDefaultAim(p.getCode());
|
|
|
}else{
|
|
|
trackPatient.setDel("1");
|
|
|
trackPatientDao.save(trackPatient);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(swh!=null){
|
|
|
if("1".equals(sw.getAlertPatientSwitch())){
|
|
|
//查询是否与医生建立重点跟踪关系,诺无关系则建立
|
|
|
TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(signFamily.getDoctorHealth(),p.getCode());
|
|
|
if(trackPatient == null){
|
|
|
TrackPatient t = new TrackPatient();
|
|
|
t.setCreateTime(new Date());
|
|
|
t.setDoctorCode(signFamily.getDoctorHealth());
|
|
|
t.setDoctorName(signFamily.getDoctorHealthName());
|
|
|
t.setIdcard(signFamily.getIdcard());
|
|
|
t.setSsc(signFamily.getSsc());
|
|
|
t.setTeamCode(signFamily.getAdminTeamId().intValue());
|
|
|
t.setPatientCode(p.getCode());
|
|
|
t.setPatientName(p.getName());
|
|
|
t.setDel("1");
|
|
|
trackPatientDao.save(t);
|
|
|
//设置默认控制目标
|
|
|
setDefaultAim(p.getCode());
|
|
|
}else{
|
|
|
trackPatient.setDel("1");
|
|
|
trackPatientDao.save(trackPatient);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置默认监控方案
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public String setDefaultAim(String patient){
|
|
|
PatientAimBloodSugger patientAimBloodSugger = patientAimBloodSuggerDao.findByPatientcode(patient);
|
|
|
PatientAimBloodPressure patientAimBloodPressure = patientAimBloodPressureDao.findByPatientcode(patient);
|
|
|
if(patientAimBloodSugger==null){
|
|
|
PatientAimBloodSugger pa = new PatientAimBloodSugger();
|
|
|
pa.setPatientcode(patient);
|
|
|
pa.setCode(getCode());
|
|
|
pa.setCreateTime(new Date());
|
|
|
pa.setUnit("mmol/L");
|
|
|
pa.setFbg("7.0");
|
|
|
pa.setHpg("11.1");
|
|
|
pa.setFbgMin("4.0");
|
|
|
pa.setHpgMin("4.0");
|
|
|
patientAimBloodSuggerDao.save(pa);
|
|
|
}
|
|
|
if(patientAimBloodPressure==null){
|
|
|
PatientAimBloodPressure pa = new PatientAimBloodPressure();
|
|
|
pa.setPatientcode(patient);
|
|
|
pa.setCode(getCode());
|
|
|
pa.setCreateTime(new Date());
|
|
|
pa.setSbp("140");
|
|
|
pa.setSbpMin("90");
|
|
|
pa.setDbp("90");
|
|
|
pa.setDbpMin("60");
|
|
|
pa.setUnit("mmHg");
|
|
|
patientAimBloodPressureDao.save(pa);
|
|
|
}
|
|
|
return "1";
|
|
|
}
|
|
|
}
|