|
@ -7,9 +7,11 @@ import com.yihu.jw.device.dao.DevicePatientHealthIndexDao;
|
|
|
import com.yihu.jw.device.dao.PatientAimBloodPressureDao;
|
|
|
import com.yihu.jw.device.dao.PatientAimBloodSuggerDao;
|
|
|
import com.yihu.jw.device.dao.PatientAimSportsDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.entity.base.device.PatientAimBloodPressure;
|
|
|
import com.yihu.jw.entity.base.device.PatientAimBloodSugger;
|
|
|
import com.yihu.jw.entity.base.device.PatientAimSports;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
|
|
|
import com.yihu.jw.entity.scheme.*;
|
|
@ -35,7 +37,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
@ -47,7 +48,6 @@ import java.util.concurrent.Executors;
|
|
|
* @date 2017/9/13 15:46
|
|
|
*/
|
|
|
@Service
|
|
|
@Transactional
|
|
|
public class DoctorSchemeService {
|
|
|
private static Logger logger = LoggerFactory.getLogger(DoctorSchemeService.class);
|
|
|
|
|
@ -68,7 +68,8 @@ public class DoctorSchemeService {
|
|
|
|
|
|
@Autowired
|
|
|
private BasePatientDao patientDao;
|
|
|
|
|
|
@Autowired
|
|
|
private BaseDoctorDao doctorDao;
|
|
|
@Autowired
|
|
|
private DevicePatientHealthIndexDao devicePatientHealthIndexDao;
|
|
|
|
|
@ -90,6 +91,65 @@ public class DoctorSchemeService {
|
|
|
@Value("${im.data_base_name}")
|
|
|
private String im_dataBase_name;
|
|
|
|
|
|
//取消重点关注
|
|
|
public void delTrack(String patient,String doctor){
|
|
|
synchronized (patient.intern()){
|
|
|
//查询是否与医生建立重点跟踪关系,诺无关系则建立
|
|
|
TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(doctor,patient);
|
|
|
if(trackPatient == null){
|
|
|
BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(doctor);
|
|
|
BasePatientDO patientDO = patientDao.findByIdAndDel(patient,"1");
|
|
|
TrackPatient t = new TrackPatient();
|
|
|
t.setCreateTime(new Date());
|
|
|
t.setDoctorCode(doctorDO.getId());
|
|
|
t.setDoctorName(doctorDO.getName());
|
|
|
t.setIdcard(patientDO.getIdcard());
|
|
|
t.setSsc(patientDO.getSsc());
|
|
|
t.setPatientCode(patient);
|
|
|
t.setPatientName(patientDO.getName());
|
|
|
t.setDel("0");
|
|
|
trackPatientDao.save(t);
|
|
|
}else {
|
|
|
trackPatient.setDel("0");
|
|
|
trackPatientDao.save(trackPatient);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//是否关注
|
|
|
public String isTrack(String patient,String doctor){
|
|
|
TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(doctor,patient);
|
|
|
if(trackPatient==null){
|
|
|
return "0";
|
|
|
}
|
|
|
return trackPatient.getDel();
|
|
|
}
|
|
|
|
|
|
//添加重点关注
|
|
|
public void addTrack(String patient,String doctor){
|
|
|
synchronized (patient.intern()){
|
|
|
//查询是否与医生建立重点跟踪关系,诺无关系则建立
|
|
|
TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(doctor,patient);
|
|
|
if(trackPatient == null){
|
|
|
BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(doctor);
|
|
|
BasePatientDO patientDO = patientDao.findByIdAndDel(patient,"1");
|
|
|
TrackPatient t = new TrackPatient();
|
|
|
t.setCreateTime(new Date());
|
|
|
t.setDoctorCode(doctorDO.getId());
|
|
|
t.setDoctorName(doctorDO.getName());
|
|
|
t.setIdcard(patientDO.getIdcard());
|
|
|
t.setSsc(patientDO.getSsc());
|
|
|
t.setPatientCode(patient);
|
|
|
t.setPatientName(patientDO.getName());
|
|
|
t.setDel("1");
|
|
|
trackPatientDao.save(t);
|
|
|
}else {
|
|
|
trackPatient.setDel("1");
|
|
|
trackPatientDao.save(trackPatient);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据团队CODE/居民标签/病情/设备绑定状态查询团队具名CODE列表
|
|
@ -105,7 +165,7 @@ public class DoctorSchemeService {
|
|
|
public List<String> getPatientsByDiseaseConditionDiseaseDeviceType(String teamCode, Integer disease, String diseaseCondition, Integer deviceType, String doctorcode, String trackFlag) throws Exception {
|
|
|
String sql = "SELECT a.id\n" +
|
|
|
"FROM base_patient a \n" +
|
|
|
"INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\n";
|
|
|
"INNER JOIN wlyy_outpatient b ON a.id=b.patient\n";
|
|
|
|
|
|
//1.4.2加入跟踪居民过滤
|
|
|
if (StringUtils.isNotBlank(trackFlag) && "1".equals(trackFlag)) {
|
|
@ -138,7 +198,7 @@ public class DoctorSchemeService {
|
|
|
sql = sql + " and dev.user is not null ";
|
|
|
}
|
|
|
}
|
|
|
sql += " AND b.doctor_id ='" + doctorcode + "' ";
|
|
|
sql += " AND b.doctor ='" + doctorcode + "' ";
|
|
|
//1.4.2加入跟踪居民过滤
|
|
|
if (StringUtils.isNotBlank(trackFlag) && "1".equals(trackFlag)) {
|
|
|
sql += " AND tp.del='1' AND tp.doctor_code = '" + doctorcode + "' ";
|
|
@ -409,11 +469,11 @@ public class DoctorSchemeService {
|
|
|
" a.disease_condition \n" +
|
|
|
"FROM\n" +
|
|
|
" base_patient a \n" +
|
|
|
" INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\n" +
|
|
|
" INNER JOIN wlyy_outpatient b ON a.id=b.patient\n" +
|
|
|
"WHERE 1=1\n" +
|
|
|
"AND a.disease_condition IN('1','2','3')\n" +
|
|
|
"AND a.disease_condition IN('1','2','0')\n" +
|
|
|
"AND a.disease IN ('1','2','1,2','2,1')\n" +
|
|
|
"AND b.doctor_id ='" + doctorcode + "'";
|
|
|
"AND b.doctor ='" + doctorcode + "'";
|
|
|
|
|
|
patients = jdbcTemplate.query(patientsql, new BeanPropertyRowMapper(PatientVO.class));
|
|
|
|
|
@ -735,10 +795,16 @@ public class DoctorSchemeService {
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> getPatientHealthIndexNew(String startDate, String endDate, String type, String doctor) {
|
|
|
|
|
|
public Map<String, Object> getPatientHealthIndexNew(String startDate, String endDate, String type,String patient, String doctor) {
|
|
|
startDate = startDate + " 00:00:00";
|
|
|
endDate = endDate + " 23:59:59";
|
|
|
String filter = "";
|
|
|
if(StringUtils.isNotBlank(patient)){
|
|
|
filter += " AND i.user = '"+patient+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(patient)){
|
|
|
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 " +
|
|
|
" (bf.befHighCount + aft.aftHighCount) AS highCount " +
|
|
|
" FROM " +
|
|
@ -753,9 +819,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value2 in(1,3,5,7) " +
|
|
|
" AND i.value1 > 7 " +
|
|
|
" AND i.record_date >='" + startDate + "'" +
|
|
|
" AND i.record_date <='" + endDate + "'" +
|
|
|
" AND i.user IN (" +
|
|
|
"SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
|
|
|
" AND i.record_date <='" + endDate + "'" + filter +
|
|
|
" ) bf, " +
|
|
|
" ( " +
|
|
|
" SELECT " +
|
|
@ -768,8 +832,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value2 in(2,4,6) " +
|
|
|
" AND i.value1 > 11.1 " +
|
|
|
" AND i.record_date >='" + startDate + "'" +
|
|
|
" AND i.record_date <='" + endDate + "'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
|
|
|
" AND i.record_date <='" + endDate + "'" + filter +
|
|
|
" ) aft";
|
|
|
String stdSql = "SELECT " +
|
|
|
" (bf.befHighCount + aft.aftHighCount) AS stdCount " +
|
|
@ -786,8 +849,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 <= 7 " +
|
|
|
" AND i.value1 >= 4 " +
|
|
|
" AND i.record_date >='" + startDate + "'" +
|
|
|
" AND i.record_date <='" + endDate + "'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
|
|
|
" AND i.record_date <='" + endDate + "'" + filter +
|
|
|
" ) bf, " +
|
|
|
" ( " +
|
|
|
" SELECT " +
|
|
@ -801,8 +863,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 <= 11.1 " +
|
|
|
" AND i.value1 >= 4 " +
|
|
|
" AND i.record_date >='" + startDate + "'" +
|
|
|
" AND i.record_date <='" + endDate + "'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
|
|
|
" AND i.record_date <='" + endDate + "'" + filter +
|
|
|
" ) aft";
|
|
|
String lowSql = "SELECT " +
|
|
|
" (bf.befHighCount + aft.aftHighCount) AS lowCount " +
|
|
@ -818,8 +879,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value2 in(1,3,5,7) " +
|
|
|
" AND i.value1 < 4 " +
|
|
|
" AND i.record_date >='" + startDate + "'" +
|
|
|
" AND i.record_date <='" + endDate + "'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
|
|
|
" AND i.record_date <='" + endDate + "'" +filter +
|
|
|
" ) bf, " +
|
|
|
" ( " +
|
|
|
" SELECT " +
|
|
@ -832,8 +892,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value2 in(2,4,6) " +
|
|
|
" AND i.value1 < 4 " +
|
|
|
" AND i.record_date >='" + startDate + "'" +
|
|
|
" AND i.record_date <='" + endDate + "'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
|
|
|
" AND i.record_date <='" + endDate + "'" +filter +
|
|
|
" ) aft";
|
|
|
|
|
|
String pHighSql = "SELECT " +
|
|
@ -845,8 +904,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.type = '2' " +
|
|
|
" AND i.value1 > 139 " +
|
|
|
" AND i.record_date >='" + startDate + "'" +
|
|
|
" AND i.record_date <='" + endDate + "'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )";
|
|
|
" AND i.record_date <='" + endDate + "'" +filter ;
|
|
|
String pStdSql = "SELECT " +
|
|
|
" count(1) AS stdCount " +
|
|
|
" FROM " +
|
|
@ -857,8 +915,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 <= 139 " +
|
|
|
" AND i.value1 >= 90 " +
|
|
|
" AND i.record_date >='" + startDate + "'" +
|
|
|
" AND i.record_date <='" + endDate + "'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )";
|
|
|
" AND i.record_date <='" + endDate + "'" +filter ;
|
|
|
String pLowSql = "SELECT " +
|
|
|
" count(1) AS lowCount " +
|
|
|
" FROM " +
|
|
@ -868,8 +925,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.type = '2' " +
|
|
|
" AND i.value1 < 90 " +
|
|
|
" AND i.record_date >='" + startDate + "'" +
|
|
|
" AND i.record_date <='" + endDate + "'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "')";
|
|
|
" AND i.record_date <='" + endDate + "'" +filter ;
|
|
|
|
|
|
Map<String, Object> rs = new HashedMap();
|
|
|
//0血檀
|
|
@ -925,7 +981,8 @@ public class DoctorSchemeService {
|
|
|
String hsql = "SELECT " +
|
|
|
" i.value1 AS weight, " +
|
|
|
" i.value2 AS height, " +
|
|
|
" i.value3 AS BMI " +
|
|
|
" i.value3 AS BMI, " +
|
|
|
" i.value4 " +
|
|
|
" FROM " +
|
|
|
" wlyy_patient_health_index i " +
|
|
|
" WHERE " +
|
|
@ -988,6 +1045,16 @@ public class DoctorSchemeService {
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
//获取居民最近一次体征记录
|
|
|
public DevicePatientHealthIndex findLatelyIndex(String patient,String type){
|
|
|
String sql = "select * from wlyy_patient_health_index where user='"+patient+"' and type="+type+" order by id desc limit 1 ";
|
|
|
List<DevicePatientHealthIndex> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(DevicePatientHealthIndex.class));
|
|
|
if(list.size()>0){
|
|
|
return list.get(0);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> getBodyInfo(String patient, String startDate, String endDate, Integer page, Integer size) {
|
|
|
startDate = startDate + " 00:00:00";
|
|
|
endDate = endDate + " 23:59:59";
|
|
@ -1044,7 +1111,6 @@ public class DoctorSchemeService {
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> getTrackPatientCountTitle(String doctor, String startDate, String endDate) {
|
|
|
// List<TrackPatient> trackPatients = trackPatientDao.findByDoctorCodeAndTeamCodeAndDel(doctor, teamCode, "1");
|
|
|
List<TrackPatient> trackPatients = trackPatientDao.findByDoctor(doctor, "1");
|
|
|
Map<String, Object> rs = new HashedMap();
|
|
|
rs.put("trackPatientCount", trackPatients.size());
|
|
@ -2128,66 +2194,56 @@ public class DoctorSchemeService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public HashMap<String, Object> getLabelCount(String doctorId) throws ExecutionException, InterruptedException {
|
|
|
public HashMap<String, Object> getLabelCount(String doctorId,String diseaseCondition) throws ExecutionException, InterruptedException {
|
|
|
// 高血压预警
|
|
|
String sql01 = "SELECT count(DISTINCT a.id)\n" +
|
|
|
"FROM base_patient a \n" +
|
|
|
"INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\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' " +
|
|
|
"WHERE 1=1\n" +
|
|
|
"AND a.standard_status='1'\n" +
|
|
|
"AND a.disease_condition IN('1','2','3')\n" +
|
|
|
"AND a.disease IN ('1','3') \n" +
|
|
|
"AND b.doctor_id ='" + doctorId + "'";
|
|
|
"AND a.disease_condition IN('1','2','0')\n" +
|
|
|
"and l.label_name='高血压' " +
|
|
|
"AND b.doctor ='" + doctorId + "'";
|
|
|
// 高血压
|
|
|
String sql02 = "SELECT count(DISTINCT a.id)\n" +
|
|
|
"FROM base_patient a \n" +
|
|
|
"INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\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' " +
|
|
|
"WHERE 1=1\n" +
|
|
|
"AND a.disease_condition IN('1','2','3')\n" +
|
|
|
"AND a.disease IN ('1','3') \n" +
|
|
|
"AND b.doctor_id ='" + doctorId + "'";
|
|
|
"AND a.disease_condition IN('1','2','0')\n" +
|
|
|
"and l.label_name='高血压' " +
|
|
|
"AND b.doctor ='" + doctorId + "'";
|
|
|
|
|
|
// 糖尿病预警
|
|
|
String sql03 = "SELECT count(DISTINCT a.id)\n" +
|
|
|
"FROM base_patient a \n" +
|
|
|
"INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\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' " +
|
|
|
"WHERE 1=1\n" +
|
|
|
"AND a.standard_status='1'\n" +
|
|
|
"AND a.disease_condition IN('1','2','3')\n" +
|
|
|
"AND a.disease IN ('2','3') \n" +
|
|
|
"AND b.doctor_id ='" + doctorId + "'";
|
|
|
"AND a.disease_condition IN('1','2','0')\n" +
|
|
|
"and l.label_name='糖尿病' " +
|
|
|
"AND b.doctor ='" + doctorId + "'";
|
|
|
// 糖尿病
|
|
|
String sql04 = "SELECT count(DISTINCT a.id)\n" +
|
|
|
"FROM base_patient a \n" +
|
|
|
"INNER JOIN base_patient_doctor_relation b ON a.id=b.patient_id\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' " +
|
|
|
"WHERE 1=1\n" +
|
|
|
"AND a.disease_condition IN('1','2','3')\n" +
|
|
|
"AND a.disease IN ('2','3') \n" +
|
|
|
"AND b.doctor_id ='" + doctorId + "'";
|
|
|
|
|
|
CompletableFuture<Integer> future01 = CompletableFuture.supplyAsync(() -> {
|
|
|
Integer count = jdbcTemplate.queryForObject(sql01, Integer.class);
|
|
|
return count;
|
|
|
}, execute);
|
|
|
CompletableFuture<Integer> future02 = CompletableFuture.supplyAsync(() -> {
|
|
|
Integer count = jdbcTemplate.queryForObject(sql02, Integer.class);
|
|
|
return count;
|
|
|
}, execute);
|
|
|
CompletableFuture<Integer> future03 = CompletableFuture.supplyAsync(() -> {
|
|
|
Integer count = jdbcTemplate.queryForObject(sql03, Integer.class);
|
|
|
return count;
|
|
|
}, execute);
|
|
|
CompletableFuture<Integer> future04 = CompletableFuture.supplyAsync(() -> {
|
|
|
Integer count = jdbcTemplate.queryForObject(sql04, Integer.class);
|
|
|
return count;
|
|
|
}, execute);
|
|
|
|
|
|
|
|
|
CompletableFuture.allOf(future01, future02, future03, future04).get();
|
|
|
Integer count1 = future01.get();// 高血压预警
|
|
|
Integer count2 = future02.get();// 高血压
|
|
|
Integer count3 = future03.get();// 糖尿病预警
|
|
|
Integer count4 = future04.get();// 糖尿病
|
|
|
"AND a.disease_condition IN('1','2','0')\n" +
|
|
|
"and l.label_name='糖尿病' " +
|
|
|
"AND b.doctor ='" + doctorId + "'";
|
|
|
if(StringUtils.isNotBlank(diseaseCondition)){
|
|
|
sql01 += " and a.disease_condition = '"+diseaseCondition+"' ";
|
|
|
sql02 += " and a.disease_condition = '"+diseaseCondition+"' ";
|
|
|
sql03 += " and a.disease_condition = '"+diseaseCondition+"' ";
|
|
|
sql04 += " and a.disease_condition = '"+diseaseCondition+"' ";
|
|
|
}
|
|
|
Integer count1 = jdbcTemplate.queryForObject(sql01, Integer.class);// 高血压预警
|
|
|
Integer count2 = jdbcTemplate.queryForObject(sql02, Integer.class);// 高血压
|
|
|
Integer count3 = jdbcTemplate.queryForObject(sql03, Integer.class);// 糖尿病预警
|
|
|
Integer count4 = jdbcTemplate.queryForObject(sql04, Integer.class);// 糖尿病
|
|
|
|
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
|
map.put("gxy_yj", count1);// 高血压预警
|
|
@ -2200,21 +2256,26 @@ public class DoctorSchemeService {
|
|
|
/**
|
|
|
* labelType 1高血压 2糖尿病
|
|
|
*/
|
|
|
public List<Map<String, Object>> getLabelDetail(String doctorId, String labelType, 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 \n" +
|
|
|
public List<Map<String, Object>> getLabelDetail(String doctorId, String labelType,String diseaseCondition, 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 base_patient_doctor_relation b ON a.id=b.patient_id\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' " +
|
|
|
"WHERE 1=1\n" +
|
|
|
"AND a.disease_condition IN('1','2','3')\n" +
|
|
|
"AND b.doctor_id ='" + doctorId + "'";
|
|
|
"AND a.disease_condition IN('1','2','0') " +
|
|
|
"AND b.doctor ='" + doctorId + "'";
|
|
|
if (StringUtils.isNotBlank(labelType)) {
|
|
|
if ("1".equals(labelType)) {
|
|
|
sql += "AND a.disease IN ('1','3') \n";
|
|
|
sql += "AND l.label_name='高血压' \n";
|
|
|
}
|
|
|
if ("2".equals(labelType)) {
|
|
|
sql += "AND a.disease IN ('2','3') \n";
|
|
|
sql += "AND l.label_name='糖尿病' \n";
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(diseaseCondition)){
|
|
|
sql += "AND a.disease_condition = '"+diseaseCondition+"' " ;
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(searchContent)) {
|
|
|
sql += " AND a.`name` LIKE '%" + searchContent + "%' ";
|
|
|
}
|