|
@ -8,14 +8,18 @@ import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
|
|
|
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
|
|
|
import com.yihu.wlyy.service.app.statistics.StatisticsService;
|
|
|
import com.yihu.wlyy.service.quota.JobService;
|
|
|
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.http.MediaType;
|
|
|
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;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
@ -40,15 +44,17 @@ public class JobController extends BaseController {
|
|
|
private final QuartzHelper quartzHelper;
|
|
|
private final DoctorWorkTimeService workTimeService;
|
|
|
private final StatisticsService statisticsService;
|
|
|
private final JwPrescriptionService jwPrescriptionService;
|
|
|
|
|
|
@Autowired
|
|
|
public JobController(StatisticsService statisticsService, JobService jobService, StringRedisTemplate redisTemplate, DoctorWorkTimeService workTimeService, PatientDiseaseService diseaseService, QuartzHelper quartzHelper) {
|
|
|
public JobController(StatisticsService statisticsService, JobService jobService, StringRedisTemplate redisTemplate, DoctorWorkTimeService workTimeService, PatientDiseaseService diseaseService, QuartzHelper quartzHelper,JwPrescriptionService jwPrescriptionService) {
|
|
|
this.statisticsService = statisticsService;
|
|
|
this.jobService = jobService;
|
|
|
this.redisTemplate = redisTemplate;
|
|
|
this.workTimeService = workTimeService;
|
|
|
this.diseaseService = diseaseService;
|
|
|
this.quartzHelper = quartzHelper;
|
|
|
this.jwPrescriptionService = jwPrescriptionService;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -463,4 +469,56 @@ public class JobController extends BaseController {
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
*立即执行当天的慢病患者定标情况同步
|
|
|
*@author huangwenjie
|
|
|
*@date 2017/9/17 14:16
|
|
|
*/
|
|
|
@RequestMapping(value = "/executePatientDiseaseConditionSynJob", method = RequestMethod.POST)
|
|
|
@ApiOperation("立即执行当天的慢病患者定标情况同步")
|
|
|
public String executePatientDiseaseConditionSynJob() {
|
|
|
try {
|
|
|
quartzHelper.startNow(PatientDiseaseConditionSynJob.class, "PATIENT-DISEASE-CONDITION-SYN", null);
|
|
|
return write(200, "启动成功");
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*根据时间范围执行慢病患者定标情况同步
|
|
|
*@author huangwenjie
|
|
|
*@date 2017/9/17 14:16
|
|
|
*/
|
|
|
@RequestMapping(value = "/executePatientDiseaseConditionSynJobByTime", method = RequestMethod.POST)
|
|
|
@ApiOperation("根据时间范围执行慢病患者定标情况同步")
|
|
|
public String executePatientDiseaseConditionSynJobByTime(
|
|
|
@ApiParam(name="startdate", value="开始时间:yyyy-mm-dd")
|
|
|
@RequestParam(value = "startdate",required = true) String startdate,
|
|
|
@ApiParam(name="enddate", value="结束时间:yyyy-mm-dd")
|
|
|
@RequestParam(value = "enddate",required = true) String enddate) {
|
|
|
try {
|
|
|
|
|
|
String start = "";
|
|
|
String end = "";
|
|
|
|
|
|
do{
|
|
|
start = startdate + " 00:00:00";
|
|
|
end = startdate + " 23:59:59";
|
|
|
//根据起止时间查询家签慢病患者定标情况,并同步到本地数据库
|
|
|
jwPrescriptionService.getPatientDiseaseContentMapByTime(start,end);
|
|
|
|
|
|
startdate = DateUtil.getNextDay(startdate,1);
|
|
|
|
|
|
}while (!startdate.equals(enddate));
|
|
|
|
|
|
return write(200, "执行成功");
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
}
|