|
@ -2,6 +2,7 @@ package com.yihu.jw.care.service.message;
|
|
|
|
|
|
import com.yihu.jw.care.dao.device.PatientDeviceDao;
|
|
import com.yihu.jw.care.dao.device.PatientDeviceDao;
|
|
import com.yihu.jw.care.dao.message.BaseServiceNewsDao;
|
|
import com.yihu.jw.care.dao.message.BaseServiceNewsDao;
|
|
|
|
import com.yihu.jw.care.service.device.DeviceService;
|
|
import com.yihu.jw.entity.care.device.DevicePatientDevice;
|
|
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.restmodel.iot.device.WlyyPatientDeviceVO;
|
|
import com.yihu.jw.restmodel.iot.device.WlyyPatientDeviceVO;
|
|
@ -13,6 +14,7 @@ import org.springframework.data.domain.Sort.Direction;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@ -33,6 +35,8 @@ public class BaseServiceNewsService {
|
|
private JdbcTemplate jdbcTemplate;
|
|
private JdbcTemplate jdbcTemplate;
|
|
@Autowired
|
|
@Autowired
|
|
private PatientDeviceDao patientDeviceDao;
|
|
private PatientDeviceDao patientDeviceDao;
|
|
|
|
@Autowired
|
|
|
|
private DeviceService deviceService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查找机构坐标
|
|
* 查找机构坐标
|
|
@ -49,7 +53,7 @@ public class BaseServiceNewsService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public List<Map<String,Object>> findPatinetByName(String name){
|
|
public List<Map<String,Object>> findPatinetByName(String name){
|
|
String sql = "SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon latLon,sex,idcard,CAST(archive_type AS char) type from base_patient p\n" +
|
|
|
|
|
|
String sql = "SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon latLon,sex,idcard,p.pad_imei,p.openid,CAST(archive_type AS char) type from base_patient p\n" +
|
|
"WHERE p.del = 1 and p.name like '%"+name+"%'";
|
|
"WHERE p.del = 1 and p.name like '%"+name+"%'";
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
List<DevicePatientDevice> feeDetail = patientDeviceDao.findByAll();
|
|
List<DevicePatientDevice> feeDetail = patientDeviceDao.findByAll();
|
|
@ -57,6 +61,13 @@ public class BaseServiceNewsService {
|
|
.collect(Collectors.groupingBy(DevicePatientDevice::getUser));
|
|
.collect(Collectors.groupingBy(DevicePatientDevice::getUser));
|
|
for (Map<String,Object> map:list){
|
|
for (Map<String,Object> map:list){
|
|
String idcard = map.get("idcard").toString();
|
|
String idcard = map.get("idcard").toString();
|
|
|
|
String devices= deviceService.getPatientDeviceCategoryCode(map.get("id").toString());
|
|
|
|
if ("0".equals(devices)){
|
|
|
|
map.put("category",new ArrayList<>());
|
|
|
|
}else {
|
|
|
|
String[] ss = devices.split(",");
|
|
|
|
map.put("category",ss);
|
|
|
|
}
|
|
map.put("age", IdCardUtil.getAgeForIdcard(idcard));
|
|
map.put("age", IdCardUtil.getAgeForIdcard(idcard));
|
|
List<DevicePatientDevice> patientDevices = byDept1.get(map.get("id"));
|
|
List<DevicePatientDevice> patientDevices = byDept1.get(map.get("id"));
|
|
map.put("devices",patientDevices);
|
|
map.put("devices",patientDevices);
|
|
@ -70,13 +81,20 @@ public class BaseServiceNewsService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public List<Map<String,Object>> findPatinetLocations(){
|
|
public List<Map<String,Object>> findPatinetLocations(){
|
|
String sql = "SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon latLon,sex,idcard,archive_type type from base_doctor_patient_tmp t,base_patient p " +
|
|
|
|
|
|
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_doctor_patient_tmp t,base_patient p " +
|
|
"WHERE t.patient = p.id and t.del=1 and t.`status`=1 and p.del =1 " +
|
|
"WHERE t.patient = p.id and t.del=1 and t.`status`=1 and p.del =1 " +
|
|
"UNION " +
|
|
"UNION " +
|
|
"SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon latLon,sex,idcard,archive_type type 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";
|
|
"WHERE t.patient = p.id and t.`status`=1 and p.del =1";
|
|
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 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();
|
|
String idcard = map.get("idcard").toString();
|
|
map.put("age", IdCardUtil.getAgeForIdcard(idcard));
|
|
map.put("age", IdCardUtil.getAgeForIdcard(idcard));
|
|
}
|
|
}
|