Ver código fonte

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

wujunjie 7 anos atrás
pai
commit
d3e1269df7

+ 3 - 3
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientTeamRemindRecord.java

@ -15,16 +15,16 @@ import java.util.Date;
@Table(name = "wlyy_patient_team_remind_record")
public class PatientTeamRemindRecord extends IdEntity implements Serializable  {
   private Integer adminTeamCode;//'行政团队code',
   private Long adminTeamCode;//'行政团队code',
   private Integer type;//类型1老年人体检提醒,2儿童免疫接种提醒
   private Integer status;//状态0未发送 1已发送
   private Date createTime;
    public Integer getAdminTeamCode() {
    public Long getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(Integer adminTeamCode) {
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }

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

@ -13,5 +13,5 @@ import java.util.List;
public interface PatientTeamRemindRecordDao extends PagingAndSortingRepository<PatientTeamRemindRecord, Long>, JpaSpecificationExecutor<PatientTeamRemindRecord> {
    @Query("select a from PatientTeamRemindRecord a where a.adminTeamCode = ?1 and a.type=?2 and a.status=0 ")
    List<PatientTeamRemindRecord> findByAdminTeamCodeAndType(Integer adminTeamCode, Integer type);
    List<PatientTeamRemindRecord> findByAdminTeamCodeAndType(Long adminTeamCode, Integer type);
}

+ 0 - 243
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -71,8 +71,6 @@ public class SignPatientLabelInfoService extends BaseService {
    SignFamilyRenewDao signFamilyRenewDao;
    @Autowired
    SignPatientLabelInfoDao signPatientLabelInfoDao;
    @Autowired
    private PatientRemindRecordsDao patientRemindRecordsDao;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ -3913,247 +3911,6 @@ public class SignPatientLabelInfoService extends BaseService {
        }
    }
    /**
     * 单个提醒居民按钮
     * @param patient
     * @param doctor
     */
    public void singleRemindPhyExam(String patient,String doctor){
    }
    /**
     * 单个提醒居民按钮
     * @param teamCode
     * @param doctor
     */
    public void remindPhyExams(Long teamCode,String doctor){
    }
    /**
     * 健康体检 是否显示批量提醒按钮
     * @param teamCode
     * @return
     */
    public Integer isShowRemindBtns(long teamCode){
        Integer re = 0;
        List<Map<String, Object>> signList = new ArrayList<>();
        String sql = "";
        Object[] args = null;
        sql = "SELECT " +
                "    DISTINCT t1.* " +
                " FROM " +
                "    wlyy_sign_family t1 " +
                " WHERE " +
                "     t1.status > 0 " +
                "    AND t1.admin_team_code = ? " +
                "    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.admin_team_code=? and s.`status`>0 and s.idcard = o.id_card " +
                "                 and o.medical_time>?)"+
                " order by t1.openid desc,convert(t1.name using gbk) ";
        args = new Object[]{teamCode,teamCode,DateUtil.getLastYear()};
        signList = jdbcTemplate.queryForList(sql, args);
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                String patient = sign.get("patient") == null ? "" : sign.get("patient").toString();
                if (StringUtils.isEmpty(patient)) {
                    continue;
                }
                List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(patient,1);
                if(records==null||records.size()==0){
                    re = 1;
                    break;
                }
            }
        }else{
            re = 1;
        }
        return re;
    }
    /**
     * 获取65岁以上老年人1年内无体检记录列表
     * @param teamCode
     * @param page
     * @param pagesize
     * @return
     * @throws Exception
     */
    public JSONArray getOldPatientByTeamCode(long teamCode, int page, int pagesize) throws Exception {
        Map<String, JSONObject> result = new TreeMap<>();
        List<Map<String, Object>> signList = new ArrayList<>();
        Map<String,Object> patientDeviceTypeMap = new HashMap<>();//用于存储患者设备绑定情况
        int start = page * pagesize;
        String sql = "";
        Object[] args = null;
        //标签类别为空的时候
        sql = "SELECT " +
                "    DISTINCT t1.* " +
                " FROM " +
                "    wlyy_sign_family t1 " +
                " WHERE " +
                "     t1.status > 0 " +
                "    AND t1.admin_team_code = ? " +
                "    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.admin_team_code=? and s.`status`>0 and s.idcard = o.id_card " +
                "                 and o.medical_time>?)"+
                " order by t1.openid desc,convert(t1.name using gbk) ";
        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);
        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);
            }
        }
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                if (p == null) {
                    continue;
                }
                JSONObject json = new JSONObject();
                // 设置患者标识
                json.put("code", p.getCode());
                // 设置患者姓名
                json.put("name", p.getName());
                // 设置患者手机号
                json.put("mobile", p.getMobile());
                // 设置患者微信openid
                json.put("openid", StringUtils.isNotEmpty(p.getOpenid()) ? p.getOpenid() : "");
                // 设置患者联系电话
                json.put("phone", p.getPhone());
                // 设置患者紧急联系人
                json.put("emerMobile", sign.get("emer_mobile") == null ? "" : String.valueOf(sign.get("emer_mobile")));
                // 设置患者头像
                json.put("photo", p.getPhoto());
                // 设置患者年龄
                json.put("age", IdCardUtil.getAgeForIdcard(p.getIdcard()));
                // 设置患者性别
                json.put("sex", p.getSex());
                // 设置签约日期
                json.put("qyrq", sign.get("apply_date") != null ? DateUtil.dateToStr((Date) sign.get("apply_date"), DateUtil.YYYY_MM_DD) : "");
                // 设置签约类型
                json.put("signType", sign.get("type") == null ? "" : sign.get("type"));
                // 身份证号
                json.put("idcard", p.getIdcard());
                // 社保号
                json.put("ssc", p.getSsc());
                if (String.valueOf(sign.get("type")).equals("2")) {
                    // 缴费情况
                    json.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")) : "0");
                    // 缴费时间
                    json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                    // 缴费类型
                    json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
                    if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                        boolean epTime = false;
                        try {
                            epTime = redisTemplate.opsForSet().isMember("expenses:remind:set", p.getCode());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (!epTime) {
                            json.put("expensesRemindStatus", 0);
                        } else {
                            json.put("expensesRemindStatus", 1);
                        }
                    }
                } else {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                String deviceType = "";
                if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
                }
                json.put("deviceType",deviceType);
                boolean epTime = false;
                try {
                    epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (!epTime) {
                    json.put("wechatFocusRemind", 0);
                } else {
                    json.put("wechatFocusRemind", 1);
                }
                // 7天提醒标志
                List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(p.getCode(),1);
                if(records!=null&&records.size()>0){
                    json.put("physicalExamRemind", 1);//7天内已提醒
                }else {
                    json.put("physicalExamRemind", 0);
                }
                result.put(p.getCode(), json);
            }
        }
        if (result.size() > 0) {
            List<JSONObject> list = Lists.newArrayList(result.values());
            Collections.sort(list, new Comparator<JSONObject>() {
                @Override
                public int compare(JSONObject o1, JSONObject o2) {
                    //微信綁定情況
                    String openid1 = o1.has("openid") ? o1.getString("openid") : "";
                    String openid2 = o2.has("openid") ? o2.getString("openid") : "";
                    int re = openid1.compareTo(openid2);
                    if (re > 0) {
                        return -1;
                    } else if (re < 0) {
                        return 1;
                    } else {
                        return 0;
                    }
                }
            });
            return new JSONArray(list);
        } else {
            return new JSONArray();
        }
    }
    /**
     * 获取医生所有团队的所有居民

+ 309 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExaminationRemindService.java

@ -1,11 +1,19 @@
package com.yihu.wlyy.service.app.physicalExamination;
import com.google.common.collect.Lists;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientRemindRecords;
import com.yihu.wlyy.entity.patient.PatientTeamRemindRecord;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientRemindRecordsDao;
import com.yihu.wlyy.repository.patient.PatientTeamRemindRecordDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.lang3.StringUtils;
@ -15,11 +23,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
 * Created by Reece on 2017/10/19/019.
@ -41,6 +52,289 @@ public class PhysicalExaminationRemindService extends BaseService {
    private WeiXinAccessTokenUtils accessTokenUtils;
    @Autowired
    private WeiXinOpenIdUtils openIdUtils;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private PatientRemindRecordsDao patientRemindRecordsDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private PatientTeamRemindRecordDao patientTeamRemindRecordDao;
    /**
     * 单个提醒居民按钮
     * @param patient
     * @param doctor
     */
    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){
            e.printStackTrace();
            logger.error("体检提醒失败"+e.getMessage());
        }
        return 0;
    }
    /**
     * 单个提醒居民按钮
     * @param teamCode
     * @param doctor
     */
    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();
        record.setType(1);
        record.setCreateTime(new Date());
        record.setStatus(0);
        record.setAdminTeamCode(teamCode);
        patientTeamRemindRecordDao.save(record);
        Doctor d = doctorDao.findByCode(doctor);
        try{
            sendBatchNotice(teamCode,d.getName(),record.getId());
        }catch (Exception e){
            e.printStackTrace();
            logger.error("批量体检提醒失败"+e.getMessage());
        }
        return 0;
    }
    /**
     * 健康体检 是否显示批量提醒按钮
     * @param teamCode
     * @return
     */
    public Integer isShowRemindBtns(long teamCode){
        Integer re = 0;
        List<Map<String, Object>> signList = new ArrayList<>();
        String sql = "";
        Object[] args = null;
        sql = "SELECT " +
                "    DISTINCT t1.* " +
                " FROM " +
                "    wlyy_sign_family t1 " +
                " WHERE " +
                "     t1.status > 0 " +
                "    AND t1.admin_team_code = ? " +
                "    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.admin_team_code=? and s.`status`>0 and s.idcard = o.id_card " +
                "                 and o.medical_time>?)"+
                " order by t1.openid desc,convert(t1.name using gbk) ";
        args = new Object[]{teamCode,teamCode,DateUtil.getLastYear()};
        signList = jdbcTemplate.queryForList(sql, args);
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                String patient = sign.get("patient") == null ? "" : sign.get("patient").toString();
                if (StringUtils.isEmpty(patient)) {
                    continue;
                }
                List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(patient,1);
                if(records==null||records.size()==0){
                    re = 1;
                    break;
                }
            }
        }else{
            re = 1;
        }
        return re;
    }
    /**
     * 获取65岁以上老年人1年内无体检记录列表
     * @param teamCode
     * @param page
     * @param pagesize
     * @return
     * @throws Exception
     */
    public JSONArray getOldPatientByTeamCode(long teamCode, int page, int pagesize) throws Exception {
        Map<String, JSONObject> result = new TreeMap<>();
        List<Map<String, Object>> signList = new ArrayList<>();
        Map<String,Object> patientDeviceTypeMap = new HashMap<>();//用于存储患者设备绑定情况
        int start = page * pagesize;
        String sql = "";
        Object[] args = null;
        //标签类别为空的时候
        sql = "SELECT " +
                "    DISTINCT t1.* " +
                " FROM " +
                "    wlyy_sign_family t1 " +
                " WHERE " +
                "     t1.status > 0 " +
                "    AND t1.admin_team_code = ? " +
                "    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.admin_team_code=? and s.`status`>0 and s.idcard = o.id_card " +
                "                 and o.medical_time>?)"+
                " order by t1.openid desc,convert(t1.name using gbk) ";
        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);
        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);
            }
        }
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                if (p == null) {
                    continue;
                }
                JSONObject json = new JSONObject();
                // 设置患者标识
                json.put("code", p.getCode());
                // 设置患者姓名
                json.put("name", p.getName());
                // 设置患者手机号
                json.put("mobile", p.getMobile());
                // 设置患者微信openid
                json.put("openid", StringUtils.isNotEmpty(p.getOpenid()) ? p.getOpenid() : "");
                // 设置患者联系电话
                json.put("phone", p.getPhone());
                // 设置患者紧急联系人
                json.put("emerMobile", sign.get("emer_mobile") == null ? "" : String.valueOf(sign.get("emer_mobile")));
                // 设置患者头像
                json.put("photo", p.getPhoto());
                // 设置患者年龄
                json.put("age", IdCardUtil.getAgeForIdcard(p.getIdcard()));
                // 设置患者性别
                json.put("sex", p.getSex());
                // 设置签约日期
                json.put("qyrq", sign.get("apply_date") != null ? DateUtil.dateToStr((Date) sign.get("apply_date"), DateUtil.YYYY_MM_DD) : "");
                // 设置签约类型
                json.put("signType", sign.get("type") == null ? "" : sign.get("type"));
                // 身份证号
                json.put("idcard", p.getIdcard());
                // 社保号
                json.put("ssc", p.getSsc());
                if (String.valueOf(sign.get("type")).equals("2")) {
                    // 缴费情况
                    json.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")) : "0");
                    // 缴费时间
                    json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                    // 缴费类型
                    json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
                    if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                        boolean epTime = false;
                        try {
                            epTime = redisTemplate.opsForSet().isMember("expenses:remind:set", p.getCode());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (!epTime) {
                            json.put("expensesRemindStatus", 0);
                        } else {
                            json.put("expensesRemindStatus", 1);
                        }
                    }
                } else {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                String deviceType = "";
                if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
                }
                json.put("deviceType",deviceType);
                boolean epTime = false;
                try {
                    epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (!epTime) {
                    json.put("wechatFocusRemind", 0);
                } else {
                    json.put("wechatFocusRemind", 1);
                }
                // 7天提醒标志
                List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(p.getCode(),1);
                if(records!=null&&records.size()>0){
                    json.put("physicalExamRemind", 1);//7天内已提醒
                }else {
                    json.put("physicalExamRemind", 0);
                }
                result.put(p.getCode(), json);
            }
        }
        if (result.size() > 0) {
            List<JSONObject> list = Lists.newArrayList(result.values());
            Collections.sort(list, new Comparator<JSONObject>() {
                @Override
                public int compare(JSONObject o1, JSONObject o2) {
                    //微信綁定情況
                    String openid1 = o1.has("openid") ? o1.getString("openid") : "";
                    String openid2 = o2.has("openid") ? o2.getString("openid") : "";
                    int re = openid1.compareTo(openid2);
                    if (re > 0) {
                        return -1;
                    } else if (re < 0) {
                        return 1;
                    } else {
                        return 0;
                    }
                }
            });
            return new JSONArray(list);
        } else {
            return new JSONArray();
        }
    }
    /**
     * 发送单条提醒
@ -89,6 +383,15 @@ public class PhysicalExaminationRemindService extends BaseService {
        if (flag&&StringUtils.isNotEmpty(mobile)){
            smsService.sendMsg(mobile,"您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~");
        }
        //保存发送提醒
        PatientRemindRecords patientRemindRecord = new PatientRemindRecords();
        patientRemindRecord.setCode(getCode());
        patientRemindRecord.setCreateTime(new Date());
        patientRemindRecord.setPatientCode(userCode);
        patientRemindRecord.setRemindTime(new Date());
        patientRemindRecord.setType(1);
        patientRemindRecordsDao.save(patientRemindRecord);
    }
    /**
@ -99,7 +402,7 @@ public class PhysicalExaminationRemindService extends BaseService {
     * @return
     */
    @Async
    public void sendBatchNotice(long teamId, String doctName) 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;
@ -145,5 +448,10 @@ public class PhysicalExaminationRemindService extends BaseService {
            flag = true;
        }
        //更新提醒状态
        PatientTeamRemindRecord record = patientTeamRemindRecordDao.findOne(remindId);
        record.setStatus(1);
        patientTeamRemindRecordDao.save(record);
    }
}

+ 84 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PyhsicExamRemindController.java

@ -0,0 +1,84 @@
package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.service.app.physicalExamination.PhysicalExaminationRemindService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by yeshijie on 2017/10/20.
 */
@RestController
@RequestMapping(value = "/doctor/patient_label_info", method = {RequestMethod.GET, RequestMethod.POST})
@Api(description = "居民标签管理")
public class PyhsicExamRemindController extends BaseController{
    @Autowired
    private PhysicalExaminationRemindService physicalExaminationRemindService;
    @RequestMapping(value = "getOldPatientByTeamCode", method = RequestMethod.GET)
    @ApiOperation("一年内无体检记录的65岁及以上老年居民")
    public String getOldPatientByTeamCode(@ApiParam(name = "adminTeamCode", value = "行政团队编码", defaultValue = "644")
                                          @RequestParam(value = "adminTeamCode", required = true) Long adminTeamCode,
                                          @ApiParam(name = "page", value = "第几页", defaultValue = "0")
                                          @RequestParam(value = "page", required = false) Integer page,
                                          @ApiParam(name = "pagesize", value = "分页大小", defaultValue = "10")
                                          @RequestParam(value = "pagesize", required = false) Integer pagesize){
        try {
            page = page==null?0:page;
            pagesize = pagesize==null?10:pagesize;
            JSONArray list = physicalExaminationRemindService.getOldPatientByTeamCode(adminTeamCode,page,pagesize);
            return write(200, "查询成功", "data", list);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "isShowRemindBtns", method = RequestMethod.GET)
    @ApiOperation("是否显示批量提醒按钮")
    public String isShowRemindBtns(@ApiParam(name = "adminTeamCode", value = "行政团队编码", defaultValue = "644")
                                   @RequestParam(value = "adminTeamCode", required = true) Long adminTeamCode){
        try {
            Integer re = physicalExaminationRemindService.isShowRemindBtns(adminTeamCode);
            return write(200, "查询成功", "data", re);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "singleRemindPhyExam", method = RequestMethod.POST)
    @ApiOperation("单个提醒居民")
    public String singleRemindPhyExam(@ApiParam(name = "patient", value = "居民code", defaultValue = "644")
                                      @RequestParam(value = "patient", required = true) String patient){
        try {
            physicalExaminationRemindService.singleRemindPhyExam(patient,getUID());
            return success("提醒成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "remindPhyExams", method = RequestMethod.POST)
    @ApiOperation("批量提醒居民")
    public String remindPhyExams(@ApiParam(name = "adminTeamCode", value = "行政团队编码", defaultValue = "644")
                                 @RequestParam(value = "adminTeamCode", required = true) Long adminTeamCode){
        try {
            physicalExaminationRemindService.remindPhyExams(adminTeamCode,getUID());
            return success("提醒成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
}

+ 0 - 63
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -871,67 +871,4 @@ public class SignPatientLabelInfoController extends BaseController {
        }
    }
    @RequestMapping(value = "getOldPatientByTeamCode", method = RequestMethod.GET)
    @ApiOperation("一年内无体检记录的65岁及以上老年居民")
    public String getOldPatientByTeamCode(@ApiParam(name = "adminTeamCode", value = "行政团队编码", defaultValue = "644")
                                          @RequestParam(value = "adminTeamCode", required = true) Long adminTeamCode,
                                          @ApiParam(name = "page", value = "第几页", defaultValue = "0")
                                          @RequestParam(value = "page", required = false) Integer page,
                                          @ApiParam(name = "pagesize", value = "分页大小", defaultValue = "10")
                                          @RequestParam(value = "pagesize", required = false) Integer pagesize){
        try {
            page = page==null?0:page;
            pagesize = pagesize==null?15:pagesize;
            JSONArray list = signPatientLabelService.getOldPatientByTeamCode(adminTeamCode,page,pagesize);
            Integer re = signPatientLabelService.isShowRemindBtns(adminTeamCode);
            JSONObject json = new JSONObject();
            json.put("list",list);
            json.put("status",re);
            return write(200, "查询成功", "data", json);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "isShowRemindBtns", method = RequestMethod.GET)
    @ApiOperation("是否显示批量提醒按钮")
    public String isShowRemindBtns(@ApiParam(name = "adminTeamCode", value = "行政团队编码", defaultValue = "644")
                                          @RequestParam(value = "adminTeamCode", required = true) Long adminTeamCode){
        try {
            Integer re = signPatientLabelService.isShowRemindBtns(adminTeamCode);
            return write(200, "查询成功", "data", re);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "singleRemindPhyExam", method = RequestMethod.POST)
    @ApiOperation("单个提醒居民")
    public String singleRemindPhyExam(@ApiParam(name = "patient", value = "居民code", defaultValue = "644")
                                      @RequestParam(value = "patient", required = true) String patient){
        try {
            signPatientLabelService.singleRemindPhyExam(patient,getUID());
            return success("提醒成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "remindPhyExams", method = RequestMethod.POST)
    @ApiOperation("批量提醒居民")
    public String remindPhyExams(@ApiParam(name = "adminTeamCode", value = "行政团队编码", defaultValue = "644")
                                 @RequestParam(value = "adminTeamCode", required = true) Long adminTeamCode){
        try {
            signPatientLabelService.remindPhyExams(adminTeamCode,getUID());
            return success("提醒成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
}