|
@ -65,21 +65,22 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
|
|
|
/**
|
|
|
* 单个提醒居民按钮
|
|
|
*
|
|
|
* @param patient
|
|
|
* @param doctor
|
|
|
*/
|
|
|
public Integer singleRemindPhyExam(String patient,String doctor){
|
|
|
List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(patient,1);
|
|
|
if(records!=null&&records.size()>0){
|
|
|
public Integer singleRemindPhyExam(String patient, String doctor) {
|
|
|
List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(patient, 1);
|
|
|
if (records != null && records.size() > 0) {
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
Doctor d = doctorDao.findByCode(doctor);
|
|
|
try{
|
|
|
sendSingleNotice(patient,d.getName());
|
|
|
}catch (Exception e){
|
|
|
try {
|
|
|
sendSingleNotice(patient, d.getName());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
logger.error("体检提醒失败"+e.getMessage());
|
|
|
logger.error("体检提醒失败" + e.getMessage());
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
@ -87,12 +88,13 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
|
|
|
/**
|
|
|
* 单个提醒居民按钮
|
|
|
*
|
|
|
* @param teamCode
|
|
|
* @param doctor
|
|
|
*/
|
|
|
public Integer remindPhyExams(Long teamCode,String doctor){
|
|
|
List<PatientTeamRemindRecord> records = patientTeamRemindRecordDao.findByAdminTeamCodeAndType(teamCode,1);
|
|
|
if(records!=null&&records.size()>0){
|
|
|
public Integer remindPhyExams(Long teamCode, String doctor) {
|
|
|
List<PatientTeamRemindRecord> records = patientTeamRemindRecordDao.findByAdminTeamCodeAndType(teamCode, 1);
|
|
|
if (records != null && records.size() > 0) {
|
|
|
return -1;
|
|
|
}
|
|
|
PatientTeamRemindRecord record = new PatientTeamRemindRecord();
|
|
@ -103,11 +105,11 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
patientTeamRemindRecordDao.save(record);
|
|
|
|
|
|
Doctor d = doctorDao.findByCode(doctor);
|
|
|
try{
|
|
|
sendBatchNotice(teamCode,d.getName(),record.getId());
|
|
|
}catch (Exception e){
|
|
|
try {
|
|
|
sendBatchNotice(teamCode, d.getName(), record.getId());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
logger.error("批量体检提醒失败"+e.getMessage());
|
|
|
logger.error("批量体检提醒失败" + e.getMessage());
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
@ -115,10 +117,11 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
|
|
|
/**
|
|
|
* 健康体检 是否显示批量提醒按钮
|
|
|
*
|
|
|
* @param teamCode
|
|
|
* @return
|
|
|
*/
|
|
|
public Integer isShowRemindBtns(long teamCode){
|
|
|
public Integer isShowRemindBtns(long teamCode) {
|
|
|
Integer re = 0;
|
|
|
List<Map<String, Object>> signList = new ArrayList<>();
|
|
|
String sql = "";
|
|
@ -137,10 +140,10 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
" from wlyy_sign_family s," +
|
|
|
" wlyy_old_people_physical_examination o" +
|
|
|
" WHERE s.admin_team_code=? and s.`status`>0 and s.idcard = o.id_card " +
|
|
|
" and o.medical_time>?)"+
|
|
|
" and o.medical_time>?)" +
|
|
|
" order by t1.openid desc,convert(t1.name using gbk) ";
|
|
|
|
|
|
args = new Object[]{teamCode,teamCode,DateUtil.getLastYear()};
|
|
|
args = new Object[]{teamCode, teamCode, DateUtil.getLastYear()};
|
|
|
signList = jdbcTemplate.queryForList(sql, args);
|
|
|
if (signList != null && signList.size() > 0) {
|
|
|
for (Map<String, Object> sign : signList) {
|
|
@ -148,13 +151,13 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
if (StringUtils.isEmpty(patient)) {
|
|
|
continue;
|
|
|
}
|
|
|
List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(patient,1);
|
|
|
if(records==null||records.size()==0){
|
|
|
List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(patient, 1);
|
|
|
if (records == null || records.size() == 0) {
|
|
|
re = 1;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
} else {
|
|
|
re = 1;
|
|
|
}
|
|
|
return re;
|
|
@ -162,6 +165,7 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
|
|
|
/**
|
|
|
* 获取65岁以上老年人1年内无体检记录列表
|
|
|
*
|
|
|
* @param teamCode
|
|
|
* @param page
|
|
|
* @param pagesize
|
|
@ -172,7 +176,7 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
|
|
|
Map<String, JSONObject> result = new TreeMap<>();
|
|
|
List<Map<String, Object>> signList = new ArrayList<>();
|
|
|
Map<String,Object> patientDeviceTypeMap = new HashMap<>();//用于存储患者设备绑定情况
|
|
|
Map<String, Object> patientDeviceTypeMap = new HashMap<>();//用于存储患者设备绑定情况
|
|
|
int start = page * pagesize;
|
|
|
String sql = "";
|
|
|
Object[] args = null;
|
|
@ -191,23 +195,23 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
" from wlyy_sign_family s," +
|
|
|
" wlyy_old_people_physical_examination o" +
|
|
|
" WHERE s.admin_team_code=? and s.`status`>0 and s.idcard = o.id_card " +
|
|
|
" and o.medical_time>?)"+
|
|
|
" and o.medical_time>?)" +
|
|
|
" order by t1.openid desc,convert(t1.name using gbk) ";
|
|
|
|
|
|
args = new Object[]{teamCode,teamCode,DateUtil.getLastYear()};
|
|
|
args = new Object[]{teamCode, teamCode, DateUtil.getLastYear()};
|
|
|
|
|
|
sql = sql + " limit " + start + "," + pagesize;
|
|
|
signList = jdbcTemplate.queryForList(sql, args);
|
|
|
|
|
|
//查询患者设备绑定情况
|
|
|
String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
|
|
|
List<Map<String,Object>> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql);
|
|
|
List<Map<String, Object>> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql);
|
|
|
|
|
|
if(!patientCodeDeviceTypes.isEmpty()){
|
|
|
for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
|
|
|
if (!patientCodeDeviceTypes.isEmpty()) {
|
|
|
for (Map<String, Object> patientCodeDeviceType : patientCodeDeviceTypes) {
|
|
|
String user = String.valueOf(patientCodeDeviceType.get("user"));
|
|
|
String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
|
|
|
patientDeviceTypeMap.put(user,sum);
|
|
|
patientDeviceTypeMap.put(user, sum);
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -273,17 +277,17 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
}
|
|
|
|
|
|
//病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
|
|
|
json.put("disease",p.getDisease());
|
|
|
json.put("disease", p.getDisease());
|
|
|
// 病情:0绿标,1黄标,2红标,
|
|
|
json.put("diseaseCondition",p.getDiseaseCondition());
|
|
|
json.put("diseaseCondition", p.getDiseaseCondition());
|
|
|
//预警状态
|
|
|
json.put("standardStatus",p.getStandardStatus());
|
|
|
json.put("standardStatus", p.getStandardStatus());
|
|
|
//设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
|
|
|
String deviceType = "";
|
|
|
if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
|
|
|
if (!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())) {
|
|
|
deviceType = (String) patientDeviceTypeMap.get(p.getCode());
|
|
|
}
|
|
|
json.put("deviceType",deviceType);
|
|
|
json.put("deviceType", deviceType);
|
|
|
|
|
|
|
|
|
boolean epTime = false;
|
|
@ -298,10 +302,10 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
json.put("wechatFocusRemind", 1);
|
|
|
}
|
|
|
// 7天提醒标志
|
|
|
List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(p.getCode(),1);
|
|
|
if(records!=null&&records.size()>0){
|
|
|
List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(p.getCode(), 1);
|
|
|
if (records != null && records.size() > 0) {
|
|
|
json.put("physicalExamRemind", 1);//7天内已提醒
|
|
|
}else {
|
|
|
} else {
|
|
|
json.put("physicalExamRemind", 0);
|
|
|
}
|
|
|
|
|
@ -380,8 +384,8 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
// 微信发送失败发送短信
|
|
|
if (flag&&StringUtils.isNotEmpty(mobile)){
|
|
|
smsService.sendMsg(mobile,"您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~");
|
|
|
if (flag && StringUtils.isNotEmpty(mobile)) {
|
|
|
smsService.sendMsg(mobile, "您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~");
|
|
|
}
|
|
|
|
|
|
//保存发送提醒
|
|
@ -397,12 +401,12 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
/**
|
|
|
* 发送批量提醒
|
|
|
*
|
|
|
* @param teamId 团队ID
|
|
|
* @param teamId 团队ID
|
|
|
* @param doctName 医生姓名
|
|
|
* @return
|
|
|
*/
|
|
|
@Async
|
|
|
public void sendBatchNotice(long teamId, String doctName,Long remindId) throws Exception {
|
|
|
public void sendBatchNotice(long teamId, String doctName, Long remindId) throws Exception {
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
String accessToken = accessTokenUtils.getAccessToken();
|
|
|
Boolean flag = true;
|
|
@ -441,12 +445,19 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 微信发送失败发送短信
|
|
|
// 微信发送失败发送短信
|
|
|
if (flag && StringUtils.isNotEmpty(mobile)) {
|
|
|
smsService.sendMsg(mobile, "您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~");
|
|
|
}
|
|
|
flag = true;
|
|
|
|
|
|
//保存发送提醒
|
|
|
PatientRemindRecords patientRemindRecord = new PatientRemindRecords();
|
|
|
patientRemindRecord.setCode(getCode());
|
|
|
patientRemindRecord.setCreateTime(new Date());
|
|
|
patientRemindRecord.setPatientCode(patient.getCode());
|
|
|
patientRemindRecord.setRemindTime(new Date());
|
|
|
patientRemindRecord.setType(1);
|
|
|
patientRemindRecordsDao.save(patientRemindRecord);
|
|
|
}
|
|
|
|
|
|
//更新提醒状态
|