Browse Source

代码修改

LAPTOP-KB9HII50\70708 10 months ago
parent
commit
156f2c1f75

+ 12 - 20
business/base-service/src/main/java/com/yihu/jw/device/dao/PatientDeviceDao.java

@ -12,37 +12,39 @@ import java.util.List;
public interface PatientDeviceDao extends JpaRepository<DevicePatientDevice, Long>, JpaSpecificationExecutor<DevicePatientDevice> {
    @Query("select a from DevicePatientDevice a where a.user = ?1 ")
    @Query("select a from DevicePatientDevice a where a.user = ?1 and a.del=0 ")
    Iterable<DevicePatientDevice> findByUser(String user);
    @Query("select a from DevicePatientDevice a where a.del = 0 ")
    List<DevicePatientDevice> findByAll();
    @Query("select a from PatientHealthStandard a where a.patient = ?1 and a.type = ?2")
    @Query("select a from PatientHealthStandard a where a.patient = ?1 and a.type = ?2 ")
    PatientHealthStandard findByPatientType(String patient, int type);
    @Query("select a from DevicePatientDevice a where a.user = ?1 ")
    @Query("select a from DevicePatientDevice a where a.user = ?1 and a.del=0 ")
    List<DevicePatientDevice> findByPatient(String user);
    @Query("select a from DevicePatientDevice a where a.user = ?1 and a.del=0 and a.deviceName like '%药盒%'")
    List<DevicePatientDevice> findByPatientAndDel(String user);
    @Query("select a from DevicePatientDevice a where a.user = ?1 and a.deviceSn=?2 and a.del=?3 ")
    List<DevicePatientDevice> findByPatientAndDeviceSn(String user, String deviceSn,Integer del);
    @Query("select a from DevicePatientDevice a where a.user = ?1 and a.deviceSn=?2 ")
    List<DevicePatientDevice> findByPatientAndDeviceSn(String user, String deviceSn);
    List<DevicePatientDevice> findByUser(String user, Pageable pageRequest);
    List<DevicePatientDevice> findByUserAndDoctor(String user, String doctor, Pageable pageRequest);
    List<DevicePatientDevice> findByUserAndDel(String user,Integer del, Pageable pageRequest);
    @Query("select a from DevicePatientDevice a where a.deviceSn = ?1 and a.categoryCode=?2 and a.del=0 ")
    List<DevicePatientDevice> findByDeviceSnAndCategoryCode(String deviceSn, String categoryCode);
    @Query("select a from DevicePatientDevice a where a.deviceSn = ?1 and a.categoryCode=?2 and a.userType=?3 and a.del=0 ")
    DevicePatientDevice findByDeviceSnAndCategoryCodeAndUserType(String deviceSn, String categoryCode, String userType);
    DevicePatientDevice findByDeviceIdAndDeviceSnAndUserType(Long deviceId, String deviceSn, String userType);
    @Query("select a from DevicePatientDevice a where a.deviceSn = ?1 and a.userType=?2 and a.del=0 ")
    DevicePatientDevice findByDeviceSnAndUserType(String deviceSn, String userType);
    @Query("select a from DevicePatientDevice a where a.deviceSn=?1 and a.userType =?2 ")
    @Query("select a from DevicePatientDevice a where a.deviceSn=?1 and a.userType =?2  and a.del=0")
    List<DevicePatientDevice> findByDeviceSnAndUserType2(String deviceSn, String userType);
    @Query("select pd from DevicePatientDevice pd where pd.deviceSn = ?1 and pd.del=0")
@ -55,22 +57,12 @@ public interface PatientDeviceDao extends JpaRepository<DevicePatientDevice, Lon
    //管理员解绑居民设备
    @Modifying
    @Query("update DevicePatientDevice t set t.del = 1  where t.deviceSn = ?1 and t.del =0  ")
    @Query("update DevicePatientDevice t set t.del = 1,t.delUser='admin'  where t.deviceSn = ?1 and t.del =0  ")
    int updatePatientDevice(String deviceSN);
    @Query("select a from DevicePatientDevice a")
    List<DevicePatientDevice> findAll();
    @Query("select a from DevicePatientDevice a group by a.user")
    List<DevicePatientDevice> findAllGroupUser();
    @Query("select a from DevicePatientDevice a where a.categoryCode = ?1 and a.del=0 group by a.user")
    List<DevicePatientDevice> findAllByCategoryCode(String categoryCode);
    @Modifying
    @Query("delete DevicePatientDevice a where a.deviceSn = ?1")
    int deleteByDeviceSn(String deviceSN);
    @Query("select a from DevicePatientDevice a where a.user=?1 and a.del=0")
    List<DevicePatientDevice> findAllByUser(String user);