体验预约人员导入功能
This commit is contained in:
parent
ed63971fa5
commit
06f8a441c9
|
|
@ -50,6 +50,7 @@ public class importExcelController {
|
||||||
ar.setFailMsg(code);
|
ar.setFailMsg(code);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
ar.setFailMsg(e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return ar;
|
return ar;
|
||||||
|
|
@ -91,6 +92,7 @@ public class importExcelController {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
ar.setFailMsg(e.getMessage());
|
||||||
}
|
}
|
||||||
return ar;
|
return ar;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,11 @@ public interface PersonnelLibraryDao {
|
||||||
|
|
||||||
PersonnelReservationBean getMealName(@Param("setMeal")String setMeal);
|
PersonnelReservationBean getMealName(@Param("setMeal")String setMeal);
|
||||||
|
|
||||||
PersonnelReservationBean getInfoById(@Param("personName")String personName,@Param("idNumber") String idNumber, @Param("phone")String phone);
|
PersonnelReservationBean getInfoById(@Param("personName")String personName,@Param("idNumber") String idNumber, @Param("phone")String phone,@Param("ifHighee")String ifHighee);
|
||||||
|
|
||||||
int updateReservation(PersonnelReservationBean bean);
|
int updateReservation(PersonnelReservationBean bean);
|
||||||
|
|
||||||
|
int getPersonNameBy(@Param("personName")String personName);
|
||||||
|
|
||||||
|
int getPhoneBy(@Param("personName")String personName,@Param("phone")String phone);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,4 +122,9 @@ public class PersonnelReservationBean extends HospitalBean{
|
||||||
*/
|
*/
|
||||||
private String checkType;
|
private String checkType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否高职1是0不是 3 是展示空
|
||||||
|
*/
|
||||||
|
private String ifHighee;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,6 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author makejava
|
* @author makejava
|
||||||
* @since 2023-16-19 13:57:46
|
* @since 2023-16-19 13:57:46
|
||||||
*/
|
*/
|
||||||
|
|
@ -238,7 +236,7 @@ public class ImportExcelServiceImpl implements ImportExcelService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String reservation(List<JSONObject> lstObj) {
|
public String reservation(List<JSONObject> lstObj) {
|
||||||
PersonnelReservationBean bean=new PersonnelReservationBean();
|
List<PersonnelReservationBean> validBeans = new ArrayList<>(); // 用于存储通过验证的数据
|
||||||
String res = "";
|
String res = "";
|
||||||
int team = 1;
|
int team = 1;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
@ -249,23 +247,25 @@ public class ImportExcelServiceImpl implements ImportExcelService {
|
||||||
String hospital = "";
|
String hospital = "";
|
||||||
String sex = "";
|
String sex = "";
|
||||||
String setMeal = "";
|
String setMeal = "";
|
||||||
|
boolean hasError = false; // 标志位,用于记录是否有错误
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (lstObj != null && lstObj.size() > 0) {
|
if (lstObj != null && lstObj.size() > 0) {
|
||||||
for (JSONObject obj : lstObj) {
|
for (JSONObject obj : lstObj) {
|
||||||
i++;
|
i++;
|
||||||
|
PersonnelReservationBean bean = new PersonnelReservationBean(); // 每个对象创建一个新的Bean
|
||||||
personName = obj.getString("personName").trim();
|
personName = obj.getString("personName").trim();
|
||||||
idNumber = obj.getString("idNumber").trim();
|
idNumber = obj.getString("idNumber").trim();
|
||||||
sex = obj.getString("sex").trim();
|
sex = obj.getString("sex").trim();
|
||||||
|
|
||||||
department = obj.getString("department").trim();
|
department = obj.getString("department").trim();
|
||||||
hospital = obj.getString("hospital").trim();
|
hospital = obj.getString("hospital").trim();
|
||||||
setMeal = obj.getString("setMeal").trim();
|
setMeal = obj.getString("setMeal").trim();
|
||||||
phone = obj.getString("phone").trim();
|
phone = obj.getString("phone").trim();
|
||||||
|
|
||||||
|
|
||||||
// 判断姓名为空
|
// 判断姓名为空
|
||||||
if (StringHelper.isEmpty(personName)) {
|
if (StringHelper.isEmpty(personName)) {
|
||||||
res += "第" + i + "行姓名为空;";
|
res += "第" + i + "行姓名为空;";
|
||||||
|
hasError = true;
|
||||||
}
|
}
|
||||||
bean.setPersonName(personName);
|
bean.setPersonName(personName);
|
||||||
|
|
||||||
|
|
@ -273,9 +273,11 @@ public class ImportExcelServiceImpl implements ImportExcelService {
|
||||||
if (StringHelper.isEmpty(idNumber) || "0.0".equals(idNumber.trim())) {
|
if (StringHelper.isEmpty(idNumber) || "0.0".equals(idNumber.trim())) {
|
||||||
res += "第" + i + "行" + personName + "行身份证为空;";
|
res += "第" + i + "行" + personName + "行身份证为空;";
|
||||||
team = 2;
|
team = 2;
|
||||||
|
hasError = true;
|
||||||
} else if (idNumber.length() != 18) {
|
} else if (idNumber.length() != 18) {
|
||||||
res += "第" + i + "行" + personName + "行身份证格式错误;";
|
res += "第" + i + "行" + personName + "行身份证格式错误;";
|
||||||
team = 2;
|
team = 2;
|
||||||
|
hasError = true;
|
||||||
}
|
}
|
||||||
bean.setIdNumber(idNumber);
|
bean.setIdNumber(idNumber);
|
||||||
|
|
||||||
|
|
@ -283,6 +285,7 @@ public class ImportExcelServiceImpl implements ImportExcelService {
|
||||||
if (StringHelper.isEmpty(sex)) {
|
if (StringHelper.isEmpty(sex)) {
|
||||||
res += "第" + i + "行" + personName + "行性别为空;";
|
res += "第" + i + "行" + personName + "行性别为空;";
|
||||||
team = 2;
|
team = 2;
|
||||||
|
hasError = true;
|
||||||
} else {
|
} else {
|
||||||
String a = getSexByIdcard(idNumber);
|
String a = getSexByIdcard(idNumber);
|
||||||
String b = "";
|
String b = "";
|
||||||
|
|
@ -293,6 +296,7 @@ public class ImportExcelServiceImpl implements ImportExcelService {
|
||||||
}
|
}
|
||||||
if (!a.equals(b)) {
|
if (!a.equals(b)) {
|
||||||
res += "第" + i + "行" + personName + "行身份证与性别不匹配;";
|
res += "第" + i + "行" + personName + "行身份证与性别不匹配;";
|
||||||
|
hasError = true;
|
||||||
} else {
|
} else {
|
||||||
bean.setSex(b);
|
bean.setSex(b);
|
||||||
}
|
}
|
||||||
|
|
@ -304,19 +308,21 @@ public class ImportExcelServiceImpl implements ImportExcelService {
|
||||||
if (StringHelper.isEmpty(departmentName) || "0.0".equals(departmentName.trim())) {
|
if (StringHelper.isEmpty(departmentName) || "0.0".equals(departmentName.trim())) {
|
||||||
team = 2;
|
team = 2;
|
||||||
res += "第" + i + "行" + personName + "部门名称有误,请检查";
|
res += "第" + i + "行" + personName + "部门名称有误,请检查";
|
||||||
System.out.println(res);
|
hasError = true;
|
||||||
} else {
|
} else {
|
||||||
bean.setDepartment(departmentName + "");
|
bean.setDepartment(departmentName + "");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
team = 2;
|
team = 2;
|
||||||
res += "第" + i + "行" + personName + "部门名称为空";
|
res += "第" + i + "行" + personName + "部门名称为空";
|
||||||
|
hasError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断医院名称为空
|
// 判断医院名称为空
|
||||||
if (StringHelper.isEmpty(hospital)) {
|
if (StringHelper.isEmpty(hospital)) {
|
||||||
res += "第" + i + "行" + personName + "行医院名称为空;";
|
res += "第" + i + "行" + personName + "行医院名称为空;";
|
||||||
team = 2;
|
team = 2;
|
||||||
|
hasError = true;
|
||||||
} else {
|
} else {
|
||||||
if (hospital.equals("A")) {
|
if (hospital.equals("A")) {
|
||||||
bean.setHospital("33");
|
bean.setHospital("33");
|
||||||
|
|
@ -326,58 +332,110 @@ public class ImportExcelServiceImpl implements ImportExcelService {
|
||||||
bean.setHospital("35");
|
bean.setHospital("35");
|
||||||
} else {
|
} else {
|
||||||
res += "第" + i + "行" + personName + "行医院名称有误,请检查";
|
res += "第" + i + "行" + personName + "行医院名称有误,请检查";
|
||||||
|
hasError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String ifHighee = null; // 判断是否为高职
|
||||||
// 判断体检套餐为空
|
// 判断体检套餐为空
|
||||||
if (StringHelper.isEmpty(setMeal)) {
|
if (StringHelper.isEmpty(setMeal)) {
|
||||||
res += "第" + i + "行" + personName + "行体检套餐为空;";
|
res += "第" + i + "行" + personName + "行体检套餐为空;";
|
||||||
team = 2;
|
team = 2;
|
||||||
|
hasError = true;
|
||||||
} else if (!setMeal.contains(sex)) {
|
} else if (!setMeal.contains(sex)) {
|
||||||
res += "第" + i + "行" + personName + "行体检套餐内容与性别不符合;";
|
res += "第" + i + "行" + personName + "行体检套餐内容与性别不符合;";
|
||||||
team = 2;
|
team = 2;
|
||||||
|
hasError = true;
|
||||||
} else {
|
} else {
|
||||||
PersonnelReservationBean bean1 = dao.getMealName(setMeal);
|
PersonnelReservationBean bean1 = dao.getMealName(setMeal);
|
||||||
|
if(bean1!=null){
|
||||||
String setMealName = bean1.getSetMealId();
|
String setMealName = bean1.getSetMealId();
|
||||||
|
ifHighee = bean1.getIfHighee();
|
||||||
if (StringHelper.isEmpty(setMealName) || "0.0".equals(setMealName.trim())) {
|
if (StringHelper.isEmpty(setMealName) || "0.0".equals(setMealName.trim())) {
|
||||||
team = 2;
|
team = 2;
|
||||||
res += "第" + i + "行" + personName + "体检套餐有误,请检查";
|
res += "第" + i + "行" + personName + "体检套餐有误,请检查";
|
||||||
System.out.println(res);
|
hasError = true;
|
||||||
} else {
|
} else {
|
||||||
bean.setSetMeal(setMealName + "");
|
bean.setSetMeal(setMealName + "");
|
||||||
bean.setCheckType(bean1.getCheckType());
|
bean.setCheckType(bean1.getCheckType());
|
||||||
bean.setCombName(setMeal);
|
bean.setCombName(setMeal);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
team = 2;
|
||||||
|
res += "第" + i + "行" + personName + "体检套餐有误,请检查";
|
||||||
|
hasError = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断手机号码为空
|
// 判断手机号码为空
|
||||||
if (StringHelper.isEmpty(phone) || "0.0".equals(phone.trim())) {
|
if (StringHelper.isEmpty(phone) || "0.0".equals(phone.trim())) {
|
||||||
res += "第" + i + "行" + personName + "行手机号码为空;";
|
res += "第" + i + "行" + personName + "行手机号码为空;";
|
||||||
team = 2;
|
team = 2;
|
||||||
|
hasError = true;
|
||||||
} else if (!isLegalMobileNumber(phone)) {
|
} else if (!isLegalMobileNumber(phone)) {
|
||||||
res += "第" + i + "行" + personName + "行手机号码格式错误;";
|
res += "第" + i + "行" + personName + "行手机号码格式错误;";
|
||||||
team = 2;
|
team = 2;
|
||||||
|
hasError = true;
|
||||||
}
|
}
|
||||||
bean.setPhone(phone);
|
bean.setPhone(phone);
|
||||||
|
|
||||||
if(team!=2){
|
|
||||||
// 查询通过身份证、姓名、电话去查询
|
// 查询通过身份证、姓名、电话去查询
|
||||||
PersonnelReservationBean beans = dao.getInfoById(personName,idNumber,phone);
|
int personNameNum = dao.getPersonNameBy(personName);
|
||||||
|
if (personNameNum > 0) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
res += "第" + i + "行" + personName + "行姓名有误,在职人员信息未找到。请检查";
|
||||||
|
team = 2;
|
||||||
|
hasError = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int phoneNum = dao.getPhoneBy(personName,phone);
|
||||||
|
if (phoneNum > 0) {
|
||||||
|
|
||||||
|
}else{
|
||||||
|
res += "第" + i + "行" + personName + "行手机号有误,在职人员信息未找到。请检查";
|
||||||
|
team = 2;
|
||||||
|
hasError = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (team != 2) {
|
||||||
|
PersonnelReservationBean beans = dao.getInfoById(personName, idNumber, phone,"");
|
||||||
if (beans != null) {
|
if (beans != null) {
|
||||||
// 获取预约人的id
|
// 获取预约人的id
|
||||||
bean.setId(beans.getId());
|
// bean.setId(beans.getId());
|
||||||
int k = dao.updateReservation(bean);
|
|
||||||
res = "导入成功";
|
|
||||||
} else {
|
} else {
|
||||||
res += "第" + i + "行" + personName + "行数据有误,在职人员信息未找到。请检查";
|
res += "第" + i + "行" + personName + "行身份证有误,在职人员信息未找到。请检查";
|
||||||
|
hasError = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
PersonnelReservationBean beans1 = dao.getInfoById(personName, idNumber, phone,ifHighee);
|
||||||
|
if (beans1 != null) {
|
||||||
|
// 获取预约人的id
|
||||||
|
bean.setId(beans1.getId());
|
||||||
|
} else {
|
||||||
|
res += "第" + i + "行" + personName + "行高职与非高职有误,在职人员信息未找到。请检查";
|
||||||
|
hasError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 只有在没有错误的情况下才执行新增操作
|
||||||
|
if (!hasError) {
|
||||||
|
validBeans.add(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 只有在没有错误的情况下才执行批量导入操作
|
||||||
|
if (!hasError) {
|
||||||
|
for (PersonnelReservationBean bean : validBeans) {
|
||||||
|
int k = dao.updateReservation(bean);
|
||||||
|
}
|
||||||
|
res = "导入成功";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String ChangepersonType(String personType) {
|
private String ChangepersonType(String personType) {
|
||||||
|
|
@ -417,10 +475,13 @@ public class ImportExcelServiceImpl implements ImportExcelService {
|
||||||
}
|
}
|
||||||
return mobile.matches(MOBILE_RULE);
|
return mobile.matches(MOBILE_RULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证身份证真假
|
* 验证身份证真假
|
||||||
|
*
|
||||||
* @param carNumber 身份证号
|
* @param carNumber 身份证号
|
||||||
* @return boolean*/
|
* @return boolean
|
||||||
|
*/
|
||||||
public static boolean isCard(String carNumber) {
|
public static boolean isCard(String carNumber) {
|
||||||
//判断输入身份证号长度是否合法
|
//判断输入身份证号长度是否合法
|
||||||
if (carNumber.length() != 18) {
|
if (carNumber.length() != 18) {
|
||||||
|
|
@ -460,6 +521,7 @@ public class ImportExcelServiceImpl implements ImportExcelService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据身份证号计算持有者年龄
|
* 根据身份证号计算持有者年龄
|
||||||
|
*
|
||||||
* @param idCard
|
* @param idCard
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -169,13 +169,29 @@
|
||||||
from pm_base_physical
|
from pm_base_physical
|
||||||
where is_active = '1' and if_job = '1' and phy_name = #{personName} and idcard = #{idNumber}
|
where is_active = '1' and if_job = '1' and phy_name = #{personName} and idcard = #{idNumber}
|
||||||
and telep_number = #{phone}
|
and telep_number = #{phone}
|
||||||
|
<if test="ifHighee!=null and ifHighee !='' and ifHighee !='null' ">
|
||||||
|
and if_higher = #{ifHighee}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getPersonNameBy" resultType="java.lang.Integer">
|
||||||
|
SELECT count(1)
|
||||||
|
from pm_base_physical
|
||||||
|
where is_active = '1' and if_job = '1' and phy_name = #{personName}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getMealName" resultType="com.bonus.boot.manager.basic.entity.PersonnelReservationBean">
|
<select id="getMealName" resultType="com.bonus.boot.manager.basic.entity.PersonnelReservationBean">
|
||||||
select id as setMealId,check_id as checkType
|
select id as setMealId,check_id as checkType,if_highee as ifHighee
|
||||||
from pm_base_combination
|
from pm_base_combination
|
||||||
where `comb_name` = #{setMeal}
|
where `comb_name` = #{setMeal}
|
||||||
and is_active = '1' LIMIT 1
|
and is_active = '1' LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getPhoneBy" resultType="java.lang.Integer">
|
||||||
|
SELECT count(1)
|
||||||
|
from pm_base_physical
|
||||||
|
where is_active = '1' and if_job = '1' and telep_number = #{phone} and phy_name = #{personName}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<update id="updateReservation">
|
<update id="updateReservation">
|
||||||
update pm_base_physical
|
update pm_base_physical
|
||||||
|
|
|
||||||
|
|
@ -115,9 +115,6 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function () {
|
||||||
case "exportBtn":
|
case "exportBtn":
|
||||||
//导出
|
//导出
|
||||||
break;
|
break;
|
||||||
case "exportBtnYu":
|
|
||||||
download()
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -189,7 +186,7 @@ function importExcel() {
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.resMsg == '导入成功') {
|
if (data.resMsg == '导入成功') {
|
||||||
showMessage('导入成功!', true);
|
showMessages('导入成功!', true);
|
||||||
} else {
|
} else {
|
||||||
showMessage(data.resMsg, false);
|
showMessage(data.resMsg, false);
|
||||||
}
|
}
|
||||||
|
|
@ -208,9 +205,13 @@ function showMessage(message, isSuccess) {
|
||||||
layer.msg(message, { time: 10000, icon: isSuccess ? 1 : 2 });
|
layer.msg(message, { time: 10000, icon: isSuccess ? 1 : 2 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showMessages(message, isSuccess) {
|
||||||
|
layer.msg(message, { time: 3000, icon: isSuccess ? 1 : 2 });
|
||||||
|
}
|
||||||
|
|
||||||
function download(){
|
|
||||||
window.location.href = ctxPath + "/download/download?filename=体检人员名单导入.xlsx"
|
function fetchExcelYu(){
|
||||||
|
window.location.href = ctxPath + "/download/download?filename=预约体检模版.xlsx"
|
||||||
}
|
}
|
||||||
|
|
||||||
function importExcelYu() {
|
function importExcelYu() {
|
||||||
|
|
@ -244,10 +245,10 @@ function importExcelYu() {
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.resMsg == '导入成功') {
|
if (data.resMsg == '导入成功') {
|
||||||
showMessage('导入成功!', true);
|
showMessages('导入成功!', true);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 10001)
|
}, 30001)
|
||||||
} else {
|
} else {
|
||||||
showMessage(data.resMsg, false);
|
showMessage(data.resMsg, false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="layui-inline" style="width: 6%;margin-top: 4px">
|
<div class="layui-inline" style="width: 6%;margin-top: 4px">
|
||||||
<button id="exportBtnYu" class="layui-btn layui-btn-sm" onclick="fetchExcel()"><i class="layui-icon"></i>导出预约模板</button>
|
<button id="exportBtnYu" class="layui-btn layui-btn-sm" onclick="fetchExcelYu()" ><i class="layui-icon"></i>导出预约模板</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="layui-inline" >
|
<div class="layui-inline" >
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue