|
@ -11,6 +11,7 @@ import com.yihu.jw.entity.care.device.DevicePatientDevice;
|
|
import com.yihu.jw.entity.care.message.BaseServiceNews;
|
|
import com.yihu.jw.entity.care.message.BaseServiceNews;
|
|
import com.yihu.jw.org.dao.BaseOrgDao;
|
|
import com.yihu.jw.org.dao.BaseOrgDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -131,7 +132,7 @@ public class BaseServiceNewsService {
|
|
"WHERE t.patient = p.id and t.del=1 and t.`status`=1 and p.del =1 " +filter+
|
|
"WHERE t.patient = p.id and t.del=1 and t.`status`=1 and p.del =1 " +filter+
|
|
"UNION " +
|
|
"UNION " +
|
|
"SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon latLon,sex,idcard,archive_type type,p.pad_imei,p.openid from base_service_package_sign_record t,base_patient p " +
|
|
"SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon latLon,sex,idcard,archive_type type,p.pad_imei,p.openid from base_service_package_sign_record t,base_patient p " +
|
|
"WHERE t.patient = p.id and t.`status`=1 and p.del =1"+filter;
|
|
|
|
|
|
"WHERE t.patient = p.id and t.`status`=1 and p.del =1 and p.sign_status=1 "+filter;
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
for (Map<String,Object> map:list){
|
|
for (Map<String,Object> map:list){
|
|
String patient = map.get("id").toString();
|
|
String patient = map.get("id").toString();
|
|
@ -180,6 +181,80 @@ public class BaseServiceNewsService {
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查找所有未签约老人
|
|
|
|
* 社区老人
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public PageEnvelop<List<Map<String,Object>>> findUnSignPatientLocations(Integer page,Integer size){
|
|
|
|
|
|
|
|
page = page>0?page-1:0;
|
|
|
|
String filter =" ";
|
|
|
|
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);
|
|
|
|
if(listtmp.size()>0){
|
|
|
|
String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
|
|
|
|
if (StringUtils.isNotBlank(orgCodes)){
|
|
|
|
orgCodes = orgCodes.replaceAll(",","','");
|
|
|
|
filter = " and p.id not in ('"+orgCodes+"') ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String sql = "SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon latLon,sex,idcard,archive_type type,p.pad_imei,p.openid " +
|
|
|
|
" from base_patient p " +
|
|
|
|
"WHERE p.del =1 and p.sign_status=0 "+filter+" limit "+page*size+","+size;
|
|
|
|
String sqlCount = "SELECT count(p.id) " +
|
|
|
|
" from base_patient p " +
|
|
|
|
"WHERE p.del =1 and p.sign_status=0 "+filter ;
|
|
|
|
Long count = jdbcTemplate.queryForObject(sqlCount,Long.class);
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
for (Map<String,Object> map:list){
|
|
|
|
String patient = map.get("id").toString();
|
|
|
|
sql = "select label_code,label_name from wlyy_patient_label where label_type=1 and patient='"+patient+"' ";
|
|
|
|
List<Map<String,Object>> labels = jdbcTemplate.queryForList(sql);
|
|
|
|
if (labels.size()>0){
|
|
|
|
map.put("label_code",labels.get(0).get("label_code"));
|
|
|
|
map.put("label_name",labels.get(0).get("label_name"));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
map.put("label_code",null);
|
|
|
|
map.put("label_name",null);
|
|
|
|
}
|
|
|
|
String devices= deviceService.getPatientDeviceCategoryCode(map.get("id").toString());
|
|
|
|
if ("0".equals(devices)){
|
|
|
|
map.put("devices",new ArrayList<>());
|
|
|
|
}else {
|
|
|
|
String[] ss = devices.split(",");
|
|
|
|
map.put("devices",ss);
|
|
|
|
}
|
|
|
|
String idcard = map.get("idcard").toString();
|
|
|
|
map.put("age", IdCardUtil.getAgeForIdcard(idcard));
|
|
|
|
sql = " select CONCAT(o.serve_lat,',',o.serve_lon) latLon,'紧急呼叫' as serverDesc,o.org_code orgCode,o.device_sn from base_emergency_assistance_order o where o.patient='"+patient+"' and `status`=1 " +
|
|
|
|
" UNION All " +
|
|
|
|
"select CONCAT(o.serve_lat,',',o.serve_lon) latLon,o.serve_desc serverDesc,o.hospital orgCode,o.device_sn from base_security_monitoring_order o where o.patient='"+patient+"' and `status`=1 ";
|
|
|
|
List<Map<String,Object>> orderPoints = jdbcTemplate.queryForList(sql);
|
|
|
|
for (Map<String,Object> tmp:orderPoints){
|
|
|
|
if (null!=tmp.get("device_sn")){
|
|
|
|
String device_sn = tmp.get("device_sn").toString();
|
|
|
|
if (StringUtils.isNotBlank(device_sn)){
|
|
|
|
DeviceDetail deviceDetail = deviceDetailDao.findBySn(device_sn);
|
|
|
|
if (null!=deviceDetail){
|
|
|
|
tmp.put("contactStatus",deviceDetail.getContactStatus());
|
|
|
|
tmp.put("categoryCode",deviceDetail.getCategoryCode());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String orgCode = tmp.get("orgCode").toString();
|
|
|
|
BaseOrgDO orgDO = orgDao.findByCode(orgCode);
|
|
|
|
if (null!=orgDO){
|
|
|
|
tmp.put("orgType",orgDO.getType());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
map.put("orderPoints",orderPoints);
|
|
|
|
}
|
|
|
|
return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
|
|
|
|
}
|
|
|
|
|
|
public List<Map<String , Object>> getLatLon(){
|
|
public List<Map<String , Object>> getLatLon(){
|
|
String filter =" ";
|
|
String filter =" ";
|
|
String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_helper' or dict_name = 'jkzl_teacher' ";
|
|
String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_helper' or dict_name = 'jkzl_teacher' ";
|