Browse Source

代码修改

LAPTOP-KB9HII50\70708 1 year ago
parent
commit
2464b3360b

+ 20 - 0
business/base-service/src/main/java/com/yihu/jw/health/FoodCompDao.java

@ -0,0 +1,20 @@
package com.yihu.jw.health;
import com.yihu.jw.entity.base.health.FoodComp;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface FoodCompDao extends PagingAndSortingRepository<FoodComp, Long>, JpaSpecificationExecutor<FoodComp> {
	List<FoodComp> findByPid(Long pid);
	@Query("select a from FoodComp a where a.name like ?1")
	List<FoodComp> findByName(String name);
	@Query("select a from FoodComp a where a.pid <> ?1")
	List<FoodComp> findAllFoodByPidNot(Long pid);
}

+ 22 - 0
business/base-service/src/main/java/com/yihu/jw/health/MedicinesDao.java

@ -0,0 +1,22 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.health;
import com.yihu.jw.entity.base.health.Medicines;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface MedicinesDao extends PagingAndSortingRepository<Medicines, Long>, JpaSpecificationExecutor<Medicines> {
	@Query("select a from Medicines a where a.type = ?1 and a.del = '1'")
	List<Medicines> findAll(int type);
	Medicines findByCode(String code);
}

+ 35 - 0
business/base-service/src/main/java/com/yihu/jw/health/PatientHealthRecordDietDao.java

@ -0,0 +1,35 @@
package com.yihu.jw.health;
import com.yihu.jw.entity.base.health.PatientHealthRecordDiet;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
public interface PatientHealthRecordDietDao extends PagingAndSortingRepository<PatientHealthRecordDiet, Long>, JpaSpecificationExecutor<PatientHealthRecordDiet> {
    // 查询患者标识健康记录
    @Query("select a from PatientHealthRecordDiet a where a.patient = ?1 and a.del = '1'")
    Iterable<PatientHealthRecordDiet> findByPatient(String patient);
    // 查询最近的健康记录
    @Query("SELECT a FROM PatientHealthRecordDiet a WHERE a.patient = ?1 and a.del = '1' ORDER BY a.czrq DESC")
    Page<PatientHealthRecordDiet> findRecentByPatient(String patient, Pageable pageRequest);
    @Query("SELECT a FROM PatientHealthRecordDiet a WHERE a.patient = ?1 and a.recordDate >= ?2 and a.recordDate <= ?3 and a.del = '1' ORDER BY a.recordDate DESC")
    Page<PatientHealthRecordDiet> findDietByPatient(String patient, Date start, Date end, Pageable pageRequest);
    //	修改饮食记录
    @Modifying
    @Query("update PatientHealthRecordDiet a set a.recordDate = ?2,a.content = ?3,a.images= ?4 where a.id= ?1 ")
    void modifyDiet(long id,Date value1, String value2, String value3);
    //	删除饮食记录
    @Modifying
    @Query("update PatientHealthRecordDiet a set a.del = 0 where a.id= ?1 ")
    void deleteDiet(long id);
}

+ 35 - 0
business/base-service/src/main/java/com/yihu/jw/health/PatientHealthRecordMedicationDao.java

@ -0,0 +1,35 @@
package com.yihu.jw.health;
import com.yihu.jw.entity.base.health.PatientHealthRecordMedication;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
public interface PatientHealthRecordMedicationDao extends PagingAndSortingRepository<PatientHealthRecordMedication, Long>, JpaSpecificationExecutor<PatientHealthRecordMedication> {
    // 查询患者标识健康记录
    @Query("select a from PatientHealthRecordMedication a where a.patient = ?1 and a.del = '1'")
    Iterable<PatientHealthRecordMedication> findByPatient(String patient);
    // 查询最近的健康记录
    @Query("SELECT a FROM PatientHealthRecordMedication a WHERE a.patient = ?1 and a.del = '1' ORDER BY a.czrq DESC")
    Page<PatientHealthRecordMedication> findRecentByPatient(String patient, Pageable pageRequest);
    @Query("SELECT a FROM PatientHealthRecordMedication a WHERE a.patient = ?1 and a.recordDate >= ?2 and a.recordDate <= ?3 and a.del = '1' ORDER BY a.recordDate DESC")
    Page<PatientHealthRecordMedication> findMedicalByPatient(String patient, Date start, Date end, Pageable pageRequest);
    //	修改用药记录
    @Modifying
    @Query("update PatientHealthRecordMedication a set a.recordDate = ?2,a.medicines = ?3,a.medicinesName= ?4 where a.id= ?1 ")
    void modifyMedication(long id, Date value1, String value2,String medicationName);
    //	删除用药记录
    @Modifying
    @Query("update PatientHealthRecordMedication a set a.del = 0 where a.id= ?1 ")
    void deleteMedication(long id);
}

+ 36 - 0
business/base-service/src/main/java/com/yihu/jw/health/PatientHealthRecordSportsDao.java

@ -0,0 +1,36 @@
package com.yihu.jw.health;
import com.yihu.jw.entity.base.health.PatientHealthRecordSports;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
public interface PatientHealthRecordSportsDao extends PagingAndSortingRepository<PatientHealthRecordSports, Long>, JpaSpecificationExecutor<PatientHealthRecordSports> {
    // 查询患者标识健康记录
    @Query("select a from PatientHealthRecordSports a where a.patient = ?1 and a.del = '1'")
    Iterable<PatientHealthRecordSports> findByPatient(String patient);
    // 查询最近的健康记录
    @Query("SELECT a FROM PatientHealthRecordSports a WHERE a.patient = ?1 and a.del = '1' ORDER BY a.recordDate DESC")
    Page<PatientHealthRecordSports> findRecentByPatient(String patient, Pageable pageRequest);
    @Query("select a from PatientHealthRecordSports a where a.patient = ?1 and a.recordDate >= ?2 and a.recordDate <= ?3 and a.del = '1' order by a.recordDate desc")
    Page<PatientHealthRecordSports> findSportsByPatient(String patient, Date start, Date end, Pageable pageRequest);
    //	修改运动记录
    @Modifying
    @Query("update PatientHealthRecordSports a set a.recordDate = ?2,a.sportsTime= ?3 ,a.sportsType = ?4,a.sportsTypeName= ?5,a.sports = ?6 ,a.sportsName= ?7 where a.id= ?1 ")
    void modifySports(long id, Date value1, Double value2, String value3, String typeName, String value4, String sportName);
    //	删除运动记录
    @Modifying
    @Query("update PatientHealthRecordSports a set a.del = 0 where a.id= ?1 ")
    void deleteSports(long id);
}

+ 22 - 0
business/base-service/src/main/java/com/yihu/jw/health/SportsDao.java

@ -0,0 +1,22 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.health;
import com.yihu.jw.entity.base.health.Sports;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface SportsDao extends PagingAndSortingRepository<Sports, Long>, JpaSpecificationExecutor<Sports> {
	
	@Query("select a from Sports a where a.del = '1'")
	List<Sports> findAll();
	
	Sports findByCode(String code);
	
}

+ 22 - 0
business/base-service/src/main/java/com/yihu/jw/health/SportsTypeDao.java

@ -0,0 +1,22 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.health;
import com.yihu.jw.entity.base.health.SportsType;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface SportsTypeDao extends PagingAndSortingRepository<SportsType, Long>, JpaSpecificationExecutor<SportsType> {
	
	@Query("select a from SportsType a where a.del = '1'")
	List<SportsType> findAll();
	
	SportsType findByCode(String code);
	
}