|
@ -1,29 +1,28 @@
|
|
package com.yihu.wlyy.service.app.health;
|
|
package com.yihu.wlyy.service.app.health;
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
|
import com.yihu.wlyy.entity.patient.PatientHealthGuidance;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.PatientHealthGuidanceDao;
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.support.GenericBeanDefinition;
|
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.Sort;
|
|
import org.springframework.data.domain.Sort;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
|
import com.yihu.wlyy.entity.patient.PatientHealthGuidance;
|
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.PatientHealthGuidanceDao;
|
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 健康指导业务处理类
|
|
* 健康指导业务处理类
|
|
@ -42,6 +41,8 @@ public class PatientHealthGuidanceService extends BaseService {
|
|
private PatientHealthGuidanceDao patientHealthGuidanceDao;
|
|
private PatientHealthGuidanceDao patientHealthGuidanceDao;
|
|
@Autowired
|
|
@Autowired
|
|
SignFamilyDao signFamilyDao;
|
|
SignFamilyDao signFamilyDao;
|
|
|
|
@Autowired
|
|
|
|
JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
public JSONObject findById(Long id){
|
|
public JSONObject findById(Long id){
|
|
PatientHealthGuidance guidance = patientHealthGuidanceDao.findOne(id);
|
|
PatientHealthGuidance guidance = patientHealthGuidanceDao.findOne(id);
|
|
@ -63,6 +64,26 @@ public class PatientHealthGuidanceService extends BaseService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 更改健康指导阅读状态
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public void modifyStatus(String id,String type) {
|
|
|
|
if("1".equals(type)){
|
|
|
|
// 一键设置居民未读指导
|
|
|
|
String sql = "UPDATE wlyy_patient_health_guidance wphg " +
|
|
|
|
"SET wphg .read_status = 1 "+
|
|
|
|
"WHERE wphg.patient = ?";
|
|
|
|
jdbcTemplate.update(sql,id);
|
|
|
|
}else {
|
|
|
|
String sql = "UPDATE wlyy_patient_health_guidance wphg " +
|
|
|
|
"SET wphg .read_status = 1 " +
|
|
|
|
"WHERE wphg.id = ?";
|
|
|
|
jdbcTemplate.update(sql, id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 保存健康指导
|
|
* 保存健康指导
|
|
* @param guidance
|
|
* @param guidance
|
|
@ -213,11 +234,14 @@ public class PatientHealthGuidanceService extends BaseService {
|
|
if (temp == null || temp.length != 6) {
|
|
if (temp == null || temp.length != 6) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
// 控制返回内容50字以内
|
|
|
|
String content = temp[3].toString().substring(0,50);
|
|
JSONObject json = new JSONObject();
|
|
JSONObject json = new JSONObject();
|
|
json.put("name", temp[0]);
|
|
json.put("name", temp[0]);
|
|
json.put("photo", temp[1]);
|
|
json.put("photo", temp[1]);
|
|
json.put("id", temp[2]);
|
|
json.put("id", temp[2]);
|
|
json.put("content", temp[3]);
|
|
|
|
|
|
// json.put("content", temp[3]);
|
|
|
|
json.put("content", content);
|
|
json.put("czrq", DateUtil.dateToStrLong((Date) temp[4]));
|
|
json.put("czrq", DateUtil.dateToStrLong((Date) temp[4]));
|
|
json.put("level", temp[5]);
|
|
json.put("level", temp[5]);
|
|
array.put(json);
|
|
array.put(json);
|