Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
data_management_system
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张伯涛
data_management_system
Commits
f36c6270
Commit
f36c6270
authored
Dec 05, 2022
by
gaoyingwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 危重症导入
parent
bb53b9cd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
223 additions
and
4 deletions
+223
-4
WzzryController.java
...java/com/ruoyi/web/controller/system/WzzryController.java
+36
-0
YxryController.java
.../java/com/ruoyi/web/controller/system/YxryController.java
+1
-1
WzzryMapper.java
...em/src/main/java/com/ruoyi/system/mapper/WzzryMapper.java
+6
-0
IWzzryService.java
...src/main/java/com/ruoyi/system/service/IWzzryService.java
+4
-0
WzzryServiceImpl.java
.../java/com/ruoyi/system/service/impl/WzzryServiceImpl.java
+126
-3
WzzryMapper.xml
...i-system/src/main/resources/mapper/system/WzzryMapper.xml
+50
-0
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/WzzryController.java
View file @
f36c6270
...
...
@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletResponse;
import
com.ruoyi.common.core.domain.entity.SysDictData
;
import
com.ruoyi.common.utils.DictUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.system.domain.Yxry
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -25,6 +26,7 @@ import com.ruoyi.system.domain.Wzzry;
import
com.ruoyi.system.service.IWzzryService
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
org.springframework.web.multipart.MultipartFile
;
/**
* 危重症人员Controller
...
...
@@ -144,4 +146,38 @@ public class WzzryController extends BaseController
{
return
toAjax
(
wzzryService
.
deleteWzzryByIds
(
ids
));
}
@PostMapping
(
"/importTemplate"
)
@PreAuthorize
(
"@ss.hasPermi('system:wzzry:import')"
)
@Log
(
title
=
"下载危重症人员模板"
,
businessType
=
BusinessType
.
IMPORT
)
public
void
importTemplate
(
HttpServletResponse
response
)
throws
Exception
{
ExcelUtil
<
Wzzry
>
util
=
new
ExcelUtil
<
Wzzry
>(
Wzzry
.
class
);
Class
<?
extends
Wzzry
>
clazz
=
new
Wzzry
().
getClass
();
List
<
SysDictData
>
userStyles
=
DictUtils
.
getDictCache
(
"user_style"
);
List
<
SysDictData
>
basicDiseases
=
DictUtils
.
getDictCache
(
"basic_disease"
);
List
<
SysDictData
>
hospitals
=
DictUtils
.
getDictCache
(
"hospital"
);
String
[]
userStyle
=
userStyles
.
stream
().
map
(
SysDictData:
:
getDictLabel
).
toArray
(
String
[]::
new
);
String
[]
basicDisease
=
basicDiseases
.
stream
().
map
(
SysDictData:
:
getDictLabel
).
toArray
(
String
[]::
new
);
String
[]
hospital
=
hospitals
.
stream
().
map
(
SysDictData:
:
getDictLabel
).
toArray
(
String
[]::
new
);
String
[]
level
={
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
,
"24"
,
"25"
,
"26"
,
"27"
,
"28"
,
"29"
,
"30"
,
"31"
,
"32"
,
"33"
,
"34"
,
"35"
,
"36"
,
"37"
,
"38"
,
"39"
,
"40"
};
ExcelUtil
.
setClassExcelAttribute
(
clazz
,
"userStyle"
,
"combo"
,
userStyle
);
ExcelUtil
.
setClassExcelAttribute
(
clazz
,
"basicDisease"
,
"combo"
,
basicDisease
);
ExcelUtil
.
setClassExcelAttribute
(
clazz
,
"hospital"
,
"combo"
,
hospital
);
ExcelUtil
.
setClassExcelAttribute
(
clazz
,
"floor"
,
"combo"
,
level
);
//设置文本格式表头在第几列
String
columes
=
"1"
;
util
.
importTemplateExcelSetHead
(
response
,
"危重症人员"
,
columes
);
}
@Log
(
title
=
"导入危重症人员"
,
businessType
=
BusinessType
.
IMPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:wzzry:import')"
)
@PostMapping
(
"/importData"
)
public
void
importData
(
MultipartFile
file
,
HttpServletResponse
response
)
throws
Exception
{
ExcelUtil
<
Wzzry
>
util
=
new
ExcelUtil
<
Wzzry
>(
Wzzry
.
class
);
List
<
Wzzry
>
list
=
util
.
importExcel
(
file
.
getInputStream
());
wzzryService
.
importList
(
list
,
response
);
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/YxryController.java
View file @
f36c6270
...
...
@@ -158,7 +158,7 @@ public class YxryController extends BaseController
String
[]
isYin
=
isYins
.
stream
().
map
(
SysDictData:
:
getDictLabel
).
toArray
(
String
[]::
new
);
String
[]
isHome
=
isHomes
.
stream
().
map
(
SysDictData:
:
getDictLabel
).
toArray
(
String
[]::
new
);
String
[]
level
={
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
,
"24"
,
"25"
,
"26"
,
"27"
,
"28"
,
"29"
,
"30"
,
"31"
,
"32"
};
"21"
,
"22"
,
"23"
,
"24"
,
"25"
,
"26"
,
"27"
,
"28"
,
"29"
,
"30"
,
"31"
,
"32"
,
"33"
,
"34"
,
"35"
,
"36"
,
"37"
,
"38"
,
"39"
,
"40"
};
ExcelUtil
.
setClassExcelAttribute
(
clazz
,
"isYin"
,
"combo"
,
isYin
);
ExcelUtil
.
setClassExcelAttribute
(
clazz
,
"isHome"
,
"combo"
,
isHome
);
ExcelUtil
.
setClassExcelAttribute
(
clazz
,
"floor"
,
"combo"
,
level
);
...
...
ruoyi-system/src/main/java/com/ruoyi/system/mapper/WzzryMapper.java
View file @
f36c6270
...
...
@@ -2,6 +2,8 @@ package com.ruoyi.system.mapper;
import
java.util.List
;
import
com.ruoyi.system.domain.Wzzry
;
import
com.ruoyi.system.domain.Yxry
;
import
org.apache.ibatis.annotations.Param
;
/**
* 危重症人员Mapper接口
...
...
@@ -67,4 +69,8 @@ public interface WzzryMapper
public
int
deleteWzzryByIds
(
Long
[]
ids
);
List
<
Wzzry
>
selectWzzryByCard
(
String
cardNo
);
int
insertBatch
(
@Param
(
"list"
)
List
<
Wzzry
>
list
);
int
updateBatch
(
@Param
(
"list"
)
List
<
Wzzry
>
list
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/IWzzryService.java
View file @
f36c6270
...
...
@@ -3,6 +3,8 @@ package com.ruoyi.system.service;
import
java.util.List
;
import
com.ruoyi.system.domain.Wzzry
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 危重症人员Service接口
*
...
...
@@ -65,4 +67,6 @@ public interface IWzzryService
* @return 结果
*/
public
int
deleteWzzryById
(
Long
id
);
void
importList
(
List
<
Wzzry
>
list
,
HttpServletResponse
response
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WzzryServiceImpl.java
View file @
f36c6270
package
com
.
ruoyi
.
system
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.ruoyi.common.core.domain.entity.SysDictData
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.DataUtils
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.*
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.system.domain.Yxry
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.annotation.DataScope
;
import
com.ruoyi.system.mapper.WzzryMapper
;
import
com.ruoyi.system.domain.Wzzry
;
import
com.ruoyi.system.service.IWzzryService
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 危重症人员Service业务层处理
*
...
...
@@ -125,4 +130,122 @@ public class WzzryServiceImpl implements IWzzryService
{
return
wzzryMapper
.
deleteWzzryById
(
id
);
}
/**
* 导入数据
*
* @return 结果
*/
@Override
public
void
importList
(
List
<
Wzzry
>
list
,
HttpServletResponse
response
)
{
if
(
StringUtils
.
isNull
(
list
)
||
list
.
size
()
==
0
)
{
throw
new
ServiceException
(
"导入数据不能为空!"
);
}
List
<
Wzzry
>
trueList
=
new
ArrayList
<>();
List
<
Wzzry
>
failureList
=
new
ArrayList
<>();
List
<
Wzzry
>
updateList
=
new
ArrayList
<>();
for
(
Wzzry
zlqk
:
list
)
{
if
(
StringUtils
.
isNotEmpty
(
zlqk
.
getCardNo
())
&&
StringUtils
.
isNotEmpty
(
zlqk
.
getUserName
())
&&
StringUtils
.
isNotEmpty
(
zlqk
.
getPhone
())&&
StringUtils
.
isNotEmpty
(
zlqk
.
getBasicDisease
())
&&
StringUtils
.
isNotEmpty
(
zlqk
.
getHospital
())&&
StringUtils
.
isNotEmpty
(
zlqk
.
getIsCare
())
&&
StringUtils
.
isNotEmpty
(
zlqk
.
getIsSelf
()))
{
String
community
=
""
;
String
committee
=
""
;
String
street
=
""
;
if
(
StringUtils
.
isNotEmpty
(
zlqk
.
getCommunity
()))
{
//如果小区不为空,去数据字典匹配value
List
<
SysDictData
>
communitys
=
DictUtils
.
getDictCache
(
"community"
);
List
<
String
>
values
=
communitys
.
stream
().
filter
(
l
->
zlqk
.
getCommunity
().
equals
(
l
.
getDictLabel
()))
.
map
(
SysDictData:
:
getDictValue
).
collect
(
Collectors
.
toList
());
if
(!
values
.
isEmpty
())
community
=
values
.
get
(
0
);
else
{
failureList
.
add
(
zlqk
);
continue
;
}
}
if
(
StringUtils
.
isNotEmpty
(
zlqk
.
getCommittee
()))
{
//如果委员会不为空,去数据字典匹配value
List
<
SysDictData
>
communitys
=
DictUtils
.
getDictCache
(
"committee"
);
List
<
String
>
values
=
communitys
.
stream
().
filter
(
l
->
zlqk
.
getCommittee
().
equals
(
l
.
getDictLabel
()))
.
map
(
SysDictData:
:
getDictValue
).
collect
(
Collectors
.
toList
());
if
(!
values
.
isEmpty
())
committee
=
values
.
get
(
0
);
else
{
failureList
.
add
(
zlqk
);
continue
;
}
}
if
(
StringUtils
.
isNotEmpty
(
zlqk
.
getStreet
()))
{
//如果街道不为空,去数据字典匹配value
List
<
SysDictData
>
communitys
=
DictUtils
.
getDictCache
(
"street_town"
);
List
<
String
>
values
=
communitys
.
stream
().
filter
(
l
->
zlqk
.
getStreet
().
equals
(
l
.
getDictLabel
()))
.
map
(
SysDictData:
:
getDictValue
).
collect
(
Collectors
.
toList
());
if
(!
values
.
isEmpty
())
street
=
values
.
get
(
0
);
else
{
failureList
.
add
(
zlqk
);
continue
;
}
}
if
((
StringUtils
.
isNotEmpty
(
community
)
&&
StringUtils
.
isEmpty
(
committee
))
||
(
StringUtils
.
isNotEmpty
(
committee
)
&&
StringUtils
.
isEmpty
(
street
)))
{
failureList
.
add
(
zlqk
);
continue
;
}
//校验身份证是否重复
List
<
Wzzry
>
zlqks
=
wzzryMapper
.
selectWzzryByCard
(
zlqk
.
getCardNo
());
if
(!
zlqks
.
isEmpty
())
{
zlqk
.
setCommunity
(
community
);
zlqk
.
setCommittee
(
committee
);
zlqk
.
setStreet
(
street
);
updateList
.
add
(
zlqk
);
}
else
{
zlqks
=
list
.
stream
().
filter
(
l
->
zlqk
.
getCardNo
().
equals
(
l
.
getCardNo
())).
collect
(
Collectors
.
toList
());
if
(
zlqks
.
size
()
>
1
)
failureList
.
add
(
zlqk
);
else
{
if
(!
CheckUtils
.
checkPhone
(
zlqk
.
getPhone
()))
{
failureList
.
add
(
zlqk
);
}
else
{
if
(
CheckUtils
.
checkCard
(
zlqk
.
getCardNo
()))
{
// zlqk.setCheckCard("正确");
zlqk
.
setCommunity
(
community
);
zlqk
.
setCommittee
(
committee
);
zlqk
.
setStreet
(
street
);
trueList
.
add
(
zlqk
);
}
else
{
// zlqk.setCheckCard("不正确");
failureList
.
add
(
zlqk
);
}
}
}
}
}
else
if
(
StringUtils
.
isEmpty
(
zlqk
.
getCardNo
())
&&
StringUtils
.
isEmpty
(
zlqk
.
getUserName
())
&&
StringUtils
.
isEmpty
(
zlqk
.
getPhone
())
&&
StringUtils
.
isEmpty
(
zlqk
.
getBasicDisease
())
&&
StringUtils
.
isEmpty
(
zlqk
.
getHospital
())&&
StringUtils
.
isEmpty
(
zlqk
.
getIsCare
())
&&
StringUtils
.
isEmpty
(
zlqk
.
getIsSelf
()))
{
continue
;
}
else
{
failureList
.
add
(
zlqk
);
}
}
if
(!
trueList
.
isEmpty
())
{
for
(
Wzzry
zlqk
:
trueList
)
{
zlqk
.
setCreateBy
(
DataUtils
.
getValue
(
null
,
zlqk
.
getStreet
(),
zlqk
.
getCommittee
()));
zlqk
.
setCreateTime
(
DateUtils
.
getNowDate
());
}
wzzryMapper
.
insertBatch
(
trueList
);
}
if
(!
updateList
.
isEmpty
())
{
for
(
Wzzry
zlqk
:
updateList
)
{
zlqk
.
setCreateBy
(
DataUtils
.
getValue
(
null
,
zlqk
.
getStreet
(),
zlqk
.
getCommittee
()));
zlqk
.
setUpdateTime
(
DateUtils
.
getNowDate
());
}
wzzryMapper
.
updateBatch
(
updateList
);
}
if
(!
failureList
.
isEmpty
())
{
ExcelUtil
<
Wzzry
>
util
=
new
ExcelUtil
<
Wzzry
>(
Wzzry
.
class
);
util
.
exportExcel
(
response
,
failureList
,
"阳危重症人员数据"
);
// return AjaxResult.error(111,"导出失败数据"+failureList.size()+"条");
}
// return AjaxResult.success("数据导入成功");
}
}
ruoyi-system/src/main/resources/mapper/system/WzzryMapper.xml
View file @
f36c6270
...
...
@@ -195,6 +195,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<insert
id=
"insertBatch"
parameterType=
"com.ruoyi.system.domain.Wzzry"
>
insert into wzzry
(user_name, card_no, phone, street, committee, community, building, unit, floor, house, address, basic_disease,
is_care, cohabitants_number, create_by,create_time, remark, user_style, other_situation, basic_disease_detail,
hospital, is_self, situation_true, other_name, other_phone) values
<foreach
item=
"item"
index=
"index"
collection=
"list"
separator=
","
>
( #{item.userName}, #{item.cardNo}, #{item.phone},#{item.street}, #{item.committee}, #{item.community}, #{item.building},
#{item.unit}, #{item.floor}, #{item.house},#{item.address}, #{item.basicDisease},
#{item.isCare}, #{item.cohabitantsNumber}, #{item.createBy}, #{item.createTime}, #{item.remark}, #{item.userStyle},
#{item.otherSituation}, #{item.basicDiseaseDetail}, #{item.hospital},
#{item.isSelf}, #{item.situationTrue}, #{item.otherName}, #{item.otherPhone})
</foreach>
</insert>
<update
id=
"updateBatch"
parameterType=
"com.ruoyi.system.domain.Wzzry"
>
<foreach
item=
"item"
index=
"index"
collection=
"list"
separator=
";"
>
update wzzry
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"item.userName != null"
>
user_name = #{item.userName},
</if>
<if
test=
"item.cardNo != null"
>
card_no = #{item.cardNo},
</if>
<if
test=
"item.phone != null"
>
phone = #{item.phone},
</if>
<if
test=
"item.street != null"
>
street = #{item.street},
</if>
<if
test=
"item.committee != null"
>
committee = #{item.committee},
</if>
<if
test=
"item.community != null"
>
community = #{item.community},
</if>
<if
test=
"item.building != null"
>
building = #{item.building},
</if>
<if
test=
"item.unit != null"
>
unit = #{item.unit},
</if>
<if
test=
"item.floor != null"
>
floor = #{item.floor},
</if>
<if
test=
"item.house != null"
>
house = #{item.house},
</if>
<if
test=
"item.address != null"
>
address = #{item.address},
</if>
<if
test=
"item.basicDisease != null"
>
basic_disease = #{item.basicDisease},
</if>
<if
test=
"item.isCare != null"
>
is_care = #{item.isCare},
</if>
<if
test=
"item.cohabitantsNumber != null"
>
cohabitants_number = #{item.cohabitantsNumber},
</if>
<if
test=
"item.createBy != null"
>
create_by = #{item.createBy},
</if>
<if
test=
"item.createTime != null"
>
create_time = #{item.createTime},
</if>
<if
test=
"item.updateBy != null"
>
update_by = #{item.updateBy},
</if>
<if
test=
"item.updateTime != null"
>
update_time = #{item.updateTime},
</if>
<if
test=
"item.remark != null"
>
remark = #{item.remark},
</if>
<if
test=
"item.userStyle != null"
>
user_style = #{item.userStyle},
</if>
<if
test=
"item.otherSituation != null"
>
other_situation = #{item.otherSituation},
</if>
<if
test=
"item.basicDiseaseDetail != null"
>
basic_disease_detail = #{item.basicDiseaseDetail},
</if>
<if
test=
"item.hospital != null"
>
hospital = #{item.hospital},
</if>
<if
test=
"item.isSelf != null"
>
is_self = #{item.isSelf},
</if>
<if
test=
"item.situationTrue != null"
>
situation_true = #{item.situationTrue},
</if>
<if
test=
"item.otherName != null"
>
other_name = #{item.otherName},
</if>
<if
test=
"item.otherPhone != null"
>
other_phone = #{item.otherPhone},
</if>
</trim>
where card_no = #{item.cardNo}
</foreach>
</update>
<update
id=
"updateWzzry"
parameterType=
"Wzzry"
>
update wzzry
<trim
prefix=
"SET"
suffixOverrides=
","
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment