|
@ -1,11 +1,9 @@
|
|
package com.yihu.wlyy.statistics.task;
|
|
package com.yihu.wlyy.statistics.task;
|
|
|
|
|
|
import com.yihu.wlyy.statistics.Application;
|
|
import com.yihu.wlyy.statistics.Application;
|
|
import com.yihu.wlyy.statistics.dao.DoctorPatientGroupInfoDao;
|
|
|
|
import com.yihu.wlyy.statistics.dao.DoctorTeamDao;
|
|
|
|
import com.yihu.wlyy.statistics.dao.DoctorTeamMemberDao;
|
|
|
|
import com.yihu.wlyy.statistics.dao.SignFamilyDao;
|
|
|
|
|
|
import com.yihu.wlyy.statistics.dao.*;
|
|
import com.yihu.wlyy.statistics.model.doctor.DoctorPatientGroupInfo;
|
|
import com.yihu.wlyy.statistics.model.doctor.DoctorPatientGroupInfo;
|
|
|
|
import com.yihu.wlyy.statistics.model.label.SignPatientLabelInfo;
|
|
import com.yihu.wlyy.statistics.model.signfamily.SignFamily;
|
|
import com.yihu.wlyy.statistics.model.signfamily.SignFamily;
|
|
import com.yihu.wlyy.statistics.model.team.DoctorTeam;
|
|
import com.yihu.wlyy.statistics.model.team.DoctorTeam;
|
|
import com.yihu.wlyy.statistics.model.team.DoctorTeamMember;
|
|
import com.yihu.wlyy.statistics.model.team.DoctorTeamMember;
|
|
@ -34,19 +32,19 @@ public class SignTeamAndGroupRunnable implements Runnable {
|
|
long end = 0;
|
|
long end = 0;
|
|
|
|
|
|
SignFamilyDao signFamilyDao;
|
|
SignFamilyDao signFamilyDao;
|
|
DoctorPatientGroupInfoDao groupInfoDao;
|
|
|
|
DoctorTeamDao teamDao;
|
|
DoctorTeamDao teamDao;
|
|
DoctorTeamMemberDao teamMemberDao;
|
|
DoctorTeamMemberDao teamMemberDao;
|
|
JpaTransactionManager transactionManager;
|
|
JpaTransactionManager transactionManager;
|
|
|
|
SignPatientLabelInfoDao labelInfoDao;
|
|
|
|
|
|
public SignTeamAndGroupRunnable(Long start, Long end){
|
|
public SignTeamAndGroupRunnable(Long start, Long end){
|
|
this.start = start;
|
|
this.start = start;
|
|
this.end = end;
|
|
this.end = end;
|
|
this.signFamilyDao = Application.ctx.getBean(SignFamilyDao.class);
|
|
this.signFamilyDao = Application.ctx.getBean(SignFamilyDao.class);
|
|
this.groupInfoDao = Application.ctx.getBean(DoctorPatientGroupInfoDao.class);
|
|
|
|
this.teamDao = Application.ctx.getBean(DoctorTeamDao.class);
|
|
this.teamDao = Application.ctx.getBean(DoctorTeamDao.class);
|
|
this.teamMemberDao = Application.ctx.getBean(DoctorTeamMemberDao.class);
|
|
this.teamMemberDao = Application.ctx.getBean(DoctorTeamMemberDao.class);
|
|
this.transactionManager = Application.ctx.getBean(JpaTransactionManager.class);
|
|
this.transactionManager = Application.ctx.getBean(JpaTransactionManager.class);
|
|
|
|
this.labelInfoDao = Application.ctx.getBean(SignPatientLabelInfoDao.class);
|
|
}
|
|
}
|
|
|
|
|
|
public String getCode() {
|
|
public String getCode() {
|
|
@ -85,6 +83,7 @@ public class SignTeamAndGroupRunnable implements Runnable {
|
|
List<DoctorTeam> teams = new ArrayList<>();
|
|
List<DoctorTeam> teams = new ArrayList<>();
|
|
List<DoctorTeamMember> teamMembers = new ArrayList<>();
|
|
List<DoctorTeamMember> teamMembers = new ArrayList<>();
|
|
List<DoctorPatientGroupInfo> groupList = new ArrayList<>();
|
|
List<DoctorPatientGroupInfo> groupList = new ArrayList<>();
|
|
|
|
Map<String,SignPatientLabelInfo> labels = new HashMap<>();
|
|
List<SignFamily> signList = signs.getContent();
|
|
List<SignFamily> signList = signs.getContent();
|
|
|
|
|
|
for (SignFamily sign : signList) {
|
|
for (SignFamily sign : signList) {
|
|
@ -158,77 +157,43 @@ public class SignTeamAndGroupRunnable implements Runnable {
|
|
|
|
|
|
int age = IdCardUtil.getAgeForIdcard(sign.getIdcard());
|
|
int age = IdCardUtil.getAgeForIdcard(sign.getIdcard());
|
|
String groupCode = "1";
|
|
String groupCode = "1";
|
|
|
|
String groupName = "普通人群";
|
|
|
|
|
|
if (age >= 65) {
|
|
if (age >= 65) {
|
|
groupCode = "3";
|
|
groupCode = "3";
|
|
|
|
groupName = "65岁以上人群";
|
|
}
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotEmpty(sign.getDoctorHealth())) {
|
|
|
|
//把病人添加到健康管理师的健康分组里
|
|
|
|
DoctorPatientGroupInfo doctorPatientGroupInfo = new DoctorPatientGroupInfo();
|
|
|
|
|
|
|
|
doctorPatientGroupInfo.setCzrq(new Date());
|
|
|
|
doctorPatientGroupInfo.setDoctor(sign.getDoctorHealth());
|
|
|
|
doctorPatientGroupInfo.setStatus(1);
|
|
|
|
doctorPatientGroupInfo.setPatient(sign.getPatient());
|
|
|
|
doctorPatientGroupInfo.setPname(sign.getName());
|
|
|
|
doctorPatientGroupInfo.setPartAmount(0);
|
|
|
|
doctorPatientGroupInfo.setGroup(groupCode);//默认健康分组
|
|
|
|
doctorPatientGroupInfo.setQyrq(sign.getApplyDate());
|
|
|
|
doctorPatientGroupInfo.setSignType("2");//家庭签约
|
|
|
|
|
|
|
|
groupList.add(doctorPatientGroupInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(sign.getDoctor())) {
|
|
|
|
//把病人添加到全科医生的健康分组里
|
|
|
|
DoctorPatientGroupInfo doctorPatientGroupInfo = new DoctorPatientGroupInfo();
|
|
|
|
|
|
|
|
doctorPatientGroupInfo.setCzrq(new Date());
|
|
|
|
doctorPatientGroupInfo.setDoctor(sign.getDoctor());
|
|
|
|
doctorPatientGroupInfo.setStatus(1);
|
|
|
|
doctorPatientGroupInfo.setPatient(sign.getPatient());
|
|
|
|
doctorPatientGroupInfo.setPname(sign.getName());
|
|
|
|
doctorPatientGroupInfo.setPartAmount(0);
|
|
|
|
doctorPatientGroupInfo.setGroup(groupCode);//默认健康分组
|
|
|
|
doctorPatientGroupInfo.setQyrq(sign.getApplyDate());
|
|
|
|
doctorPatientGroupInfo.setSignType("2");//家庭签约
|
|
|
|
|
|
|
|
groupList.add(doctorPatientGroupInfo);
|
|
|
|
}
|
|
|
|
|
|
SignPatientLabelInfo label = new SignPatientLabelInfo();
|
|
|
|
|
|
List<DoctorPatientGroupInfo> groups = groupInfoDao.findPatientGroups(sign.getPatient());
|
|
|
|
|
|
SignPatientLabelInfo exLabelInfo = labelInfoDao.findByPatientAndLabelAndLabelTypeAndStatus(
|
|
|
|
sign.getPatient(), groupCode, "1", 1);
|
|
|
|
|
|
if (groups != null && groups.size() > 0) {
|
|
|
|
for (DoctorPatientGroupInfo group : groups) {
|
|
|
|
if (StringUtils.isNotEmpty(group.getSignType()) && group.getSignType().equals("2")) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
if (exLabelInfo != null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
DoctorPatientGroupInfo patientGroup = new DoctorPatientGroupInfo();
|
|
|
|
|
|
label.setPatient(sign.getPatient());
|
|
|
|
label.setPatient(sign.getName());
|
|
|
|
label.setLabel(groupCode);
|
|
|
|
label.setLabelName(groupName);
|
|
|
|
label.setLabelType("1");
|
|
|
|
label.setStatus(1);
|
|
|
|
label.setCzrq(new Date());
|
|
|
|
|
|
patientGroup.setCzrq(new Date());
|
|
|
|
patientGroup.setDoctor(group.getDoctor());
|
|
|
|
patientGroup.setStatus(1);
|
|
|
|
patientGroup.setPatient(sign.getPatient());
|
|
|
|
patientGroup.setPname(sign.getName());
|
|
|
|
patientGroup.setPartAmount(0);
|
|
|
|
patientGroup.setGroup(group.getGroup());
|
|
|
|
patientGroup.setQyrq(sign.getApplyDate());
|
|
|
|
patientGroup.setSignType("2");//家庭签约
|
|
|
|
|
|
labels.put(sign.getPatient(),label);
|
|
|
|
|
|
groupList.add(patientGroup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sign.setTeamCode(doctorTeamCode);
|
|
sign.setTeamCode(doctorTeamCode);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
teamDao.save(teams);
|
|
teamDao.save(teams);
|
|
teamMemberDao.save(teamMembers);
|
|
teamMemberDao.save(teamMembers);
|
|
groupInfoDao.save(groupList);
|
|
|
|
|
|
labelInfoDao.save(labels.values());
|
|
signFamilyDao.save(signList);
|
|
signFamilyDao.save(signList);
|
|
|
|
|
|
System.out.println("sign-patient-group-team:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
System.out.println("sign-patient-group-team:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
}
|
|
}
|
|
}
|
|
}
|