Browse Source

核酸检测记录后台管理

origin/feature/monitoring
Jackwang 4 years ago
parent
commit
ced19e3f5d
  1. 14
      epdc-cloud-custom/pom.xml
  2. 11
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/controller/PersonTestingController.java
  3. 7
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/dao/PersonTestingDao.java
  4. 52
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/excel/PersonTestingExcel.java
  5. 3
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/PersonTestingService.java
  6. 53
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/PersonTestingServiceImpl.java
  7. 12
      epdc-cloud-custom/src/main/resources/mapper/epidemic/PersonTestingDao.xml

14
epdc-cloud-custom/pom.xml

@ -197,10 +197,10 @@
<server.port>17040</server.port>
<spring.redis.index>9</spring.redis.index>
<spring.redis.host>114.215.125.123</spring.redis.host>
<spring.redis.port>9603</spring.redis.port>
<spring.redis.password>epdc!redis@master1405</spring.redis.password>
<spring.redis.index>8</spring.redis.index>
<spring.redis.host>r-m5eh5czgb1nucti6azpd.redis.rds.aliyuncs.com</spring.redis.host>
<spring.redis.port>10001</spring.redis.port>
<spring.redis.password>elink!888</spring.redis.password>
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://rm-m5eguiv2827bdye798o.mysql.rds.aliyuncs.com:10001/yushan_esua_epdc_custom?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
@ -219,9 +219,9 @@
<analysis.wx.ma.secret>394f47d4e08fc0fd629231d3f68a34dc</analysis.wx.ma.secret>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>192.168.0.59:8848</nacos.server-addr>
<nacos.ip>192.168.0.59</nacos.ip>
<nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip></nacos.ip>
<nacos.namespace>8831513c-2f72-42e8-899f-eb6c2c5ae110</nacos.namespace>
<!--RocketMQ-->
<rocketmq.name.server>192.168.0.59:9876</rocketmq.name.server>

11
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/controller/PersonTestingController.java

@ -26,12 +26,14 @@ import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.dto.PersonTestingDTO;
import com.elink.esua.epdc.modules.epidemic.dao.PersonTestingDao;
import com.elink.esua.epdc.modules.epidemic.excel.PersonTestingExcel;
import com.elink.esua.epdc.modules.epidemic.service.PersonTestingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
@ -49,6 +51,9 @@ public class PersonTestingController {
@Autowired
private PersonTestingService personTestingService;
@Autowired
private PersonTestingDao personTestingDao;
@GetMapping("page")
public Result<PageData<PersonTestingDTO>> page(@RequestParam Map<String, Object> params){
PageData<PersonTestingDTO> page = personTestingService.page(params);
@ -62,7 +67,7 @@ public class PersonTestingController {
}
@PostMapping
public Result save(@RequestBody PersonTestingDTO dto){
public Result save(@RequestBody PersonTestingDTO dto) throws ParseException {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
personTestingService.save(dto);
@ -87,8 +92,10 @@ public class PersonTestingController {
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<PersonTestingDTO> list = personTestingService.list(params);
List<PersonTestingDTO> list = personTestingDao.getTestingPage(params);
ExcelUtils.exportExcelToTarget(response, null, list, PersonTestingExcel.class);
}
}

7
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/dao/PersonTestingDao.java

@ -18,9 +18,13 @@
package com.elink.esua.epdc.modules.epidemic.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.PersonTestingDTO;
import com.elink.esua.epdc.modules.epidemic.entity.PersonTestingEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 核酸检测记录
*
@ -29,5 +33,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PersonTestingDao extends BaseDao<PersonTestingEntity> {
List<PersonTestingDTO> getTestingPage(Map<String, Object> params);
}

52
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/excel/PersonTestingExcel.java

@ -31,8 +31,8 @@ import java.util.Date;
@Data
public class PersonTestingExcel {
@Excel(name = "ID")
private String id;
// @Excel(name = "ID")
// private String id;
@Excel(name = "姓名")
private String name;
@ -55,35 +55,35 @@ public class PersonTestingExcel {
@Excel(name = "签发机关")
private String organ;
@Excel(name = "照片base64编码")
private String imgCode;
// @Excel(name = "照片base64编码")
// private String imgCode;
//
// @Excel(name = "照片地址")
// private String imgUrl;
@Excel(name = "照片地址")
private String imgUrl;
@Excel(name = "核酸接测结果")
private String testingResult;
// @Excel(name = "核酸接测结果")
// private String testingResult;
@Excel(name = "核酸检测时间")
private Date testingTime;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
@Excel(name = "逻辑删除标识")
private String delFlag;
// @Excel(name = "乐观锁")
// private Integer revision;
//
// @Excel(name = "创建人")
// private String createdBy;
//
// @Excel(name = "创建时间")
// private Date createdTime;
//
// @Excel(name = "更新人")
// private String updatedBy;
//
// @Excel(name = "更新时间")
// private Date updatedTime;
//
// @Excel(name = "逻辑删除标识")
// private String delFlag;
}

3
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/PersonTestingService.java

@ -22,6 +22,7 @@ import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.PersonTestingDTO;
import com.elink.esua.epdc.modules.epidemic.entity.PersonTestingEntity;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
@ -71,7 +72,7 @@ public interface PersonTestingService extends BaseService<PersonTestingEntity> {
* @author generator
* @date 2021-08-20
*/
void save(PersonTestingDTO dto);
void save(PersonTestingDTO dto) throws ParseException;
/**
* 默认更新

53
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/PersonTestingServiceImpl.java

@ -33,6 +33,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -51,11 +53,14 @@ public class PersonTestingServiceImpl extends BaseServiceImpl<PersonTestingDao,
@Override
public PageData<PersonTestingDTO> page(Map<String, Object> params) {
IPage<PersonTestingEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, PersonTestingDTO.class);
// IPage<PersonTestingEntity> page = baseDao.selectPage(
// getPage(params, FieldConstant.CREATED_TIME, false),
// getWrapper(params)
// );
// return getPageData(page, PersonTestingDTO.class);
IPage<PersonTestingDTO> page = getPage(params);
List<PersonTestingDTO> list = baseDao.getTestingPage(params);
return new PageData<>(list, page.getTotal());
}
@Override
@ -82,11 +87,47 @@ public class PersonTestingServiceImpl extends BaseServiceImpl<PersonTestingDao,
@Override
@Transactional(rollbackFor = Exception.class)
public void save(PersonTestingDTO dto) {
public void save(PersonTestingDTO dto) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
PersonTestingEntity entity = ConvertUtils.sourceToTarget(dto, PersonTestingEntity.class);
String bir = getBirthday(entity.getIdcard());
entity.setBirthday(format.parse( bir ));
insert(entity);
}
/**
* 获取出生日期 yyyy年MM月dd日
* @param IDCard
* @return
*/
public static String getBirthday(String IDCard){
String birthday="";
String year="";
String month="";
String day="";
if (StringUtils.isNotBlank(IDCard)){
//15位身份证号
if (IDCard.length() == 15){
// 身份证上的年份(15位身份证为1980年前的)
year = "19" + IDCard.substring(6, 8);
//身份证上的月份
month = IDCard.substring(8, 10);
//身份证上的日期
day= IDCard.substring(10, 12);
//18位身份证号
}else if(IDCard.length() == 18){
// 身份证上的年份
year = IDCard.substring(6).substring(0, 4);
// 身份证上的月份
month = IDCard.substring(10).substring(0, 2);
//身份证上的日期
day=IDCard.substring(12).substring(0,2);
}
birthday=year+"-"+month+"-"+day;
}
return birthday;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(PersonTestingDTO dto) {

12
epdc-cloud-custom/src/main/resources/mapper/epidemic/PersonTestingDao.xml

@ -23,6 +23,18 @@
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="delFlag" column="DEL_FLAG"/>
</resultMap>
<select id="getTestingPage" resultType="com.elink.esua.epdc.dto.PersonTestingDTO">
select *
from epdc_person_testing
where del_flag='0'
<if test="name != null and name != ''">
AND name like '%${name}%'
</if>
<if test="idcard != null and idcard != ''">
AND idcard like '%${idcard}%'
</if>
order by CREATED_TIME desc
</select>
</mapper>
Loading…
Cancel
Save