فهرست منبع

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

yeshijie 8 سال پیش
والد
کامیت
07326e8674

+ 41 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/job/SignEndJob.java

@ -0,0 +1,41 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.service.app.followup.FollowUpService;
import com.yihu.wlyy.util.DateUtil;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.util.Calendar;
import java.util.Date;
/**
 * Created by lyr-pc on 2017/3/9.
 */
public class SignEndJob implements Job {
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            System.out.println("sign end job start");
            SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
            Calendar today = Calendar.getInstance();
            today.add(Calendar.DATE, -1);
            String date = DateUtil.dateToStrShort(today.getTime());
            String start = date + " 00:00:00";
            String end = date + " 23:59:59";
            String sql = "update wlyy_sign_family set status = -4 where end >= ? and end <= ? and status > 0";
            int sucess = jdbcTemplate.update(sql, start, end);
            System.out.println("sign end job end");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("sign end job failed");
        }
    }
}

+ 0 - 10
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/util/ManageUtilService.java

@ -536,15 +536,5 @@ public class ManageUtilService extends BaseService {
                    .replaceAll("&nbsp;", "").replaceAll(" ",""); //剔出<html>的标签
            article.setSummary(content.length() > 50 ? content.substring(0, 49) : content);
        }
        Iterable<HealthEduArticlePatient> articlesPatient = healthEduArticlePatientDao.findAll();
        for (HealthEduArticlePatient article : articlesPatient) {
            String content = article.getContent();
            content = content.replaceAll("</?[^>]+>", "")
                    .replaceAll("<a>\\s*|\t|\r|\n</a>", "")
                    .replaceAll("&nbsp;", "").replaceAll(" ",""); //剔出<html>的标签
            article.setSummary(content.length() > 50 ? content.substring(0, 49) : content);
        }
    }
}

+ 15 - 36
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.common.util;
import com.yihu.wlyy.job.QuartzHelper;
import com.yihu.wlyy.job.SignEndJob;
import com.yihu.wlyy.job.consult.FamousConsultTimesJob;
import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
@ -245,45 +246,23 @@ public class ManagerUtilController extends BaseController {
        }
    }
    @RequestMapping(value = "/patient")
    public String getPatientInfo() {
        try {
            OutputStream out = new FileOutputStream("D:\\city.properties");
            BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
            try {
                String sql = "select code, name from dm_city";
                List<Map<String, Object>> patients = jdbcTemplate.queryForList(sql);
                for (Map<String, Object> map : patients) {
                    writer.write(map.get("code").toString() + "=" + map.get("name").toString());
                    writer.newLine();
                }
//                JSONObject log = new JSONObject();
//
//                log.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()));
//                log.put("logType", 2);
//                log.put("caller", "");
//
//                JSONObject data = new JSONObject();
//
//                data.put("businessType", 6);
//                data.put("patient", map.get("code"));
//                data.put("data", new JSONObject(map));
//
//                log.put("data", data);
                writer.flush();
            } catch (Exception e) {
                throw new Exception(e.getMessage());
            } finally {
                writer.close();
                out.close();
    /**
     * 开始名医咨询剩余次数统计任务
     *
     * @return
     */
    @RequestMapping(value = "/start_sign_end_job")
    public String startSignEndJob() {
        try {
            if (!quartzHelper.isExistJob("sign_end_job")) {
                quartzHelper.addJob(SignEndJob.class, "0 45 10 * * ?", "sign_end_job", new HashMap<String, Object>());
                return write(200, "启动成功");
            } else {
                return write(200, "任务已存在");
            }
            return write(200, "成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "失败");
            return error(-1, "启动失败");
        }
    }
}