|
@ -2,7 +2,15 @@ package com.yihu.wlyy.service.app.device;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import com.yihu.wlyy.entity.device.Device;
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
|
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
|
import com.yihu.wlyy.repository.deviece.DeviceDao;
|
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
|
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
@ -27,13 +35,24 @@ public class PatientDeviceService extends BaseService {
|
|
|
|
|
|
private Clock clock = Clock.DEFAULT;
|
|
private Clock clock = Clock.DEFAULT;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private DoctorDao doctorDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private PatientDeviceDao patientDeviceDao;
|
|
private PatientDeviceDao patientDeviceDao;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private DeviceDao deviceDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private PatientDao patientDao;
|
|
private PatientDao patientDao;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private DoctorTeamDao doctorTeamDao;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private DoctorTeamMemberDao doctorTeamMemberDao;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 保存患者设备
|
|
* 保存患者设备
|
|
*/
|
|
*/
|
|
@ -119,7 +138,8 @@ public class PatientDeviceService extends BaseService {
|
|
/**
|
|
/**
|
|
* 患者设备列表接口--医生端
|
|
* 患者设备列表接口--医生端
|
|
*/
|
|
*/
|
|
public List<PatientDevice> findByDoctor(String patientCode,String doctorCode, int page, int pagesize) {
|
|
|
|
|
|
public List<Map<String,Object>> findByDoctor(String patientCode,String doctorCode, int page, int pagesize) {
|
|
|
|
List<Map<String,Object>> re = new ArrayList<>();
|
|
if (page <= 0) {
|
|
if (page <= 0) {
|
|
page = 1;
|
|
page = 1;
|
|
}
|
|
}
|
|
@ -127,9 +147,76 @@ public class PatientDeviceService extends BaseService {
|
|
pagesize = 10;
|
|
pagesize = 10;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
boolean bo = false;
|
|
|
|
//签约团队
|
|
|
|
DoctorTeam dt =doctorTeamDao.findByPatientCode(patientCode);
|
|
|
|
//医生是否属于团队成员
|
|
|
|
if(dt!=null && doctorTeamMemberDao.findMemberByTeamAndCode(dt.getCode(),doctorCode)!=null)
|
|
|
|
{
|
|
|
|
bo = true;
|
|
|
|
}
|
|
|
|
|
|
PageRequest pageRequest = new PageRequest(page-1, pagesize);
|
|
PageRequest pageRequest = new PageRequest(page-1, pagesize);
|
|
|
|
|
|
return patientDeviceDao.findByUserAndDoctor(patientCode, doctorCode,pageRequest);
|
|
|
|
|
|
List<PatientDevice> list = new ArrayList<>();
|
|
|
|
if(bo) //签约医生查看所有设备
|
|
|
|
{
|
|
|
|
list = patientDeviceDao.findByUser(patientCode,pageRequest);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
list = patientDeviceDao.findByUserAndDoctor(patientCode, doctorCode,pageRequest);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(list!=null)
|
|
|
|
{
|
|
|
|
//获取设备路径,医生姓名
|
|
|
|
List<Device> deviceList = deviceDao.findAll();
|
|
|
|
Doctor self = doctorDao.findByCode(doctorCode);
|
|
|
|
for(PatientDevice item :list)
|
|
|
|
{
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
|
map.put("id",item.getId()) ;
|
|
|
|
map.put("deviceId",item.getDeviceId());
|
|
|
|
map.put("deviceSn",item.getDeviceSn());
|
|
|
|
map.put("user",item.getUser());
|
|
|
|
map.put("categoryCode",item.getCategoryCode());
|
|
|
|
map.put("userType",item.getUserType());
|
|
|
|
map.put("userIdcard",item.getUserIdcard());
|
|
|
|
map.put("czrq",item.getCzrq());
|
|
|
|
String deviceDoctor = item.getDoctor();
|
|
|
|
map.put("doctor",deviceDoctor);
|
|
|
|
if(deviceDoctor.equals(doctorCode))
|
|
|
|
{
|
|
|
|
map.put("doctorName",self.getName());
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
Doctor doctor = doctorDao.findByCode(deviceDoctor);
|
|
|
|
if(doctor!=null)
|
|
|
|
{
|
|
|
|
map.put("doctorName",doctor.getName());
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
map.put("doctorName","");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取设备路径
|
|
|
|
for(Device de : deviceList)
|
|
|
|
{
|
|
|
|
if(de.getId().equals(item.getDeviceId()))
|
|
|
|
{
|
|
|
|
map.put("deviceName",de.getName());
|
|
|
|
map.put("devicePhoto",de.getPhoto());
|
|
|
|
map.put("deviceBrands",de.getBrands());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
re.add(map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return re;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|