瀏覽代碼

医生端设备列表

hzp 8 年之前
父節點
當前提交
3e749cbe95

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/deviece/DeviceDao.java

@ -15,4 +15,7 @@ public interface DeviceDao extends PagingAndSortingRepository<Device, Long> {
	@Query("select a from Device a where a.categoryCode = ?1 and a.del = '1'")
	List<Device> findByCategoryCode(String categoryCode);
	@Query("select a from Device a where a.del = '1'")
	List<Device> findAll();
}

+ 6 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorTeamDao.java

@ -27,4 +27,10 @@ JpaSpecificationExecutor<DoctorTeam> {
	@Modifying
	@Query("update DoctorTeam a set a.del =0  where a.code = ?1 and signType='2'")
	void deleteTeam(String teamCode);
	/**
	 * 通过患者获取家庭签约团队
	 */
	@Query("select dt from DoctorTeam dt,SignFamily sf  where dt.code=sf.teamCode and sf.type='2' and sf.status>=0 and sf.patient= ?1 and dt.del= '1'")
	DoctorTeam findByPatientCode(String patientCode);
}

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDeviceDao.java

@ -13,6 +13,8 @@ public interface PatientDeviceDao extends PagingAndSortingRepository<PatientDevi
    @Query("select a from PatientDevice a where a.user = ?1")
	Iterable<PatientDevice> findByUser(String user);
	List<PatientDevice> findByUser(String user,Pageable pageRequest);
	List<PatientDevice> findByUserAndDoctor(String user,String doctor, Pageable pageRequest);
	List<PatientDevice> findByDeviceSnAndCategoryCode(String deviceSn, String categoryCode);

+ 89 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceService.java

@ -2,7 +2,15 @@ package com.yihu.wlyy.service.app.device;
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.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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -27,13 +35,24 @@ public class PatientDeviceService extends BaseService {
	private Clock clock = Clock.DEFAULT;
	@Autowired
	private DoctorDao doctorDao;
	@Autowired
	private PatientDeviceDao patientDeviceDao;
	@Autowired
	private DeviceDao deviceDao;
	@Autowired
	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) {
			page = 1;
		}
@ -127,9 +147,76 @@ public class PatientDeviceService extends BaseService {
			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);
		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;
	}
	/**

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java

@ -65,7 +65,7 @@ public class DoctorDeviceController extends BaseController {
			@ApiParam(name="pagesize",value="每页条数",defaultValue = "10")
			@RequestParam(value="pagesize",required = true) int pagesize) {
		try {
			List<PatientDevice> list = patientDeviceService.findByDoctor(patient, getUID(),page, pagesize);
			List<Map<String,Object>> list = patientDeviceService.findByDoctor(patient, getUID(),page, pagesize);
			return write(200, "查询成功", "data", list);
		} catch (Exception ex) {