Przeglądaj źródła

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

chenweida 8 lat temu
rodzic
commit
6549f48cf9

+ 12 - 12
patient-co-wlyy/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java

@ -31,25 +31,25 @@ public interface DevicePatientHealthIndexDao
    @Query("select a from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate between ?3 and ?4 and a.del = '1' group by recordDate order by recordDate asc")
    Iterable<DevicePatientHealthIndex> findByPatient(String user, int type, Date begin, Date end);
    @Query("select a.value1 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value1 > 0 order by recordDate desc")
    @Query("select a.value1 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value1 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue1ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value2 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value2 > 0 order by recordDate desc")
    @Query("select a.value2 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value2 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue2ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value3 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value3 > 0 order by recordDate desc")
    @Query("select a.value3 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value3 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue3ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value4 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value4 > 0 order by recordDate desc")
    @Query("select a.value4 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value4 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue4ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value5 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value5 > 0 order by recordDate desc")
    @Query("select a.value5 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value5 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue5ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value6 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value6 > 0 order by recordDate desc")
    @Query("select a.value6 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value6 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue6ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value7 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value7 > 0 order by recordDate desc")
    @Query("select a.value7 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value7 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue7ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
	@Query("select a from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate >= ?3 and a.recordDate <= ?4 and a.del = '1'")
@ -62,7 +62,7 @@ public interface DevicePatientHealthIndexDao
	@Query("select a from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.del = '1'")
	List<DevicePatientHealthIndex> findIndexByPatient(String patient, int type, Pageable pageRequest);
	@Query("SELECT a FROM DevicePatientHealthIndex a where a.user = ?1 order by a.recordDate desc ")
	@Query("SELECT a FROM DevicePatientHealthIndex a where a.user = ?1 and a.del = '1' order by a.recordDate desc ")
	Iterable<DevicePatientHealthIndex> findRecentByPatient(String patient);
	@Query("select DATE_FORMAT(a.recordDate,'%Y-%m-%d') from DevicePatientHealthIndex a where a.user = ?1 and a.recordDate >= ?2 and a.recordDate <= ?3 and a.del = '1' group by DATE_FORMAT(a.recordDate,'%Y-%m-%d') order by DATE_FORMAT(a.recordDate,'%Y-%m-%d') desc")
@ -71,16 +71,16 @@ public interface DevicePatientHealthIndexDao
	/**
	 * 获取患者一天血糖值
     */
	@Query("select a from DevicePatientHealthIndex a where a.type=1 and a.user = ?1 and DATE_FORMAT(a.recordDate,'%Y-%m-%d') = ?2 order by a.recordDate,a.id")
	@Query("select a from DevicePatientHealthIndex a where a.type=1 and a.user = ?1 and DATE_FORMAT(a.recordDate,'%Y-%m-%d') = ?2 and a.del = '1' order by a.recordDate,a.id")
	List<DevicePatientHealthIndex> findByDate(String patient, String date);
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.user=?1 and a.type=?2 order by a.record_date desc limit 0,1",nativeQuery = true)
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.user=?1 and a.type=?2 and a.del='1' order by a.record_date desc limit 0,1",nativeQuery = true)
	DevicePatientHealthIndex findLastData(String patient, Integer type);
	/**
	 * 上次血糖值
     */
	@Query(value = "select a.value1 from device.wlyy_patient_health_index a where a.type=1 and a.user = ?1 and a.id<?2 and a.value2 = ?3 order by a.sort_date desc ,record_date desc limit 0,1",nativeQuery = true)
	@Query(value = "select a.value1 from device.wlyy_patient_health_index a where a.type=1 and a.user = ?1 and a.id<?2 and a.value2 = ?3 and a.del = '1' order by a.sort_date desc ,record_date desc limit 0,1",nativeQuery = true)
	String getPreValue(String user,Long id,String value2);
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.user = ?1 and a.type = ?2 and a.value2 =?3 and a.record_date >= ?4 and a.record_date <= ?5 and a.del = '1' order by a.sort_date desc ,record_date desc limit ?6 ,?7",nativeQuery = true)
@ -92,7 +92,7 @@ public interface DevicePatientHealthIndexDao
	 * @param date
	 * @return
	 */
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.type=1 and a.user = ?1 and DATE_FORMAT(a.record_date,'%Y-%m-%d') = ?2 order by a.record_date,a.id",nativeQuery = true)
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.type=1 and a.user = ?1 and DATE_FORMAT(a.record_date,'%Y-%m-%d') = ?2 and a.del = '1' order by a.record_date,a.id",nativeQuery = true)
	List<DevicePatientHealthIndex> findByDateNative(String patient, String date );
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.user = ?1 and a.type = ?2 and a.record_date >= ?3 and a.record_date <= ?4 and a.del = '1' order by a.sort_date desc ,record_date desc limit ?5 ,?6",nativeQuery = true)

+ 7 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyRenewDao.java

@ -27,9 +27,12 @@ public interface SignFamilyRenewDao extends PagingAndSortingRepository<SignFamil
    @Query(value = "select a from SignFamilyRenew a where a.patient = ?1 and a.status <> -1 and a.status <> -2")
    List<SignFamilyRenew> findAllActiveSignByPatient(String patient);
    @Query(value = "select a from SignFamilyRenew a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3")
    @Query(value = "select a from SignFamilyRenew a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3 ")
    List<SignFamilyRenew> findByDoctorAndPatient(String doctor,String patient,String signYear);
    @Query(value = "select a from SignFamilyRenew a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3 and a.status = 0")
    List<SignFamilyRenew> findByDoctorAndPatientStatus0(String doctor,String patient,String signYear);
    @Query(value = "select a from SignFamilyRenew a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3 and a.status = 1 and a.expensesStatus ='1'")
    List<SignFamilyRenew> findByDoctorAndPatientIsValid(String doctor,String patient,String signYear);
@ -39,6 +42,9 @@ public interface SignFamilyRenewDao extends PagingAndSortingRepository<SignFamil
    @Query(value = "select a from SignFamilyRenew a where a.doctorHealth =?1 and a.patient = ?2 and a.signYear =?3")
    List<SignFamilyRenew> findByDoctorHealthAndPatient(String doctorHealth,String patient,String signYear);
    @Query(value = "select a from SignFamilyRenew a where a.doctorHealth =?1 and a.patient = ?2 and a.signYear =?3 and a.status=0")
    List<SignFamilyRenew> findByDoctorHealthAndPatientStatus0(String doctorHealth,String patient,String signYear);
    // 查询患者已生效的家庭续签约
    @Query("select a from SignFamilyRenew a where a.patient = ?1 and a.type = 2 and a.status = 0")
    SignFamilyRenew findSigningByPatient(String patient);

+ 10 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -1620,6 +1620,16 @@ public class ConsultTeamService extends ConsultService {
            Patient p = patientDao.findByCode(endOperator);
            endName = p.getName();
            endId = p.getCode();
            String openId = p.getOpenid();
            JSONObject json = new JSONObject();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            json.put("keyword1","满意度评价");
            json.put("keyword2",sdf.format(new Date()));
            json.put("toUser", p.getCode());
            json.put("remark", "");
            json.put("consult",consult);
            json.put("first", endName +",您好!您有1条咨询已结束,请及时对咨询医生进行满意度评价。");
            PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 17, openId, p.getName(), json);
        } else {
            if (endOperator.equals("admin")) {
                endId = "system";

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/EvaluateLabelService.java

@ -42,7 +42,7 @@ public class EvaluateLabelService extends BaseService {
	public 	List<Map<String, Object>> findDistinctLabelByLaDoctor(String doctor){
		String sql ="select content,count(content) as amount from wlyy_evaluate_label where doctor =? group by content";
		String sql ="select content,count(content) as amount from wlyy_evaluate_label where doctor =? group by content order by amount DESC,id DESC ";
		List<Object> params = new ArrayList<Object>();
		params.add(doctor);
		List<Map<String, Object>> result = this.jdbcTemplate.queryForList(sql,params.toArray());

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

@ -425,11 +425,10 @@ public class PatientDeviceService extends BaseService {
        Map map = new HashMap();
        PatientBloodSugger bloodSugger = null;
        PatientHealthTime patientHealthTime = null;
        if (StringUtils.isEmpty(user) && StringUtils.isEmpty(deviceSN)) {
            bloodSugger = patientBloodSuggerDao.findRecent();
        } else {
        if (!StringUtils.isEmpty(user) && !StringUtils.isEmpty(deviceSN)) {
            patientHealthTime = patientHealthTimeDao.findByUserAndSN(user, deviceSN);
        }
        String fastingStart = null;
        String fastingEnd = null;
        String afterBreakFastStart = null;
@ -445,6 +444,9 @@ public class PatientDeviceService extends BaseService {
        String beforeSleepStart = null;
        String beforeSleepEnd = null;
        if (patientHealthTime == null) {
            bloodSugger = patientBloodSuggerDao.findRecent();
            fastingStart = bloodSugger.getFastingStart();
            fastingEnd = bloodSugger.getFastingEnd();
            afterBreakFastStart = bloodSugger.getAfterBreakfastStart();

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -901,10 +901,10 @@ public class SignWebService extends BaseService {
     */
    public int agreeRenew(String access_token,String dotorCode,String patientCode,String state,Long mesId,String signYear) throws Exception{
        List<SignFamilyRenew> renews =  signFamilyRenewDao.findByDoctorAndPatient(dotorCode,patientCode,signYear);
        List<SignFamilyRenew> renews =  signFamilyRenewDao.findByDoctorAndPatientStatus0(dotorCode,patientCode,signYear);
        if(renews==null||renews.size()==0){
            renews =  signFamilyRenewDao.findByDoctorHealthAndPatient(dotorCode,patientCode,signYear);
            renews =  signFamilyRenewDao.findByDoctorHealthAndPatientStatus0(dotorCode,patientCode,signYear);
        }
        if(renews!=null&&renews.size()>0){

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -538,7 +538,7 @@ public class PushMsgTask {
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
            } else if (type == 17) {
                temp.setUrl(url + "yszx/html/consulting-doctor.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name);
                temp.setUrl(url + "yszx/html/doctor-consultation.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name);
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties().getProperty("template_doctor_survey"));
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultMoviController.java

@ -19,7 +19,7 @@ import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.WeixinBaseController;
/**
 * 患者端:视频咨询控制类
 * 患者端视频咨询控制类
 * 
 * @author George
 */