|
@ -10,6 +10,7 @@ import com.yihu.wlyy.entity.doctor.scheme.vo.DoctorSchemeBloodPressureVO;
|
|
|
import com.yihu.wlyy.entity.doctor.scheme.vo.DoctorSchemeBloodSuggerVO;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.PatientSchemeList;
|
|
|
import com.yihu.wlyy.entity.patient.vo.PatientVO;
|
|
|
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctoreSchemeBloodPressureDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctrorSchemeBloodSuggerDao;
|
|
@ -20,6 +21,7 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
|
|
import org.springframework.stereotype.Service;
|
|
@ -78,13 +80,15 @@ public class DoctorSchemeService {
|
|
|
if(-1 != deviceType){
|
|
|
sql = sql + " LEFT JOIN wlyy_patient_device dev on dev.user = p.code ";
|
|
|
}
|
|
|
|
|
|
sql = sql+ " LEFT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code ";
|
|
|
|
|
|
sql = sql+ " LEFT JOIN wlyy_sign_family sf on sf.patient = p.code where sf.admin_team_code = "+teamCode;
|
|
|
|
|
|
if(-1 != disease){
|
|
|
sql = sql + " and (p.disease ="+disease+" or p.disease = 3) ";
|
|
|
if(-1 != disease && 3 != disease){
|
|
|
sql = sql + " and sp.label ="+disease;
|
|
|
}else{
|
|
|
sql = sql + " and p.disease >0 ";
|
|
|
sql = sql + " and (sp.label = 1 or sp.label = 2) ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(diseaseCondition) && !"-1".equals(diseaseCondition)){
|
|
@ -103,7 +107,7 @@ public class DoctorSchemeService {
|
|
|
|
|
|
sql = sql + " and (sf.doctor = '"+doctorcode+"' or sf.doctor_health ='"+doctorcode+"')";
|
|
|
|
|
|
sql = sql + " and p.status > 0 and p.disease > 0 and sf.status > 0 ";
|
|
|
sql = sql + " and p.status > 0 and sp.label_type = 3 and sf.status > 0 ";
|
|
|
|
|
|
List<String> result = jdbcTemplate.queryForList(sql,new Object[]{},String.class);
|
|
|
|
|
@ -389,7 +393,18 @@ public class DoctorSchemeService {
|
|
|
*/
|
|
|
public JSONObject getSlowDiseaseTeaminfos(String teamCode, int getcolor, int getstands, int gethealthindex, String startdate, String enddate,String doctorcode) throws Exception{
|
|
|
|
|
|
List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode,doctorcode);
|
|
|
// List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode,doctorcode);
|
|
|
|
|
|
List<PatientVO> patients = new ArrayList<>();
|
|
|
String patientsql = "select p.name,b.deviceType as deviceType,group_concat(sp.label) diseaseType from wlyy_patient p " +
|
|
|
" LEFT JOIN wlyy_sign_family s on s.patient = p.code " +
|
|
|
" RIGHT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code and sp.label_type = 3 and (sp.label = 1 or sp.label = 2) " +
|
|
|
" LEFT JOIN (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on p.code = b.user " +
|
|
|
"WHERE s.status > 0 and s.admin_team_code ='"+teamCode+"' and (s.doctor = '"+doctorcode+"' or s.doctor_health ='"+doctorcode+"') GROUP BY p.code";
|
|
|
|
|
|
patients= jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
JSONObject green = new JSONObject();//绿标
|
|
@ -406,13 +421,13 @@ public class DoctorSchemeService {
|
|
|
int count = patients.size();
|
|
|
|
|
|
//绿标居民
|
|
|
List<Patient> green_patients = new ArrayList<>();
|
|
|
List<PatientVO> green_patients = new ArrayList<>();
|
|
|
|
|
|
//黄标居民
|
|
|
List<Patient> yellow_patients = new ArrayList<>();
|
|
|
List<PatientVO> yellow_patients = new ArrayList<>();
|
|
|
|
|
|
//红标居民
|
|
|
List<Patient> red_patients = new ArrayList<>();
|
|
|
List<PatientVO> red_patients = new ArrayList<>();
|
|
|
|
|
|
//高血压居民预警居民CODE
|
|
|
List<String> bloodpressure_patientcodes = new ArrayList<>();
|
|
@ -421,7 +436,7 @@ public class DoctorSchemeService {
|
|
|
List<String> bloodsugar_patientcodes = new ArrayList<>();
|
|
|
|
|
|
if(!patients.isEmpty()){
|
|
|
for (Patient patient : patients) {
|
|
|
for (PatientVO patient : patients) {
|
|
|
|
|
|
//获取居民颜色标签
|
|
|
if(1 == getcolor && patient.getDiseaseCondition() != null){
|
|
@ -444,11 +459,11 @@ public class DoctorSchemeService {
|
|
|
if(1 == getstands && (patient.getStandardStatus() !=null && patient.getStandardStatus() ==1)){
|
|
|
|
|
|
if(patient.getDisease() != null){
|
|
|
if( 1 == patient.getDisease() || 3 == patient.getDisease()){
|
|
|
if( "1" == patient.getDisease() || "1,2" == patient.getDisease()){
|
|
|
bloodpressure_patientcodes.add(patient.getCode());
|
|
|
}
|
|
|
|
|
|
if( 2 == patient.getDisease() || 3 == patient.getDisease()){
|
|
|
if( "2" == patient.getDisease() || "1,2" == patient.getDisease()){
|
|
|
bloodsugar_patientcodes.add(patient.getCode());
|
|
|
}
|
|
|
}
|