|
@@ -5,23 +5,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
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.dao.his.querydata.TCovidVaccinateAppointmentMapper;
|
|
|
+import thyyxxk.webserver.constants.Capacity;
|
|
|
+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;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -33,20 +29,25 @@ import java.util.Map;
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
-public class TCovidVaccinateAppointmentService {
|
|
|
- private final TCovidVaccinateAppointmentMapper dao;
|
|
|
+public class CovidVaccinateAppointmentService {
|
|
|
+ private final CovidVaccinateAppointmentMapper dao;
|
|
|
|
|
|
- private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
- public TCovidVaccinateAppointmentService(TCovidVaccinateAppointmentMapper dao) {
|
|
|
+ public CovidVaccinateAppointmentService(CovidVaccinateAppointmentMapper dao) {
|
|
|
this.dao = dao;
|
|
|
}
|
|
|
|
|
|
- public ResultVo<Map<String,Object>> queryXGYM(TCovidVaccinateAppointment data){
|
|
|
+ /**
|
|
|
+ * 通过日期区间或者预约的姓名 来查找到数据 分页查询
|
|
|
+ * @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"): "");
|
|
|
IPage<TCovidVaccinateAppointment> page = getQueryPage(data);
|
|
|
- Map map = new HashMap();
|
|
|
+ Map<String, Object> map = new HashMap<>(Capacity.TWO);
|
|
|
if (page.getTotal()>0 || page.getRecords().size()>0){
|
|
|
map.put("total",page.getTotal());
|
|
|
map.put("data",page.getRecords());
|
|
@@ -55,9 +56,14 @@ public class TCovidVaccinateAppointmentService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询近七日的预约人数 如果没有指定的日期就插入一条
|
|
|
+ * @return 指定数据
|
|
|
+ * */
|
|
|
+ static final int GET_DATE_SECTION = 7;
|
|
|
public ResultVo<List<TcovidVaccinateThreshold>> queryCount() throws ParseException {
|
|
|
- for(int i =1;i<=7;i++){
|
|
|
- Date date =sdf.parse(DateUtil.getOffsetDate(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));
|
|
|
log.info("日期为:{}的没有插入",DateUtil.getOffsetDate(i));
|
|
@@ -67,16 +73,26 @@ public class TCovidVaccinateAppointmentService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改指定日期的人数
|
|
|
+ * @param modificationDate 原本阈值人数
|
|
|
+ * @param newRevisionDate 设置阈值人数
|
|
|
+ * @param date 阈值日期
|
|
|
+ * @return 返回符合的数据
|
|
|
+ * */
|
|
|
public ResultVo<Boolean> update(int modificationDate, Date date, int newRevisionDate){
|
|
|
- String oldDate = sdf.format(date);
|
|
|
log.info("修改疫苗预约人数=>操作员:{},修改的日期为:{},限制人数为:{},原本的人数为:{}",
|
|
|
- TokenUtil.getTokenUserId(),oldDate,newRevisionDate,modificationDate);
|
|
|
- return ResultVoUtil.success(dao.update(newRevisionDate,oldDate));
|
|
|
+ TokenUtil.getTokenUserId(),SDF.format(date),newRevisionDate,modificationDate);
|
|
|
+ return ResultVoUtil.success(dao.update(newRevisionDate,SDF.format(date)));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询指定的数据然后导出
|
|
|
+ * @param response 返回数据
|
|
|
+ * @param param name姓名 ExecuteDate预约时间 currentPage=1 PageSize=-1 这样写才能导出全部的数据
|
|
|
+ * */
|
|
|
public void exportExcel(HttpServletResponse response, TCovidVaccinateAppointment param) {
|
|
|
log.info("导出新冠疫苗excel: {}", JSON.toJSONString(param));
|
|
|
-
|
|
|
IPage<TCovidVaccinateAppointment> page = getQueryPage(param);
|
|
|
List<TCovidVaccinateAppointment> list = page.getRecords();
|
|
|
String[] title = {"门诊id","姓名","性别","联系电话","身份证号","年龄","工作单位","工作性质","预约接种时间"};
|
|
@@ -86,7 +102,7 @@ public class TCovidVaccinateAppointmentService {
|
|
|
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());
|
|
@@ -98,12 +114,15 @@ public class TCovidVaccinateAppointmentService {
|
|
|
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<>();
|
|
|
- Map map = new HashMap();
|
|
|
- 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 ){
|