|
@ -1,309 +0,0 @@
|
|
|
package com.yihu.jw.hospital.team.dao;
|
|
|
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.door.SignFamily;
|
|
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
|
import org.springframework.data.jpa.repository.Modifying;
|
|
|
import org.springframework.data.jpa.repository.Query;
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
public interface WlyySignFamilyDao extends JpaRepository<SignFamily, Integer>, JpaSpecificationExecutor<SignFamily> {
|
|
|
// @Query("select count(*) from SignFamily t where t.doctor=?1 and t.status=1")
|
|
|
// Integer getCountByDoctorCode(String doctor);
|
|
|
|
|
|
// @Query("select count(1) from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status >= 0")
|
|
|
// int hasSingStatus(String idcard);
|
|
|
|
|
|
// @Modifying
|
|
|
// @Query("update SignFamily a set a.mobile = ?2 where a.patient = ?1")
|
|
|
// int updatePatientMobile(String patient, String mobile);
|
|
|
|
|
|
// @Query("select a from SignFamily a where a.idcard = ?1 and status = ?2 and a.type = 2")
|
|
|
// SignFamily findByPatientStatus(String idcard, int status);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and status = ?2 and a.type = 2")
|
|
|
// SignFamily findByPatientCodeStatus(String patient, int status);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and status >= ?2 and a.type = 2")
|
|
|
// SignFamily findByPatientCodeStatus2(String patient, int status);
|
|
|
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type = ?2 and a.status >= 1")
|
|
|
// SignFamily findByPatientAndType(String patient, int type);
|
|
|
//
|
|
|
// SignFamily findByCodeAndType(String code, Integer type);
|
|
|
//
|
|
|
// SignFamily findByTeamCode(String TeamCode);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.teamCode = ?1 and a.type = 2 and a.code=?2")
|
|
|
// List<SignFamily> findByTeamCodeIsValid(String teamCode, String code);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.type = 2 and a.status >= 0")
|
|
|
// SignFamily findByDoctorPatient(String doctor, String patient);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and (a.type = 2 or a.type=1) and a.status >= 0")
|
|
|
// List<SignFamily> findSSandFamilyByDoctorPatient(String doctor, String patient);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.doctorHealth = ?1 and a.patient = ?2 and a.type = 2 and a.status >= 0 ")
|
|
|
// SignFamily findByDoctorHealthPatient(String doctor, String patient);
|
|
|
|
|
|
|
|
|
// @Query("select p from BasePatientDO p,SignFamily a where a.doctorHealth = ?1 and a.adminTeamId=?2 and a.patient =p.code and a.type = 2 and a.status >= 0")
|
|
|
// List<BasePatientDO> findByDoctorHealthPatient(String doctor, Long team);
|
|
|
//
|
|
|
// @Query("select p from BasePatientDO p,SignFamily a where a.doctor = ?1 and a.adminTeamId=?2 and a.patient =p.code and a.type = 2 and a.status >= 0")
|
|
|
// List<BasePatientDO> findByDoctorPatient(String doctor, Long team);
|
|
|
|
|
|
// @Query("select a from SignFamily a,DoctorTeamMember w " +
|
|
|
// "where a.teamCode = w.team and w.del = '1' and w.memberCode = ?1 and a.patient = ?2 and a.status > 0 ")
|
|
|
// List<SignFamily> findByDoctorAndPatient(String doctor, String patient);
|
|
|
|
|
|
// @Query(value = "select a from SignFamily a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3 and a.status = 1 and a.expensesStatus ='1'")
|
|
|
// List<SignFamily> findByDoctorAndPatientIsValid(String doctor, String patient, String signYear);
|
|
|
//
|
|
|
// @Query(value = "select a from SignFamily a where a.doctorHealth =?1 and a.patient = ?2 and a.signYear =?3 and a.status = 1 and a.expensesStatus ='1'")
|
|
|
// List<SignFamily> findByDoctorHealthAndPatientIsValid(String doctorHealth, String patient, String signYear);
|
|
|
|
|
|
@Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.status = 1 and a.type = 2")
|
|
|
SignFamily findByFamilyDoctorAndPatient(String doctor, String patient);
|
|
|
|
|
|
@Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.status = 1 and a.type = 1")
|
|
|
SignFamily findBySanshiDoctorAndPatient(String doctor, String patient);
|
|
|
|
|
|
@Query("select a from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status >= 0")
|
|
|
SignFamily findByIdcard(String idcard);
|
|
|
|
|
|
@Query("select a from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status > 0 and a.expensesStatus ='1'")
|
|
|
SignFamily getExpensesSignByIdcard(String idcard);
|
|
|
|
|
|
// @Query("select a from SignFamily a where a.idcard = ?1 and a.type =1 and a.status >= 0")
|
|
|
// SignFamily findSSByIdcard(String idcard);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.idcard = ?1 ")
|
|
|
// List<SignFamily> findAllByIdcard(String idcard);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.idcard = ?1 and a.status >= 0")
|
|
|
// List<SignFamily> findSSandJTByIdcard(String idcard);
|
|
|
|
|
|
// // 拒绝解约
|
|
|
// @Modifying
|
|
|
// @Query("update SignFamily a set a.status = 1 where a.patient = ?1 and a.status = 2 and a.type = 2")
|
|
|
// int refuseSurrender(String patient);
|
|
|
//
|
|
|
// // 查询患者已生效的家庭签约
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type = 2 and a.status > 0")
|
|
|
// SignFamily findSignByPatient(String patient);
|
|
|
//
|
|
|
// @Modifying
|
|
|
// @Query("update SignFamily a set a.openid = ?1 where a.patient = ?2")
|
|
|
// int updateOpenidByPatient(String openid, String patient);
|
|
|
|
|
|
// 查询已签约的总数
|
|
|
// @Query("select count(1) from SignFamily a where (a.doctor = ?1 or a.doctorHealth = ?1) and (a.status = 1 or a.status = 2) and a.type = 2")
|
|
|
// int countAmountSignedByDoctor(String doctor);
|
|
|
|
|
|
// 查询待签约总数
|
|
|
// @Query("select count(1) from SignFamily a where (a.doctor = ?1 or a.doctorHealth = ?1) and a.status = 0 and a.type = 2")
|
|
|
// int countAmountUnsignByDoctor(String doctor);
|
|
|
|
|
|
@Query("select a from SignFamily a where a.mobile = ?1 and a.type = 2 and a.status >= 0")
|
|
|
SignFamily findByMobile(String mobile);
|
|
|
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type =1 and a.status >= 1")
|
|
|
// SignFamily findBySanshiPatient(String code);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type =1 and a.status >= 0")
|
|
|
// SignFamily findBySsPatient(String code);
|
|
|
|
|
|
@Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.status >= 1")
|
|
|
SignFamily findByjiatingPatient(String code);
|
|
|
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.status = 1")
|
|
|
// SignFamily findByjiatingPatientYes(String code);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type =1 and a.status = 1")
|
|
|
// SignFamily findBySanshiPatientYes(String id);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.idcard = ?1 and a.type = 1 and a.status in (0,1,2,3)")
|
|
|
// SignFamily findByPatientSanshiSignInfo(String idCard);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status in (0,1,2,3)")
|
|
|
// SignFamily findByPatientFamilySignInfo(String idCard);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.status >=0")
|
|
|
// SignFamily findByjiatingPatientStatus0(String patient);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type = 1 and a.status in (0,1,2)")
|
|
|
// SignFamily findSanshiSignByPatient(String patientCode);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type = 2 and a.status in (0,1,2)")
|
|
|
// SignFamily findFamilySignByPatient(String patientCode);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type = 2 and a.status =-4 and a.signYear =?2")
|
|
|
// SignFamily findFamilySignByPatientOverDue(String patientCode, String signYear);
|
|
|
|
|
|
// @Query("select p.code, p.name, p.photo, p.birthday, p.sex, p.diseaseCondition, p.disease, p.recordAmount,a.type,a.applyDate,p.idcard from SignFamily a,Patient p where (a.doctor = ?1 or a.doctorHealth = ?1) and a.patient = p.code and a.status in (1,2,3)")
|
|
|
// List<Object> findDoctorSignPatients(String doctor);
|
|
|
//
|
|
|
// @Query("select p.code, p.name, p.photo, p.birthday, p.sex, p.diseaseCondition, p.disease, p.recordAmount,a.type,a.applyDate,p.idcard from SignFamily a,Patient p where (a.doctor = ?1 or a.doctorHealth = ?1) and p.name like ?2 and a.patient = p.code and a.status in (1,2,3)")
|
|
|
// List<Object> findDoctorSignPatientsLikeName(String doctor, String name);
|
|
|
|
|
|
// @Query("select p.code, p.name, p.photo, p.birthday, p.sex, p.diseaseCondition, p.disease, p.recordAmount,a.type,a.applyDate,p.idcard from SignFamily a,Patient p where (a.doctor = ?1 or a.doctorHealth = ?1) and a.type = ?2 and a.patient = p.code and a.status in (1,2,3)")
|
|
|
// List<Object> findDoctorSignPatientsBySignType(String doctor, int type);
|
|
|
//
|
|
|
// @Query("select p.code, p.name, p.photo, p.birthday, p.sex, p.diseaseCondition, p.disease, p.recordAmount,a.type,a.applyDate,p.idcard from SignFamily a,Patient p where (a.doctor = ?1 or a.doctorHealth = ?1) and a.type = ?2 and p.name like ?3 and a.patient = p.code and a.status in (1,2,3)")
|
|
|
// List<Object> findDoctorSignPatientsByTypeName(String doctor, int type, String name);
|
|
|
|
|
|
@Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.status >= 0")
|
|
|
SignFamily findByPatient(String patient);
|
|
|
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.signYear =?2 and a.status in (-4,1,2,3) order by a.id desc ")
|
|
|
// List<SignFamily> findByPatientsLastYear(String patient, String signYear);
|
|
|
|
|
|
// @Query("select a from SignFamily a where a.idcard = ?1 and a.type = 1 and a.status >= 0")
|
|
|
// SignFamily findBySanshiIdcard(String idcard);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.type = ?2 and a.status > 0")
|
|
|
// SignFamily findSignByPatient(String patient, int type);
|
|
|
|
|
|
|
|
|
SignFamily findByCode(String code);
|
|
|
|
|
|
// @Query(" from SignFamily a where a.patient = ?1 and a.type = ?2 and (a.status=-3 or a.status=-4) order by a.id desc")
|
|
|
// List<SignFamily> findLastJySignByPatient(String patient, int type);
|
|
|
|
|
|
// @Query(" from SignFamily a where a.type =1 and unix_timestamp(a.czrq)=unix_timestamp( ?1 ) ")
|
|
|
// List<SignFamily> findByDate(String s);
|
|
|
|
|
|
// @Modifying
|
|
|
// @Query("update SignFamily set expenses_type = ?1 where patient = ?2 and status > 0 and type = 2")
|
|
|
// int updateExpensesType(String expensesType, String patient);
|
|
|
//
|
|
|
// @Query("select count(*) from SignFamily where patient = ?1 and status > 0 and type = 1")
|
|
|
// int countPatientSsSign(String patient);
|
|
|
//
|
|
|
// @Query("select count(*) from SignFamily where patient = ?1 and status > 0 and type = 2")
|
|
|
// int countPatientJtSign(String patient);
|
|
|
|
|
|
// 查询患者已生效的家庭签约
|
|
|
@Query("select a from SignFamily a where a.patient = ?1 and a.type = 2 and a.status = 0")
|
|
|
SignFamily findSigningByPatient(String patient);
|
|
|
|
|
|
//找出家庭签约中 团队是空的值
|
|
|
@Query("select a from SignFamily a where a.type = 2 and a.status = 1 and a.adminTeamId is null")
|
|
|
List<SignFamily> findBySignTypeAndTeamCode();
|
|
|
|
|
|
//找出没有健康管理师的签约数据
|
|
|
@Query("select a from SignFamily a where a.type = 2 and a.status >= 1 and a.doctorHealth is null and a.adminTeamId = ?1 order by a.czrq desc")
|
|
|
List<SignFamily> findNoHealthSignFamilyNum(Long teamCode);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.type = ?1 and a.signSource = ?2 and a.status > 0 order by a.id")
|
|
|
// Page<SignFamily> findByTypeAndSignSource(Integer type, String signSource, Pageable pageable);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.type = ?1 and a.signSource = ?2 and a.status > 0 and a.id >= ?3 and a.id <= ?4 order by a.id")
|
|
|
// Page<SignFamily> findByTypeAndSignSourceAndId(Integer type, String signSource, Long start, Long end, Pageable pageable);
|
|
|
//
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.status >= 0")
|
|
|
// List<SignFamily> findAllSignByPatient(String patient);
|
|
|
|
|
|
/**
|
|
|
* 获取所有有效的签约信息(不包含-1 -2)
|
|
|
*
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
// @Query("select a from SignFamily a where a.patient = ?1 and a.status <> -1 and a.status <> -2 order by a.czrq")
|
|
|
// List<SignFamily> findAllActiveSignByPatient(String patient);
|
|
|
//
|
|
|
// @Query("select a.patient from SignFamily a where a.doctor = ?1 and a.type = 2 and a.status > 0 and a.doctorHealth is null")
|
|
|
// List<String> findNohealthByDoctor(String doctor);
|
|
|
|
|
|
/**
|
|
|
* 获取团队中有效的患者
|
|
|
*
|
|
|
* @param teamCode
|
|
|
* @param status
|
|
|
* @return
|
|
|
*/
|
|
|
// @Query("select count(f) from SignFamily f where f.adminTeamId = ?1 and f.status >= ?2 ")
|
|
|
// int findByAdminTeamIdAndStatus(long teamCode, int status);
|
|
|
//
|
|
|
// @Query("select f from SignFamily f where f.patient = ?1 and f.adminTeamId = ?2 and f.status > 0 and f.type = ?3")
|
|
|
// SignFamily findByPatientAndAdminTeamId(String patient, Long teamCode, Integer type);
|
|
|
//
|
|
|
// @Query(value = " select a.* from wlyy_sign_family a where a.patient = ?1 and a.status = -4 order by a.apply_date desc limit 0,1", nativeQuery = true)
|
|
|
// SignFamily findOutTimeSigningByPatient(String patient);
|
|
|
|
|
|
// 完成缴费后更新签约开始时间begin 缴费状态expensesStatus 医保流水号medical_insurance_num 扣费时间expenses_time
|
|
|
// @Modifying
|
|
|
// @Query("update SignFamily a set a.begin = ?2 ,a.medicalInsuranceNum=?3,a.expensesStatus = ?4,a.expensesTime = ?2,a.signPaySource = ?5 where a.code = ?1 ")
|
|
|
// int updatePatientBegin(String code, Date begin, String medicalInsuranceNum, String expensesStatus, int signPaySource );
|
|
|
//
|
|
|
// //查询65岁以上一年内未体检且未系统提醒的签约居民
|
|
|
// @Query(value = "SELECT DISTINCT t1.* FROM wlyy_sign_family t1 LEFT JOIN wlyy_physical_examination_records r ON r.patient_code=t1.patient WHERE r.patient_code IS NULL " +
|
|
|
// " AND t1.STATUS>0 AND t1.hospital=?1 AND(YEAR(curdate())-IF(length(idcard)=18,substring(idcard,7,4),IF(length(idcard)=15,concat('19',substring(idcard,7,2)),NULL)))>=65 " +
|
|
|
// " AND t1.idcard NOT IN(SELECT DISTINCT s.idcard FROM wlyy_sign_family s,wlyy_old_people_physical_examination o WHERE s.hospital=?1 AND s.`status`>0 AND s.idcard=o.id_card " +
|
|
|
// " AND o.medical_time>?2 )ORDER BY t1.openid DESC,CONVERT(t1.NAME USING gbk) ",nativeQuery = true)
|
|
|
// List<SignFamily> findExaminationByHospital(String hospital,Date examinationTime);
|
|
|
//
|
|
|
// //查询wlyy_sign_family有续签却未同步到wlyy_sign_family_renew_log数据
|
|
|
// @Query(value = "SELECT f.* FROM wlyy_sign_family f LEFT JOIN wlyy_sign_family_renew_log r ON f.`code` = r.sign_code WHERE r.sign_code IS NULL " +
|
|
|
// " AND f.renew_flag IN (1, 2) AND f.`status` IN (1, 2) ",nativeQuery = true)
|
|
|
// List<SignFamily> findRenew();
|
|
|
//
|
|
|
// //根据身份证号查询最近的已到期签约数据
|
|
|
// @Query(value = "SELECT f.* FROM wlyy_sign_family f WHERE f.idcard = ?1 and f.`status` = -4 ORDER BY sign_year desc LIMIT 0,1 ",nativeQuery = true)
|
|
|
// SignFamily findLatelyRenew(String idcard);
|
|
|
//
|
|
|
// //查询wlyy_sign_family有效签约且居民的医疗保险号为空的数据
|
|
|
// @Query(value = "select a.idcard from wlyy_sign_family a left join wlyy_patient b on a.idcard = b.idcard where a.hospital = ?1 and (a.type = 2 or a.type = 1) " +
|
|
|
// "and a.status = 1 and a.expenses_status = 1 and (b.medicare_number is null or b.medicare_number = '')", nativeQuery = true)
|
|
|
// List<String> findIdcardByStatus(String hospital);
|
|
|
//
|
|
|
// /**
|
|
|
// * 判断是否已存在待处理签约
|
|
|
// */
|
|
|
// @Query("select a from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status = 0")
|
|
|
// SignFamily findByIdcardPre(String idcard);
|
|
|
//
|
|
|
// /**
|
|
|
// * 判断是否存在去年签约
|
|
|
// */
|
|
|
// @Query("select a from SignFamily a where a.idcard = ?1 and a.signYear=?2 and a.type = 2 and (a.status= -4 or a.status>0) and a.expensesStatus = '1'")
|
|
|
// SignFamily findOldSign(String idcard,String signYear);
|
|
|
//
|
|
|
// /**
|
|
|
// * 【临时】清洗
|
|
|
// */
|
|
|
// List<SignFamily> findByRenewFlag(String renewflag);
|
|
|
//
|
|
|
// /**
|
|
|
// * 【临时】清洗未扣费
|
|
|
// */
|
|
|
// @Query("select a from SignFamily a where a.status>0 and a.expensesStatus='0' and a.signYear='2017'")
|
|
|
// List<SignFamily> findNoExpenses(Pageable pageable);
|
|
|
//
|
|
|
// /**
|
|
|
// * 【临时】退费
|
|
|
// */
|
|
|
// @Query("select a from SignFamily a where a.status>0 and a.expensesStatus='3' and a.signYear='2017'")
|
|
|
// List<SignFamily> findReCharge();
|
|
|
//
|
|
|
// /**
|
|
|
// * 通过医生原有团队是否有签约
|
|
|
// */
|
|
|
// @Query("select a from SignFamily a where a.doctor = ?1 and a.adminTeamId =?2 and a.status > 0")
|
|
|
// List<SignFamily> findByDoctorAndAdminTeamCode(String doctor,Long adminTeamCode);
|
|
|
//
|
|
|
// /**
|
|
|
// * 判断是否三师签约
|
|
|
// */
|
|
|
// @Query("select a from SignFamily a where a.idcard = ?1 and a.type = 1 and a.status > 0")
|
|
|
// SignFamily findSanshiByIdcard(String idcard);
|
|
|
}
|