Commit 72d15941 authored by 陈明豪's avatar 陈明豪

核酸采集和隔离点人员的导出空模板,导入功能

parent 684f01ad
...@@ -2,16 +2,11 @@ package com.ruoyi.web.controller.system; ...@@ -2,16 +2,11 @@ package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.domain.Hscj;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
...@@ -20,6 +15,7 @@ import com.ruoyi.system.domain.Gldry; ...@@ -20,6 +15,7 @@ import com.ruoyi.system.domain.Gldry;
import com.ruoyi.system.service.IGldryService; import com.ruoyi.system.service.IGldryService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* 隔离点人员Controller * 隔离点人员Controller
...@@ -59,6 +55,25 @@ public class GldryController extends BaseController ...@@ -59,6 +55,25 @@ public class GldryController extends BaseController
util.exportExcel(response, list, "隔离点人员数据"); util.exportExcel(response, list, "隔离点人员数据");
} }
@Log(title = "导出隔离点人员导入空模板",businessType = BusinessType.EXPORT)
@GetMapping("/exportTemplate")
public void exportTemplate(HttpServletResponse response){
ExcelUtil<Gldry> util = new ExcelUtil<Gldry>(Gldry.class);
util.importTemplateExcel(response,"隔离点人员数据导入空模板");
}
@Log(title = "导入隔离点人员数据",businessType = BusinessType.EXPORT)
@PostMapping("/importGldryData")
@ResponseBody
public AjaxResult importGldryData(MultipartFile file, HttpServletResponse response) throws Exception{
ExcelUtil<Gldry> util = new ExcelUtil<Gldry>(Gldry.class);
List<Gldry> dataList = util.importExcel(file.getInputStream());
gldryService.importList(dataList,response);
String message = "导入隔离点人员数据";
return AjaxResult.success(message);
}
/** /**
* 获取隔离点人员详细信息 * 获取隔离点人员详细信息
*/ */
......
...@@ -2,16 +2,11 @@ package com.ruoyi.web.controller.system; ...@@ -2,16 +2,11 @@ package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.domain.HsjcExportTemplate;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
...@@ -20,6 +15,7 @@ import com.ruoyi.system.domain.Hscj; ...@@ -20,6 +15,7 @@ import com.ruoyi.system.domain.Hscj;
import com.ruoyi.system.service.IHscjService; import com.ruoyi.system.service.IHscjService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* 核酸采集Controller * 核酸采集Controller
...@@ -59,6 +55,26 @@ public class HscjController extends BaseController ...@@ -59,6 +55,26 @@ public class HscjController extends BaseController
util.exportExcel(response, list, "核酸采集数据"); util.exportExcel(response, list, "核酸采集数据");
} }
@Log(title = "导出核酸采集导入空模板",businessType = BusinessType.EXPORT)
@GetMapping("/exportTemplate")
public void exportTemplate(HttpServletResponse response){
ExcelUtil<Hscj> util = new ExcelUtil<Hscj>(Hscj.class);
util.importTemplateExcel(response,"核酸采集导入空模板");
}
@Log(title = "导入核算采集数据",businessType = BusinessType.EXPORT)
@PostMapping("/importHsjcData")
@ResponseBody
public AjaxResult importHsjcData(MultipartFile file,HttpServletResponse response) throws Exception{
ExcelUtil<Hscj> util = new ExcelUtil<Hscj>(Hscj.class);
List<Hscj> dataList = util.importExcel(file.getInputStream());
System.out.println(dataList);
hscjService.importList(dataList,response);
String message = "导入核算采集数据";
return AjaxResult.success(message);
}
/** /**
* 获取核酸采集详细信息 * 获取核酸采集详细信息
*/ */
......
...@@ -40,6 +40,21 @@ public class Gldry extends BaseEntity ...@@ -40,6 +40,21 @@ public class Gldry extends BaseEntity
@Excel(name = "联系方式") @Excel(name = "联系方式")
private String phone; private String phone;
@Override
public String getRemark() {
return remark;
}
@Override
public void setRemark(String remark) {
this.remark = remark;
}
/** 是否阳性(阳,未阳) */
// 新增字段
@Excel(name = "是否阳性")
private String isYx;
/** 居住地所在区 */ /** 居住地所在区 */
@Excel(name = "居住地所在区") @Excel(name = "居住地所在区")
private String area; private String area;
...@@ -53,9 +68,24 @@ public class Gldry extends BaseEntity ...@@ -53,9 +68,24 @@ public class Gldry extends BaseEntity
private String community; private String community;
/** 楼号单元号门牌号 */ /** 楼号单元号门牌号 */
@Excel(name = "楼号单元号门牌号") // @Excel(name = "楼号单元号门牌号")
private String unit; private String unit;
/** 楼号 */
// 新增字段
@Excel(name = "楼号")
private String buildingNo;
/** 单元号 */
// 新增字段
@Excel(name = "单元号")
private String unitNo;
/** 门牌号 */
// 新增字段
@Excel(name = "门牌号")
private String houseNo;
/** 转入时间 */ /** 转入时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "转入时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "转入时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
...@@ -66,6 +96,11 @@ public class Gldry extends BaseEntity ...@@ -66,6 +96,11 @@ public class Gldry extends BaseEntity
@Excel(name = "转出时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "转出时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date zcTime; private Date zcTime;
/** 备注 */
@Excel(name = "备注")
// 新增字段
private String remark;
/** 状态(0正常 1停用) */ /** 状态(0正常 1停用) */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
...@@ -200,6 +235,38 @@ public class Gldry extends BaseEntity ...@@ -200,6 +235,38 @@ public class Gldry extends BaseEntity
return delFlag; return delFlag;
} }
public String getIsYx() {
return isYx;
}
public void setIsYx(String isYx) {
this.isYx = isYx;
}
public String getBuildingNo() {
return buildingNo;
}
public void setBuildingNo(String buildingNo) {
this.buildingNo = buildingNo;
}
public String getUnitNo() {
return unitNo;
}
public void setUnitNo(String unitNo) {
this.unitNo = unitNo;
}
public String getHouseNo() {
return houseNo;
}
public void setHouseNo(String houseNo) {
this.houseNo = houseNo;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
...@@ -24,6 +24,11 @@ public class Hscj extends BaseEntity ...@@ -24,6 +24,11 @@ public class Hscj extends BaseEntity
@Excel(name = "序号") @Excel(name = "序号")
private String xh; private String xh;
/** 省 */
// 新增字段
@Excel(name = "省")
private String province;
/** 市 */ /** 市 */
@Excel(name = "市") @Excel(name = "市")
private String city; private String city;
...@@ -44,6 +49,10 @@ public class Hscj extends BaseEntity ...@@ -44,6 +49,10 @@ public class Hscj extends BaseEntity
@Excel(name = "采集地点") @Excel(name = "采集地点")
private String cjPlace; private String cjPlace;
/** 转运箱码 */
@Excel(name = "转运箱码")
private String boxhao;
/** 采集管号 */ /** 采集管号 */
@Excel(name = "采集管号") @Excel(name = "采集管号")
private String cjgh; private String cjgh;
...@@ -53,7 +62,7 @@ public class Hscj extends BaseEntity ...@@ -53,7 +62,7 @@ public class Hscj extends BaseEntity
private String userName; private String userName;
/** 身份证号码 */ /** 身份证号码 */
@Excel(name = "身份证号码") @Excel(name = "身份证号码", cellType = Excel.ColumnType.STRING)
private String cardNo; private String cardNo;
/** 联系方式 */ /** 联系方式 */
...@@ -73,7 +82,7 @@ public class Hscj extends BaseEntity ...@@ -73,7 +82,7 @@ public class Hscj extends BaseEntity
private Long age; private Long age;
/** 类别 */ /** 类别 */
@Excel(name = "类别") @Excel(name = "人员类别")
private String category; private String category;
/** 采集时间 */ /** 采集时间 */
...@@ -102,13 +111,19 @@ public class Hscj extends BaseEntity ...@@ -102,13 +111,19 @@ public class Hscj extends BaseEntity
@Excel(name = "检测时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "检测时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date jcTime; private Date jcTime;
/** 采集结果 */
// 新增字段
@Excel(name = "采集结果")
private String cjResult;
/** 人员关系 */ /** 人员关系 */
@Excel(name = "人员关系") @Excel(name = "人员关系")
private String rygx; private String rygx;
/** 箱号 */ /** 备注 */
@Excel(name = "箱号") // 新增字段
private String boxhao; @Excel(name = "备注")
private String remake;
/** 状态(0正常 1停用) */ /** 状态(0正常 1停用) */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
...@@ -117,7 +132,31 @@ public class Hscj extends BaseEntity ...@@ -117,7 +132,31 @@ public class Hscj extends BaseEntity
/** 删除标志(0代表存在 2代表删除) */ /** 删除标志(0代表存在 2代表删除) */
private String delFlag; private String delFlag;
public void setId(Long id) public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCjResult() {
return cjResult;
}
public void setCjResult(String cjResult) {
this.cjResult = cjResult;
}
public String getRemake() {
return remake;
}
public void setRemake(String remake) {
this.remake = remake;
}
public void setId(Long id)
{ {
this.id = id; this.id = id;
} }
...@@ -279,12 +318,12 @@ public class Hscj extends BaseEntity ...@@ -279,12 +318,12 @@ public class Hscj extends BaseEntity
{ {
return cjPhone; return cjPhone;
} }
public void setbType(String bType) public void setBType(String BType)
{ {
this.bType = bType; this.bType = BType;
} }
public String getbType() public String getBType()
{ {
return bType; return bType;
} }
...@@ -364,7 +403,7 @@ public class Hscj extends BaseEntity ...@@ -364,7 +403,7 @@ public class Hscj extends BaseEntity
.append("cjTime", getCjTime()) .append("cjTime", getCjTime())
.append("cjName", getCjName()) .append("cjName", getCjName())
.append("cjPhone", getCjPhone()) .append("cjPhone", getCjPhone())
.append("bType", getbType()) .append("bType", getBType())
.append("laboratory", getLaboratory()) .append("laboratory", getLaboratory())
.append("jcTime", getJcTime()) .append("jcTime", getJcTime())
.append("rygx", getRygx()) .append("rygx", getRygx())
......
package com.ruoyi.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import java.util.Date;
/**
* 核酸采集导入空模板
*
* @author 小明同学
* @date 2022-11-29
*/
public class HsjcExportTemplate {
@Excel(name = "序号")
private String xh;
/** 省 */
@Excel(name = "省")
private String province;
/** 市 */
@Excel(name = "市")
private String city;
/** 居住地所在区 */
@Excel(name = "居住地所在区")
private String area;
/** 街道/镇 */
@Excel(name = "街道/镇")
private String street;
/** 小区/村名称 */
@Excel(name = "小区/村名称")
private String community;
/** 采集地点 */
@Excel(name = "采集地点")
private String cjPlace;
/** 转运箱码 */
@Excel(name = "转运箱码")
private String boxhao;
/** 采集管号 */
@Excel(name = "采集管号")
private String cjgh;
/** 姓名 */
@Excel(name = "姓名")
private String userName;
/** 身份证号码 需要校验*/
@Excel(name = "身份证号码")
private String cardNo;
/** 联系方式 */
@Excel(name = "联系方式")
private String phone;
/** 性别 */
@Excel(name = "性别")
private String sex;
/** 住址 */
@Excel(name = "住址")
private String address;
/** 年龄 */
@Excel(name = "年龄")
private Long age;
/** 人员类别 */
@Excel(name = "人员类别")
private String category;
/** 采集时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "采集时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date cjTime;
/** 采集人姓名 */
@Excel(name = "采集人姓名")
private String cjName;
/** 采集人电话 */
@Excel(name = "采集人电话")
private String cjPhone;
/** 标本类型 */
@Excel(name = "标本类型")
private String bType;
/** 接收实验室 */
@Excel(name = "接收实验室")
private String laboratory;
/** 检测时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "检测时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date jcTime;
/** 采集结果 */
@Excel(name = "采集结果")
private String cjResult;
/** 人员关系 */
@Excel(name = "人员关系")
private String rygx;
/** 备注 */
@Excel(name = "备注")
private String remake;
public String getXh() {
return xh;
}
public void setXh(String xh) {
this.xh = xh;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getCommunity() {
return community;
}
public void setCommunity(String community) {
this.community = community;
}
public String getCjPlace() {
return cjPlace;
}
public void setCjPlace(String cjPlace) {
this.cjPlace = cjPlace;
}
public String getBoxhao() {
return boxhao;
}
public void setBoxhao(String boxhao) {
this.boxhao = boxhao;
}
public String getCjgh() {
return cjgh;
}
public void setCjgh(String cjgh) {
this.cjgh = cjgh;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Long getAge() {
return age;
}
public void setAge(Long age) {
this.age = age;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public Date getCjTime() {
return cjTime;
}
public void setCjTime(Date cjTime) {
this.cjTime = cjTime;
}
public String getCjName() {
return cjName;
}
public void setCjName(String cjName) {
this.cjName = cjName;
}
public String getCjPhone() {
return cjPhone;
}
public void setCjPhone(String cjPhone) {
this.cjPhone = cjPhone;
}
public String getbType() {
return bType;
}
public void setbType(String bType) {
this.bType = bType;
}
public String getLaboratory() {
return laboratory;
}
public void setLaboratory(String laboratory) {
this.laboratory = laboratory;
}
public Date getJcTime() {
return jcTime;
}
public void setJcTime(Date jcTime) {
this.jcTime = jcTime;
}
public String getCjResult() {
return cjResult;
}
public void setCjResult(String cjResult) {
this.cjResult = cjResult;
}
public String getRygx() {
return rygx;
}
public void setRygx(String rygx) {
this.rygx = rygx;
}
public String getRemake() {
return remake;
}
public void setRemake(String remake) {
this.remake = remake;
}
}
...@@ -2,6 +2,9 @@ package com.ruoyi.system.service; ...@@ -2,6 +2,9 @@ package com.ruoyi.system.service;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.Gldry; import com.ruoyi.system.domain.Gldry;
import com.ruoyi.system.domain.Hscj;
import javax.servlet.http.HttpServletResponse;
/** /**
* 隔离点人员Service接口 * 隔离点人员Service接口
...@@ -58,4 +61,6 @@ public interface IGldryService ...@@ -58,4 +61,6 @@ public interface IGldryService
* @return 结果 * @return 结果
*/ */
public int deleteGldryById(Long id); public int deleteGldryById(Long id);
public void importList(List<Gldry> list, HttpServletResponse response);
} }
...@@ -2,6 +2,9 @@ package com.ruoyi.system.service; ...@@ -2,6 +2,9 @@ package com.ruoyi.system.service;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.Hscj; import com.ruoyi.system.domain.Hscj;
import com.ruoyi.system.domain.Zlqk;
import javax.servlet.http.HttpServletResponse;
/** /**
* 核酸采集Service接口 * 核酸采集Service接口
...@@ -58,4 +61,6 @@ public interface IHscjService ...@@ -58,4 +61,6 @@ public interface IHscjService
* @return 结果 * @return 结果
*/ */
public int deleteHscjById(Long id); public int deleteHscjById(Long id);
void importList(List<Hscj> list, HttpServletResponse response);
} }
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.CheckUtils;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.Hscj;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
...@@ -10,6 +17,8 @@ import com.ruoyi.system.mapper.GldryMapper; ...@@ -10,6 +17,8 @@ import com.ruoyi.system.mapper.GldryMapper;
import com.ruoyi.system.domain.Gldry; import com.ruoyi.system.domain.Gldry;
import com.ruoyi.system.service.IGldryService; import com.ruoyi.system.service.IGldryService;
import javax.servlet.http.HttpServletResponse;
/** /**
* 隔离点人员Service业务层处理 * 隔离点人员Service业务层处理
* *
...@@ -97,4 +106,52 @@ public class GldryServiceImpl implements IGldryService ...@@ -97,4 +106,52 @@ public class GldryServiceImpl implements IGldryService
{ {
return gldryMapper.deleteGldryById(id); return gldryMapper.deleteGldryById(id);
} }
@Override
public void importList(List<Gldry> list, HttpServletResponse response){
if (StringUtils.isNull(list) || list.size() == 0)
{
throw new ServiceException("导入数据不能为空!");
}
List<Gldry> trueList = new ArrayList<>();
List<Gldry> failureList = new ArrayList<>();
for (Gldry gldry:list){
if (StringUtils.isNotEmpty(gldry.getGlPlace())
&& StringUtils.isNotEmpty(gldry.getRoom())
&& StringUtils.isNotEmpty(gldry.getJzName())
&& StringUtils.isNotEmpty(gldry.getCardNo())
&& StringUtils.isNotEmpty(gldry.getPhone())
&& StringUtils.isNotEmpty(gldry.getIsYx())
&& StringUtils.isNotEmpty(gldry.getArea())
&& StringUtils.isNotEmpty(gldry.getZrTime().toString())
){
Gldry hldryQuerry = new Gldry();
hldryQuerry.setCardNo(gldry.getCardNo());
List<Gldry> gldries = gldryMapper.selectGldryList(hldryQuerry);
if (!gldries.isEmpty()){
failureList.add(gldry);
}else {
if (CheckUtils.checkCard(gldry.getCardNo())){
trueList.add(gldry);
}else {
failureList.add(gldry);
}
}
}else {
failureList.add(gldry);
}
}
if (!trueList.isEmpty()){
for (Gldry gldry:trueList){
gldry.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
gldry.setCreateTime(DateUtils.getNowDate());
gldryMapper.insertGldry(gldry);
}
}
if (!failureList.isEmpty()){
ExcelUtil<Gldry> util = new ExcelUtil<Gldry>(Gldry.class);
util.exportExcel(response,failureList,"隔离点人员错误数据");
}
}
} }
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.CheckUtils;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.Zlqk;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
...@@ -10,6 +17,8 @@ import com.ruoyi.system.mapper.HscjMapper; ...@@ -10,6 +17,8 @@ import com.ruoyi.system.mapper.HscjMapper;
import com.ruoyi.system.domain.Hscj; import com.ruoyi.system.domain.Hscj;
import com.ruoyi.system.service.IHscjService; import com.ruoyi.system.service.IHscjService;
import javax.servlet.http.HttpServletResponse;
/** /**
* 核酸采集Service业务层处理 * 核酸采集Service业务层处理
* *
...@@ -97,4 +106,75 @@ public class HscjServiceImpl implements IHscjService ...@@ -97,4 +106,75 @@ public class HscjServiceImpl implements IHscjService
{ {
return hscjMapper.deleteHscjById(id); return hscjMapper.deleteHscjById(id);
} }
@Override
public void importList(List<Hscj> list, HttpServletResponse response){
if (StringUtils.isNull(list) || list.size() == 0)
{
throw new ServiceException("导入数据不能为空!");
}
List<Hscj> trueList = new ArrayList<>();
List<Hscj> failureList = new ArrayList<>();
for (Hscj hscj:list){
if (StringUtils.isEmpty(hscj.getProvince())){
hscj.setProvince("河北省");
}
if (StringUtils.isEmpty(hscj.getCity())){
hscj.setCity("石家庄市");
}
if (StringUtils.isEmpty(hscj.getRygx())){
hscj.setRygx("本人");
}
if (StringUtils.isNotEmpty(hscj.getCardNo())
&& StringUtils.isNotEmpty(hscj.getArea())
&& StringUtils.isNotEmpty(hscj.getStreet())
&& StringUtils.isNotEmpty(hscj.getCommunity())
&& StringUtils.isNotEmpty(hscj.getBoxhao())
&& StringUtils.isNotEmpty(hscj.getCjgh())
&& StringUtils.isNotEmpty(hscj.getUserName())
&& StringUtils.isNotEmpty(hscj.getSex())
&& StringUtils.isNotEmpty(hscj.getAge().toString())
&& StringUtils.isNotEmpty(hscj.getCjTime().toString())
&& StringUtils.isNotEmpty(hscj.getCjName())
&& StringUtils.isNotEmpty(hscj.getCjPhone())
&& StringUtils.isNotEmpty(hscj.getBType())
){
Hscj hscjQuerry = new Hscj();
hscjQuerry.setCardNo(hscj.getCardNo());
List<Hscj> hscjs = hscjMapper.selectHscjList(hscjQuerry);
if (!hscjs.isEmpty()){
failureList.add(hscj);
}else {
if (CheckUtils.checkCard(hscj.getCardNo())){
if (hscj.getSex().equals("女")){
hscj.setSex("1");
trueList.add(hscj);
}
if (hscj.getSex().equals("男")){
hscj.setSex("0");
trueList.add(hscj);
}else {
failureList.add(hscj);
}
}else {
failureList.add(hscj);
}
}
}else {
failureList.add(hscj);
}
}
if (!trueList.isEmpty()){
for (Hscj hscj:trueList){
hscj.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
hscj.setCreateTime(DateUtils.getNowDate());
hscjMapper.insertHscj(hscj);
}
}
if (!failureList.isEmpty()){
ExcelUtil<Hscj> util = new ExcelUtil<Hscj>(Hscj.class);
util.exportExcel(response,failureList,"核算采集错误数据");
}
}
} }
...@@ -11,10 +11,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -11,10 +11,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="jzName" column="jz_name" /> <result property="jzName" column="jz_name" />
<result property="cardNo" column="card_no" /> <result property="cardNo" column="card_no" />
<result property="phone" column="phone" /> <result property="phone" column="phone" />
<result property="isYx" column="is_yx"/>
<result property="area" column="area" /> <result property="area" column="area" />
<result property="street" column="street" /> <result property="street" column="street" />
<result property="community" column="community" /> <result property="community" column="community" />
<result property="unit" column="unit" /> <result property="unit" column="unit" />
<result property="buildingNo" column="building_no"/>
<result property="unitNo" column="unit_no"/>
<result property="houseNo" column="house_no"/>
<result property="zrTime" column="zr_time" /> <result property="zrTime" column="zr_time" />
<result property="zcTime" column="zc_time" /> <result property="zcTime" column="zc_time" />
<result property="status" column="status" /> <result property="status" column="status" />
...@@ -63,10 +67,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -63,10 +67,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="jzName != null">jz_name,</if> <if test="jzName != null">jz_name,</if>
<if test="cardNo != null">card_no,</if> <if test="cardNo != null">card_no,</if>
<if test="phone != null">phone,</if> <if test="phone != null">phone,</if>
<if test="isYx != null">is_yx,</if>
<if test="area != null">area,</if> <if test="area != null">area,</if>
<if test="street != null">street,</if> <if test="street != null">street,</if>
<if test="community != null">community,</if> <if test="community != null">community,</if>
<if test="unit != null">unit,</if> <if test="unit != null">unit,</if>
<if test="buildingNo != null">building_no,</if>
<if test="unitNo != null">unit_no,</if>
<if test="houseNo != null">house_no,</if>
<if test="zrTime != null">zr_time,</if> <if test="zrTime != null">zr_time,</if>
<if test="zcTime != null">zc_time,</if> <if test="zcTime != null">zc_time,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
...@@ -83,10 +91,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -83,10 +91,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="jzName != null">#{jzName},</if> <if test="jzName != null">#{jzName},</if>
<if test="cardNo != null">#{cardNo},</if> <if test="cardNo != null">#{cardNo},</if>
<if test="phone != null">#{phone},</if> <if test="phone != null">#{phone},</if>
<if test="isYx != null">#{isYx},</if>
<if test="area != null">#{area},</if> <if test="area != null">#{area},</if>
<if test="street != null">#{street},</if> <if test="street != null">#{street},</if>
<if test="community != null">#{community},</if> <if test="community != null">#{community},</if>
<if test="unit != null">#{unit},</if> <if test="unit != null">#{unit},</if>
<if test="buildingNo != null">#{buildingNo},</if>
<if test="unitNo != null">#{unitNo},</if>
<if test="houseNo != null">#{houseNo},</if>
<if test="zrTime != null">#{zrTime},</if> <if test="zrTime != null">#{zrTime},</if>
<if test="zcTime != null">#{zcTime},</if> <if test="zcTime != null">#{zcTime},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
......
...@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="Hscj" id="HscjResult"> <resultMap type="Hscj" id="HscjResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="xh" column="xh" /> <result property="xh" column="xh" />
<result property="province" column="province" />
<result property="city" column="city" /> <result property="city" column="city" />
<result property="area" column="area" /> <result property="area" column="area" />
<result property="street" column="street" /> <result property="street" column="street" />
...@@ -26,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -26,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="bType" column="b_type" /> <result property="bType" column="b_type" />
<result property="laboratory" column="laboratory" /> <result property="laboratory" column="laboratory" />
<result property="jcTime" column="jc_time" /> <result property="jcTime" column="jc_time" />
<result property="cjResult" column="cj_Result" />
<result property="rygx" column="rygx" /> <result property="rygx" column="rygx" />
<result property="boxhao" column="boxhao" /> <result property="boxhao" column="boxhao" />
<result property="status" column="status" /> <result property="status" column="status" />
...@@ -71,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -71,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''"> and a.status = #{status}</if> <if test="status != null and status != ''"> and a.status = #{status}</if>
${params.dataScope} ${params.dataScope}
</select> </select>
<select id="selectHscjById" parameterType="Long" resultMap="HscjResult"> <select id="selectHscjById" parameterType="Long" resultMap="HscjResult">
<include refid="selectHscjVo"/> <include refid="selectHscjVo"/>
where id = #{id} where id = #{id}
...@@ -81,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -81,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into hscj insert into hscj
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="xh != null">xh,</if> <if test="xh != null">xh,</if>
<if test="province != null">province,</if>
<if test="city != null">city,</if> <if test="city != null">city,</if>
<if test="area != null">area,</if> <if test="area != null">area,</if>
<if test="street != null">street,</if> <if test="street != null">street,</if>
...@@ -100,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -100,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="bType != null">b_type,</if> <if test="bType != null">b_type,</if>
<if test="laboratory != null">laboratory,</if> <if test="laboratory != null">laboratory,</if>
<if test="jcTime != null">jc_time,</if> <if test="jcTime != null">jc_time,</if>
<if test="cjResult != null">cj_result,</if>
<if test="rygx != null">rygx,</if> <if test="rygx != null">rygx,</if>
<if test="boxhao != null">boxhao,</if> <if test="boxhao != null">boxhao,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
...@@ -112,6 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -112,6 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="xh != null">#{xh},</if> <if test="xh != null">#{xh},</if>
<if test="province != null">#{province},</if>
<if test="city != null">#{city},</if> <if test="city != null">#{city},</if>
<if test="area != null">#{area},</if> <if test="area != null">#{area},</if>
<if test="street != null">#{street},</if> <if test="street != null">#{street},</if>
...@@ -131,6 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -131,6 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="bType != null">#{bType},</if> <if test="bType != null">#{bType},</if>
<if test="laboratory != null">#{laboratory},</if> <if test="laboratory != null">#{laboratory},</if>
<if test="jcTime != null">#{jcTime},</if> <if test="jcTime != null">#{jcTime},</if>
<if test="cjResult != null">#{cjResult},</if>
<if test="rygx != null">#{rygx},</if> <if test="rygx != null">#{rygx},</if>
<if test="boxhao != null">#{boxhao},</if> <if test="boxhao != null">#{boxhao},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment