Browse Source

代码修改

yeshijie 7 years ago
parent
commit
57ca76432f

+ 59 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExamTeamRemindService.java

@ -0,0 +1,59 @@
package com.yihu.wlyy.service.app.physicalExamination;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.PatientTeamRemindRecord;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientTeamRemindRecordDao;
import com.yihu.wlyy.service.BaseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
 * Created by yeshijie on 2017/10/20.
 */
@Service
public class PhysicalExamTeamRemindService extends BaseService{
    private Logger logger = LoggerFactory.getLogger(PhysicalExamTeamRemindService.class);
    @Autowired
    private PhysicalExaminationRemindService remindService;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private PatientTeamRemindRecordDao patientTeamRemindRecordDao;
    /**
     * 发送批量提醒
     *
     * @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 {
            remindService.sendBatchNotice(teamCode, d.getName(), record.getId());
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("批量体检提醒失败" + e.getMessage());
        }
        return 0;
    }
}

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

@ -22,14 +22,12 @@ import org.json.JSONObject;
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.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
@ -86,35 +84,6 @@ public class PhysicalExaminationRemindService extends BaseService {
        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;
    }
    /**
     * 健康体检 是否显示批量提醒按钮
     *

+ 16 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PyhsicExamRemindController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.service.app.physicalExamination.PhysicalExamTeamRemindService;
import com.yihu.wlyy.service.app.physicalExamination.PhysicalExaminationRemindService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -16,12 +17,14 @@ 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 = "居民标签管理")
@RequestMapping(value = "/doctor/patient_label_info")
@Api(description = "老年人健康体检提醒")
public class PyhsicExamRemindController extends BaseController{
    @Autowired
    private PhysicalExaminationRemindService physicalExaminationRemindService;
    @Autowired
    private PhysicalExamTeamRemindService physicalExamTeamRemindService;
    @RequestMapping(value = "getOldPatientByTeamCode", method = RequestMethod.GET)
@ -45,7 +48,7 @@ public class PyhsicExamRemindController extends BaseController{
    @RequestMapping(value = "isShowRemindBtns", method = RequestMethod.GET)
    @ApiOperation("是否显示批量提醒按钮")
    public String isShowRemindBtns(@ApiParam(name = "adminTeamCode", value = "行政团队编码", defaultValue = "644")
    public String isShowRemindBtns(@ApiParam(name = "adminTeamCode", value = "行政团队编码", defaultValue = "485")
                                   @RequestParam(value = "adminTeamCode", required = true) Long adminTeamCode){
        try {
            Integer re = physicalExaminationRemindService.isShowRemindBtns(adminTeamCode);
@ -61,7 +64,11 @@ public class PyhsicExamRemindController extends BaseController{
    public String singleRemindPhyExam(@ApiParam(name = "patient", value = "居民code", defaultValue = "644")
                                      @RequestParam(value = "patient", required = true) String patient){
        try {
            physicalExaminationRemindService.singleRemindPhyExam(patient,getUID());
            Integer re = physicalExaminationRemindService.singleRemindPhyExam(patient,getUID());
//            Integer re = physicalExaminationRemindService.singleRemindPhyExam(patient,"3782f16386f211e6b394fa163e424525");
            if(re==-1){
                return error(-1, "7天内已提醒过该居民,请不要重复提醒");
            }
            return success("提醒成功");
        } catch (Exception e) {
            e.printStackTrace();
@ -74,7 +81,11 @@ public class PyhsicExamRemindController extends BaseController{
    public String remindPhyExams(@ApiParam(name = "adminTeamCode", value = "行政团队编码", defaultValue = "644")
                                 @RequestParam(value = "adminTeamCode", required = true) Long adminTeamCode){
        try {
            physicalExaminationRemindService.remindPhyExams(adminTeamCode,getUID());
          Integer re =  physicalExamTeamRemindService.remindPhyExams(adminTeamCode,getUID());
//            Integer re = physicalExamTeamRemindService.remindPhyExams(adminTeamCode,"3782f16386f211e6b394fa163e424525");
            if(re==-1){
                return error(-1, "正在发送提醒,请不要重复操作");
            }
            return success("提醒成功");
        } catch (Exception e) {
            e.printStackTrace();