|
@ -6,6 +6,7 @@ import com.yihu.jw.care.dao.apply.PatientBedApplyDao;
|
|
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
|
|
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
|
|
import com.yihu.jw.care.dao.sign.*;
|
|
import com.yihu.jw.care.dao.sign.*;
|
|
import com.yihu.jw.care.service.common.DictService;
|
|
import com.yihu.jw.care.service.common.DictService;
|
|
|
|
import com.yihu.jw.care.service.device.DeviceService;
|
|
import com.yihu.jw.care.util.ConstantUtil;
|
|
import com.yihu.jw.care.util.ConstantUtil;
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
@ -81,6 +82,8 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
private WlyyPatientLabelDao patientLabelDao;
|
|
private WlyyPatientLabelDao patientLabelDao;
|
|
@Autowired
|
|
@Autowired
|
|
private DictService dictService;
|
|
private DictService dictService;
|
|
|
|
@Autowired
|
|
|
|
private DeviceService deviceService;
|
|
|
|
|
|
|
|
|
|
public void addPatientSignList(){
|
|
public void addPatientSignList(){
|
|
@ -794,4 +797,53 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 按团队和标签查找签约居民
|
|
|
|
* @param teamCode
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public PageEnvelop<List<Map<String,Object>>> findSignPatientByTeamCode(String teamCode, String name,int page, int size){
|
|
|
|
String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older' ";
|
|
|
|
List<Map<String,Object>> listtmp = jdbcTemplate.queryForList(sqltmp);
|
|
|
|
String paitentFilter = "";
|
|
|
|
if(listtmp.size()>0){
|
|
|
|
String jkzlPatients = String.valueOf(listtmp.get(0).get("orgCodes"));
|
|
|
|
jkzlPatients = jkzlPatients.replaceAll(",","','");
|
|
|
|
paitentFilter = " and p.id not in ('"+jkzlPatients+"') ";
|
|
|
|
}
|
|
|
|
|
|
|
|
String sql = "SELECT DISTINCT p.id,p.name,p.photo,p.idcard,p.mobile,p.openid,p.sex,p.pad_imei padImei " ;
|
|
|
|
sql +=",(select COUNT(*) from wlyy_patient_device a where a.`user` = p.id and a.del=0) deviceFlag ";
|
|
|
|
String countSql = "SELECT count(DISTINCT p.id) ";
|
|
|
|
String filters ="";
|
|
|
|
|
|
|
|
filters = "from base_service_package_sign_record sr,base_service_package_record r, " +
|
|
|
|
" base_patient p,wlyy_patient_label l " +
|
|
|
|
" WHERE sr.id = r.sign_id and sr.status=1 and sr.patient = p.id and p.id = l.patient and l.label_type = 1 " ;
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(teamCode)){
|
|
|
|
filters+= " and r.team_code = '"+teamCode+"' ";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(org.apache.commons.lang.StringUtils.isNotBlank(name)){
|
|
|
|
filters += " and (p.name like '%"+name+"%' or p.idcard like '%"+name+"%') ";
|
|
|
|
}
|
|
|
|
filters += paitentFilter;
|
|
|
|
String orderBy = " ORDER BY sr.create_time DESC " +
|
|
|
|
"LIMIT "+ (page - 1) * size + "," + size;
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
|
|
|
|
for (Map<String,Object> map : list){
|
|
|
|
String idcard = map.get("idcard").toString();
|
|
|
|
map.put("age", IdCardUtil.getAgeForIdcard(idcard));
|
|
|
|
map.put("deviceType",deviceService.getPatientDeviceCategoryCode(map.get("id").toString()));
|
|
|
|
//签约医生标识
|
|
|
|
List<Map<String,Object>> doctorList = getServerDoctorAll(map.get("id").toString(),"0","1");
|
|
|
|
List<Map<String,Object>> helperList = getServerDoctorAll(map.get("id").toString(),"0","2");
|
|
|
|
map.put("helper", helperList.size()>0?1:0);
|
|
|
|
map.put("doctor", doctorList.size()>0?1:0);
|
|
|
|
}
|
|
|
|
Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
|
|
|
|
return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
|
|
|
|
}
|
|
}
|
|
}
|