|
@ -187,7 +187,7 @@ public class SpecialistService{
|
|
|
}
|
|
|
|
|
|
|
|
|
public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType,String teamCode, String labelCode, Integer page, Integer size){
|
|
|
public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType,String teamCode, String labelCode, Integer page, Integer size,String shareDoctor){
|
|
|
String sql="SELECT " +
|
|
|
" p. NAME, " +
|
|
|
" p. CODE, " +
|
|
@ -223,8 +223,11 @@ public class SpecialistService{
|
|
|
" AND i.`status` = '1' " +
|
|
|
" ) lb " +
|
|
|
" JOIN "+basedb+".wlyy_patient p ON p. CODE = lb.patient " +
|
|
|
" JOIN wlyy_specialist_patient_relation s ON s.patient = lb.patient " +
|
|
|
" WHERE s.team_code ='" +teamCode+"' "+
|
|
|
" JOIN wlyy_specialist_patient_relation s ON s.patient = lb.patient ";
|
|
|
if(StringUtils.isNotBlank(shareDoctor)){
|
|
|
sql = sql + " JOIN "+basedb+".wlyy_doctor_special_share sp ON s.id = sp.special_code and sp.doctor = '"+shareDoctor+"' ";
|
|
|
}
|
|
|
sql = sql +" WHERE s.team_code ='" +teamCode+"' "+
|
|
|
" AND s.status >=0 AND s.sign_status >0"+
|
|
|
" LIMIT "+(page-1)*size+","+size;
|
|
|
System.out.print("日志:"+sql);
|
|
@ -244,8 +247,11 @@ public class SpecialistService{
|
|
|
"a.id AS specialCode " +
|
|
|
"FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
|
|
|
"JOIN "+basedb+".wlyy_patient_disease_server b ON a.id=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+
|
|
|
"JOIN "+basedb+".wlyy_patient c ON a.patient=c.CODE " +
|
|
|
"LEFT JOIN "+basedb+".wlyy_sign_patient_label_info d ON a.patient=d.patient AND d.label_type=8 AND d.`status`=1" +
|
|
|
"JOIN "+basedb+".wlyy_patient c ON a.patient=c.CODE ";
|
|
|
if(StringUtils.isNotBlank(shareDoctor)){
|
|
|
sql = sql + " JOIN "+basedb+".wlyy_doctor_special_share sp ON a.id = sp.special_code and sp.doctor = '"+shareDoctor+"' ";
|
|
|
}
|
|
|
sql = sql +"LEFT JOIN "+basedb+".wlyy_sign_patient_label_info d ON a.patient=d.patient AND d.label_type=8 AND d.`status`=1" +
|
|
|
" WHERE a.sign_status> 0 AND a.`status`>=0 " +
|
|
|
// "AND a.doctor='"+doctor+"' OR a.health_assistant= '"+doctor+
|
|
|
" AND a.team_code ='" +teamCode+"' "+
|
|
@ -273,7 +279,7 @@ public class SpecialistService{
|
|
|
return MixEnvelop.getSuccess(SpecialistMapping.api_success,PatientLabelVOs);
|
|
|
}
|
|
|
|
|
|
public MixEnvelop<Long, Long> getLabelpatientCount(String doctor, String labelType, String label,Long teamCode){
|
|
|
public MixEnvelop<Long, Long> getLabelpatientCount(String doctor, String labelType, String label,Long teamCode,String shareDoctor){
|
|
|
String sql = "SELECT " +
|
|
|
" COUNT(1) as total " +
|
|
|
" FROM " +
|
|
@ -282,9 +288,18 @@ public class SpecialistService{
|
|
|
" i.label = '"+label+"' "+
|
|
|
" AND i.label_type = '"+labelType+"' " +
|
|
|
" AND i.`status` = '1' " +
|
|
|
" AND i.patient in ( " +
|
|
|
" select patient from wlyy_specialist_patient_relation WHERE team_code ='" +teamCode+"' "+
|
|
|
" AND STATUS >= 0 AND sign_status > 0 )";
|
|
|
" AND i.patient in (" +
|
|
|
"SELECT" +
|
|
|
"a.patient AS patient " +
|
|
|
"FROM" +
|
|
|
"wlyy_specialist_patient_relation a ";
|
|
|
if(StringUtils.isNotBlank(shareDoctor)){
|
|
|
sql = sql + " JOIN wlyy.wlyy_doctor_special_share b ON b.special_code = a.id AND b.doctor = '"+shareDoctor+"' ";
|
|
|
}
|
|
|
sql = sql+"WHERE" +
|
|
|
"a.team_code = '"+teamCode+"' " +
|
|
|
"AND a.STATUS >= 0 " +
|
|
|
"AND a.sign_status > 0)";
|
|
|
System.out.print("日志:"+sql);
|
|
|
List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
|
|
|
Long count = 0L;
|