|
@ -39,7 +39,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
@ -238,9 +237,11 @@ public class DoctorSchemeService {
|
|
|
t.setPatientCode(patient);
|
|
|
t.setPatientName(patientDO.getName());
|
|
|
t.setDel("0");
|
|
|
t.setUpdateTime(new Date());
|
|
|
trackPatientDao.save(t);
|
|
|
}else {
|
|
|
trackPatient.setDel("0");
|
|
|
trackPatient.setUpdateTime(new Date());
|
|
|
trackPatientDao.save(trackPatient);
|
|
|
}
|
|
|
}
|
|
@ -265,6 +266,7 @@ public class DoctorSchemeService {
|
|
|
BasePatientDO patientDO = patientDao.findByIdAndDel(patient,"1");
|
|
|
TrackPatient t = new TrackPatient();
|
|
|
t.setCreateTime(new Date());
|
|
|
t.setUpdateTime(new Date());
|
|
|
t.setDoctorCode(doctorDO.getId());
|
|
|
t.setDoctorName(doctorDO.getName());
|
|
|
t.setIdcard(patientDO.getIdcard());
|
|
@ -275,6 +277,7 @@ public class DoctorSchemeService {
|
|
|
trackPatientDao.save(t);
|
|
|
}else {
|
|
|
trackPatient.setDel("1");
|
|
|
trackPatient.setUpdateTime(new Date());
|
|
|
trackPatientDao.save(trackPatient);
|
|
|
}
|
|
|
}
|
|
@ -932,7 +935,7 @@ public class DoctorSchemeService {
|
|
|
if(StringUtils.isNotBlank(patient)){
|
|
|
filter += " AND i.user = '"+patient+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(patient)){
|
|
|
if(StringUtils.isNotBlank(doctor)){
|
|
|
filter += " AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' ) ";
|
|
|
}
|
|
|
String highSql = "SELECT " +
|
|
@ -2324,12 +2327,13 @@ public class DoctorSchemeService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public HashMap<String, Object> getLabelCount(String doctorId,String diseaseCondition) throws ExecutionException, InterruptedException {
|
|
|
public HashMap<String, Object> getLabelCount(String doctorId,String diseaseCondition,String isTrack,String pastWeek){
|
|
|
// 高血压预警
|
|
|
String sql01 = "SELECT count(DISTINCT a.id)\n" +
|
|
|
"FROM base_patient a \n" +
|
|
|
"INNER JOIN wlyy_outpatient b ON a.id=b.patient " +
|
|
|
"INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
|
|
|
"left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
|
|
|
"WHERE 1=1\n" +
|
|
|
"AND a.standard_status='1'\n" +
|
|
|
"AND a.disease_condition IN('1','2','0')\n" +
|
|
@ -2340,6 +2344,7 @@ public class DoctorSchemeService {
|
|
|
"FROM base_patient a \n" +
|
|
|
"INNER JOIN wlyy_outpatient b ON a.id=b.patient\n" +
|
|
|
"INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
|
|
|
"left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
|
|
|
"WHERE 1=1\n" +
|
|
|
"AND a.disease_condition IN('1','2','0')\n" +
|
|
|
"and l.label_name='高血压' " +
|
|
@ -2350,6 +2355,7 @@ public class DoctorSchemeService {
|
|
|
"FROM base_patient a \n" +
|
|
|
"INNER JOIN wlyy_outpatient b ON a.id=b.patient\n" +
|
|
|
"INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
|
|
|
"left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
|
|
|
"WHERE 1=1\n" +
|
|
|
"AND a.standard_status='1'\n" +
|
|
|
"AND a.disease_condition IN('1','2','0')\n" +
|
|
@ -2360,6 +2366,7 @@ public class DoctorSchemeService {
|
|
|
"FROM base_patient a \n" +
|
|
|
"INNER JOIN wlyy_outpatient b ON a.id=b.patient\n" +
|
|
|
"INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
|
|
|
"left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
|
|
|
"WHERE 1=1\n" +
|
|
|
"AND a.disease_condition IN('1','2','0')\n" +
|
|
|
"and l.label_name='糖尿病' " +
|
|
@ -2370,6 +2377,19 @@ public class DoctorSchemeService {
|
|
|
sql03 += " and a.disease_condition = '"+diseaseCondition+"' ";
|
|
|
sql04 += " and a.disease_condition = '"+diseaseCondition+"' ";
|
|
|
}
|
|
|
if("1".equals(isTrack)){
|
|
|
sql01 += " and t.id is not null ";
|
|
|
sql02 += " and t.id is not null ";
|
|
|
sql03 += " and t.id is not null ";
|
|
|
sql04 += " and t.id is not null ";
|
|
|
}
|
|
|
if("1".equals(pastWeek)){
|
|
|
String startDate = DateUtil.getNextDay(new Date(),-7);
|
|
|
sql01 += " and t.create_time >='"+startDate+"' ";
|
|
|
sql02 += " and t.create_time >='"+startDate+"' ";
|
|
|
sql03 += " and t.create_time >='"+startDate+"' ";
|
|
|
sql04 += " and t.create_time >='"+startDate+"' ";
|
|
|
}
|
|
|
Integer count1 = jdbcTemplate.queryForObject(sql01, Integer.class);// 高血压预警
|
|
|
Integer count2 = jdbcTemplate.queryForObject(sql02, Integer.class);// 高血压
|
|
|
Integer count3 = jdbcTemplate.queryForObject(sql03, Integer.class);// 糖尿病预警
|
|
@ -2386,12 +2406,14 @@ public class DoctorSchemeService {
|
|
|
/**
|
|
|
* labelType 1高血压 2糖尿病
|
|
|
*/
|
|
|
public List<Map<String, Object>> getLabelDetail(String doctorId, String labelType,String diseaseCondition, String searchContent, int page, int pageSize) {
|
|
|
public List<Map<String, Object>> getLabelDetail(String doctorId, String labelType,String diseaseCondition,String isTrack
|
|
|
,String pastWeek, String searchContent, int page, int pageSize) {
|
|
|
String sql = "SELECT DISTINCT a.id,a.`name`,a.idcard,a.mobile,a.ssc, TIMESTAMPDIFF(YEAR, a.birthday, CURDATE()) AS age " +
|
|
|
",a.sex,a.disease,CAST(a.disease_condition AS CHAR) diseaseCondition,a.photo,CAST(a.standard_status AS CHAR) standardStatus " +
|
|
|
"FROM base_patient a \n" +
|
|
|
"INNER JOIN wlyy_outpatient b ON a.id=b.patient\n" +
|
|
|
"INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
|
|
|
"left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
|
|
|
"WHERE 1=1\n" +
|
|
|
"AND a.disease_condition IN('1','2','0') " +
|
|
|
"AND b.doctor ='" + doctorId + "'";
|
|
@ -2409,6 +2431,13 @@ public class DoctorSchemeService {
|
|
|
if (StringUtils.isNotBlank(searchContent)) {
|
|
|
sql += " AND a.`name` LIKE '%" + searchContent + "%' ";
|
|
|
}
|
|
|
if("1".equals(isTrack)){
|
|
|
sql += " and t.id is not null ";
|
|
|
}
|
|
|
if("1".equals(pastWeek)){
|
|
|
String startDate = DateUtil.getNextDay(new Date(),-7);
|
|
|
sql += " and t.create_time >='"+startDate+"' ";
|
|
|
}
|
|
|
sql += " LIMIT " + (page - 1) * pageSize + "," + pageSize + "";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|