|
@@ -4,17 +4,14 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.sun.corba.se.spi.ior.ObjectKey;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.omg.PortableServer.POAPackage.InvalidPolicy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.constants.Capacity;
|
|
|
-import thyyxxk.webserver.dao.his.querydata.TCovidVaccinateAppointmentMapper;
|
|
|
+import thyyxxk.webserver.dao.his.querydata.CovidVaccinateAppointmentMapper;
|
|
|
import thyyxxk.webserver.pojo.ResultVo;
|
|
|
import thyyxxk.webserver.pojo.querydata.TCovidVaccinateAppointment;
|
|
|
import thyyxxk.webserver.pojo.querydata.TcovidVaccinateThreshold;
|
|
|
-import thyyxxk.webserver.pojo.wxapi.QueryWxOrderParam;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -33,14 +30,20 @@ import java.util.*;
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class CovidVaccinateAppointmentService {
|
|
|
- private final TCovidVaccinateAppointmentMapper dao;
|
|
|
+ private final CovidVaccinateAppointmentMapper dao;
|
|
|
+ private final Integer GET_DATE_SECTION = 7;
|
|
|
|
|
|
private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
- public CovidVaccinateAppointmentService(TCovidVaccinateAppointmentMapper dao) {
|
|
|
+ public CovidVaccinateAppointmentService(CovidVaccinateAppointmentMapper dao) {
|
|
|
this.dao = dao;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 通过日期区间或者预约的姓名 来查找到数据 分页查询
|
|
|
+ * @param data name姓名 ExecuteDate预约时间 currentPage PageSize
|
|
|
+ * @return
|
|
|
+ * */
|
|
|
public ResultVo<Map<String,Object>> queryCovidVaccinateAppointment(TCovidVaccinateAppointment data){
|
|
|
log.info("查询新冠疫苗预约=>操作人:{},查找姓名:{},查找日期:{}", TokenUtil.getTokenUserId(),
|
|
|
data.getName(),data.getExecuteDate()!=null? DateUtil.formatDatetime(data.getExecuteDate(),"yyyy-MM-dd"): "");
|
|
@@ -54,8 +57,12 @@ public class CovidVaccinateAppointmentService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询近七日的预约人数 如果没有指定的日期就插入一条
|
|
|
+ * @return
|
|
|
+ * */
|
|
|
public ResultVo<List<TcovidVaccinateThreshold>> queryCount() throws ParseException {
|
|
|
- for(int i =1;i<=7;i++){
|
|
|
+ for(int i =1;i<=GET_DATE_SECTION;i++){
|
|
|
Date date =SDF.parse(DateUtil.getOffsetDate(i));
|
|
|
if (dao.maxDate().getTime()<date.getTime()){
|
|
|
dao.insertDate(DateUtil.getOffsetDate(i));
|
|
@@ -66,6 +73,13 @@ public class CovidVaccinateAppointmentService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改指定日期的人数
|
|
|
+ * @param modificationDate 原本阈值人数
|
|
|
+ * @param newRevisionDate 设置阈值人数
|
|
|
+ * @param date 阈值日期
|
|
|
+ * @return
|
|
|
+ * */
|
|
|
public ResultVo<Boolean> update(int modificationDate, Date date, int newRevisionDate){
|
|
|
String oldDate = SDF.format(date);
|
|
|
log.info("修改疫苗预约人数=>操作员:{},修改的日期为:{},限制人数为:{},原本的人数为:{}",
|
|
@@ -73,6 +87,12 @@ public class CovidVaccinateAppointmentService {
|
|
|
return ResultVoUtil.success(dao.update(newRevisionDate,oldDate));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询指定的数据然后导出
|
|
|
+ * @param response
|
|
|
+ * @param param name姓名 ExecuteDate预约时间 currentPage=1 PageSize=-1 这样写才能导出全部的数据
|
|
|
+ * @return
|
|
|
+ * */
|
|
|
public void exportExcel(HttpServletResponse response, TCovidVaccinateAppointment param) {
|
|
|
log.info("导出新冠疫苗excel: {}", JSON.toJSONString(param));
|
|
|
IPage<TCovidVaccinateAppointment> page = getQueryPage(param);
|
|
@@ -84,7 +104,7 @@ public class CovidVaccinateAppointmentService {
|
|
|
TCovidVaccinateAppointment tc = list.get(i);
|
|
|
content[i][0] = tc.getPatientId();
|
|
|
content[i][1] = tc.getName();
|
|
|
- content[i][2] = tc.getNewSex();
|
|
|
+ content[i][2] = tc.getSex()==1?"男":"女";
|
|
|
content[i][3] = tc.getPhone();
|
|
|
content[i][4] = tc.getSocialNo();
|
|
|
content[i][5] = String.valueOf(tc.getAge());
|
|
@@ -96,10 +116,15 @@ public class CovidVaccinateAppointmentService {
|
|
|
ExcelUtil.exportExcel(response, title, content);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *根据查询 名字或者预约时间 分页显示在页面中
|
|
|
+ * @param param 查询和分页的条件
|
|
|
+ * @return
|
|
|
+ * */
|
|
|
public IPage<TCovidVaccinateAppointment> getQueryPage(TCovidVaccinateAppointment param){
|
|
|
IPage<TCovidVaccinateAppointment> page = new Page<>(param.getCurrentPage(),param.getPageSize());
|
|
|
QueryWrapper<TCovidVaccinateAppointment> qw = new QueryWrapper<>();
|
|
|
- if (param.getName() != null && param.getName() !="" && !param.getName().equals("")){
|
|
|
+ if (param.getName() != null && !"".equals(param.getName())){
|
|
|
qw.eq("a.name",param.getName());
|
|
|
}
|
|
|
if (param.getExecuteDate() != null ){
|