体验预约人员导入功能

This commit is contained in:
lSun 2025-04-18 16:21:51 +08:00
parent 258fc01e22
commit ed63971fa5
10 changed files with 442 additions and 13 deletions

View File

@ -2,6 +2,7 @@ package com.bonus.boot.manager.basic.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean; import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean;
import com.bonus.boot.manager.basic.entity.PersonnelReservationBean;
import com.bonus.boot.manager.basic.service.ImportExcelService; import com.bonus.boot.manager.basic.service.ImportExcelService;
import com.bonus.boot.manager.manager.annotation.LogAnnotation; import com.bonus.boot.manager.manager.annotation.LogAnnotation;
import com.bonus.boot.manager.manager.utils.AjaxRes; import com.bonus.boot.manager.manager.utils.AjaxRes;
@ -73,4 +74,25 @@ public class importExcelController {
} }
} }
@LogAnnotation
@PostMapping("/reservation")
@ApiOperation(value = "体检人员库导入")
public AjaxRes reservation(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException {
int result = 1;
AjaxRes ar = new AjaxRes();
try {
List<JSONObject> lstObj = (List<JSONObject>) ImportNoPhotoExcelHelper.readExcel(file, PersonnelReservationBean.class);
String code = service.reservation(lstObj);
if ("导入成功".equals(code)){
ar.setSucceedMsg("导入成功");
}else{
ar.setFailMsg(code);
}
} catch (Exception e) {
e.printStackTrace();
}
return ar;
}
} }

View File

@ -1,6 +1,7 @@
package com.bonus.boot.manager.basic.dao; package com.bonus.boot.manager.basic.dao;
import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean; import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean;
import com.bonus.boot.manager.basic.entity.PersonnelReservationBean;
import com.bonus.boot.manager.basic.entity.ZNode; import com.bonus.boot.manager.basic.entity.ZNode;
import com.bonus.boot.manager.manager.model.SysUser; import com.bonus.boot.manager.manager.model.SysUser;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -42,4 +43,10 @@ public interface PersonnelLibraryDao {
int updatete(PersonnelLibraryBean bean); int updatete(PersonnelLibraryBean bean);
SysUser getEyId(Long userId); SysUser getEyId(Long userId);
PersonnelReservationBean getMealName(@Param("setMeal")String setMeal);
PersonnelReservationBean getInfoById(@Param("personName")String personName,@Param("idNumber") String idNumber, @Param("phone")String phone);
int updateReservation(PersonnelReservationBean bean);
} }

View File

@ -0,0 +1,125 @@
package com.bonus.boot.manager.basic.entity;
import lombok.Data;
@Data
public class PersonnelReservationBean extends HospitalBean{
private String birda;//出生日期
/**
* 唯一标识
*/
private Integer personId;
private String ifEdu; //是否高职
private String hospId;
// private String addInf;
/**
* 人员姓名
*/
private String personName;
/**
*
*/
private String idNumber;
/**
*
*/
private Integer age;
/**
*
*/
private String sex;
/**
*
*/
private String phone;
/**
* 所属部门
*/
private String department;
private String departmentId;
/**
* 是否高职
*/
private String higherJob;
/**
* 职业类型 在职 离职 劳务派遣
*/
private String jobType;
private String personType;
/**
* 是否特殊工种
*/
private String specialPost;
private String specialPostName;
/**
* 密码
*/
private String password;
/**
* 套餐男
*/
private String tcManId;
private String tcManName;
private String combName;
/**
* 套餐女
*/
private String tcWomanId;
private String tcWomanName;
private String personStr;
/**
* 是否取消预约
*/
private String ifCancel;
private String tjId;
private String phyTimeStart;
private String phyTimeEnd;
private String hospitalId;
/**
* 手机号是否唯一
*/
public String getPhoneNumber() {
return null;
}
/**
* 体检套餐
*/
private String setMeal;
private String setMealId;
/**
* 体检医院
*/
private String hospital;
/**
* 人员类型编内编外
*/
private String personnelType;
private String userId;
/**
* 检查类型
*/
private String checkType;
}

View File

@ -11,4 +11,6 @@ public interface ImportExcelService {
String saveExcelInfo(List<JSONObject> lstObj); String saveExcelInfo(List<JSONObject> lstObj);
String savenegativeResult(List<JSONObject> lstObj); String savenegativeResult(List<JSONObject> lstObj);
String reservation(List<JSONObject> lstObj);
} }

View File

@ -4,6 +4,7 @@ package com.bonus.boot.manager.basic.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.bonus.boot.manager.basic.dao.PersonnelLibraryDao; import com.bonus.boot.manager.basic.dao.PersonnelLibraryDao;
import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean; import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean;
import com.bonus.boot.manager.basic.entity.PersonnelReservationBean;
import com.bonus.boot.manager.basic.service.ImportExcelService; import com.bonus.boot.manager.basic.service.ImportExcelService;
import com.bonus.boot.manager.manager.model.SysType; import com.bonus.boot.manager.manager.model.SysType;
import com.bonus.boot.manager.manager.utils.DateTimeHelper; import com.bonus.boot.manager.manager.utils.DateTimeHelper;
@ -235,6 +236,150 @@ public class ImportExcelServiceImpl implements ImportExcelService {
return res.toString().length()<=0?"导入成功":res.toString(); return res.toString().length()<=0?"导入成功":res.toString();
} }
@Override
public String reservation(List<JSONObject> lstObj) {
PersonnelReservationBean bean=new PersonnelReservationBean();
String res = "";
int team =1;
int i = 0;
String personName = "";
String phone = "";
String idNumber = "";
String department = "";
String hospital = "";
String sex = "";
String setMeal = "";
try {
if (lstObj != null && lstObj.size() > 0) {
for (JSONObject obj : lstObj) {
i++;
personName = obj.getString("personName").trim();
idNumber = obj.getString("idNumber").trim();
sex = obj.getString("sex").trim();
department = obj.getString("department").trim();
hospital = obj.getString("hospital").trim();
setMeal = obj.getString("setMeal").trim();
phone = obj.getString("phone").trim();
//判断姓名为空
if(StringHelper.isEmpty(personName)){
res += "" + i + "行姓名为空;";
}
bean.setPersonName(personName);
//判断身份证为空
if (StringHelper.isEmpty(idNumber) || "0.0".equals(idNumber.trim())) {
res += "" + i + "" + personName + "行身份证为空;";
team = 2;
} else if (idNumber.length() != 18) {
res += "" + i + "" + personName + "行身份证格式错误;";
team = 2;
}
bean.setIdNumber(idNumber);
//判断性别为空
if (StringHelper.isEmpty(sex) ) {
res += "" + i + "" + personName + "行性别为空;";
team = 2;
}else {
String a=getSexByIdcard(idNumber);
String b= "";
if(sex.equals("")){
b="0";
}else{
b="1";
}
if(!a.equals(b)){
res += "" + i + "" + personName + "行身份证与性别不匹配;";
}else {
bean.setSex(b);
}
}
//判断部门名称为空
if(!department.isEmpty()) {
String departmentName = dao.getdepartmentName(department);
if (StringHelper.isEmpty(departmentName) || "0.0".equals(departmentName.trim())) {
team = 2;
res += "" + i + "" + personName + "部门名称有误,请检查";
System.out.println(res);
} else {
bean.setDepartment(departmentName + "");
}
}else{
team = 2;
res += "" + i + "" + personName + "部门名称为空";
}
//判断医院名称为空
if (StringHelper.isEmpty(hospital) ) {
res += "" + i + "" + personName + "行医院名称为空;";
team = 2;
}else{
if(hospital.equals("A")){
bean.setHospital("33");
}else if(hospital.equals("B")) {
bean.setHospital("34");
}else if(hospital.equals("C")) {
bean.setHospital("35");
}else {
res += "" + i + "" + personName + "行医院名称有误,请检查";
}
}
//判断体检套餐为空
if (StringHelper.isEmpty(setMeal) ) {
res += "" + i + "" + personName + "行体检套餐为空;";
team = 2;
}else if(!setMeal.contains(sex)){
res += "" + i + "" + personName + "行体检套餐内容与性别不符合;";
team = 2;
} else {
PersonnelReservationBean bean1 = dao.getMealName(setMeal);
String setMealName = bean1.getSetMealId();
if (StringHelper.isEmpty(setMealName) || "0.0".equals(setMealName.trim())) {
team = 2;
res += "" + i + "" + personName + "体检套餐有误,请检查";
System.out.println(res);
} else {
bean.setSetMeal(setMealName + "");
bean.setCheckType(bean1.getCheckType());
bean.setCombName(setMeal);
}
}
//判断手机号码为空
if (StringHelper.isEmpty(phone) || "0.0".equals(phone.trim())) {
res += "" + i + "" + personName + "行手机号码为空;";
team = 2;
} else if (!isLegalMobileNumber(phone)) {
res += "" + i + "" + personName + "行手机号码格式错误;";
team = 2;
}
bean.setPhone(phone);
if(team!=2){
// 查询通过身份证姓名电话去查询
PersonnelReservationBean beans = dao.getInfoById(personName,idNumber,phone);
if(beans!=null){
//获取预约人的id
bean.setId(beans.getId());
int k = dao.updateReservation(bean);
res = "导入成功";
}else{
res += "" + i + "" + personName + "行数据有误,在职人员信息未找到。请检查";
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
private String ChangepersonType(String personType) { private String ChangepersonType(String personType) {
String team; String team;
if(personType.equals("在职")){ if(personType.equals("在职")){

View File

@ -1,4 +1,4 @@
package com.bonus.boot.manager.manager.entity; package com.bonus.boot.manager.manager.entity;
/** /**
* @author 19814 * @author 19814

View File

@ -48,7 +48,7 @@ public class ImportNoPhotoExcelHelper {
throw new RuntimeException("模板错误,请重新选择模板!"); throw new RuntimeException("模板错误,请重新选择模板!");
} }
} }
List<String> filenames = new ArrayList<>(); List<String> filenames = new ArrayList<>();
switch (className) { switch (className) {
case "SysOrg": case "SysOrg":
@ -97,6 +97,8 @@ public class ImportNoPhotoExcelHelper {
colNum = sheet.getRow(1).getLastCellNum(); colNum = sheet.getRow(1).getLastCellNum();
} else if (className.equals("PersonnelLibraryBean")) { } else if (className.equals("PersonnelLibraryBean")) {
colNum = sheet.getRow(1).getLastCellNum(); colNum = sheet.getRow(1).getLastCellNum();
} else if (className.equals("PersonnelReservationBean")) {
colNum = sheet.getRow(0).getLastCellNum();
} else{ } else{
colNum = sheet.getRow(0).getLastCellNum(); colNum = sheet.getRow(0).getLastCellNum();
} }
@ -109,6 +111,8 @@ public class ImportNoPhotoExcelHelper {
return colNum == 4; return colNum == 4;
case "CareerBean": case "CareerBean":
return colNum == 12; return colNum == 12;
case "PersonnelReservationBean":
return colNum == 11;
default: default:
break; break;
} }
@ -168,6 +172,9 @@ public class ImportNoPhotoExcelHelper {
case "CareerBean": case "CareerBean":
if (row.getRowNum() < 2) continue; if (row.getRowNum() < 2) continue;
break; break;
case "PersonnelReservationBean":
if (row.getRowNum() < 3) continue;
break;
default: default:
if (row.getRowNum() < 1) continue; if (row.getRowNum() < 1) continue;
break; break;
@ -261,6 +268,41 @@ public class ImportNoPhotoExcelHelper {
obj.put("specJob", row.getCell(7).getStringCellValue()); obj.put("specJob", row.getCell(7).getStringCellValue());
} }
break; break;
case "PersonnelReservationBean":
setExcleTString(11, row, -1);
if (row.getCell(1) != null) {
obj.put("personName", row.getCell(1).getStringCellValue());
}
if (row.getCell(2) != null) {
obj.put("idNumber", row.getCell(2).getStringCellValue());
}
if (row.getCell(3) != null) {
obj.put("sex", row.getCell(3).getStringCellValue());
}
if (row.getCell(5) != null) {
obj.put("birda", row.getCell(5).getStringCellValue());
}
if (row.getCell(6) != null) {
obj.put("department", row.getCell(6).getStringCellValue());
}
if (row.getCell(7) != null) {
obj.put("hospital", row.getCell(7).getStringCellValue());
}
if (row.getCell(8) != null) {
obj.put("setMeal", row.getCell(8).getStringCellValue());
}
if (row.getCell(9) != null) {
obj.put("phone", row.getCell(9).getStringCellValue());
}
break;
case "EmployeeHealthCheckBean": case "EmployeeHealthCheckBean":
setExcleTString(3, row, -1); setExcleTString(3, row, -1);
setExcleTDate(3, row, -1); setExcleTDate(3, row, -1);

View File

@ -18,6 +18,7 @@
INSERT INTO pm_occupation_phy_result (phy_id,phy_name, depart, sex, idcard, telep_number, special_job) INSERT INTO pm_occupation_phy_result (phy_id,phy_name, depart, sex, idcard, telep_number, special_job)
VALUES (#{hospId},#{personName}, #{departmentId}, #{sex}, #{idNumber}, #{phone}, #{specialPost}) VALUES (#{hospId},#{personName}, #{departmentId}, #{sex}, #{idNumber}, #{phone}, #{specialPost})
</insert> </insert>
<update id="updateInfo"> <update id="updateInfo">
update pm_base_physical update pm_base_physical
set depart_id = #{departmentId}, set depart_id = #{departmentId},
@ -148,22 +149,41 @@
select id select id
from pm_phy_organization from pm_phy_organization
where `name` = #{department} where `name` = #{department}
and is_active = '1' and is_active = '1' limit 1
limit 1
</select> </select>
<select id="getspecJobName" resultType="java.lang.String"> <select id="getspecJobName" resultType="java.lang.String">
select id select id
from pm_base_special_job from pm_base_special_job
where job_name = #{specJob} where job_name = #{specJob}
and is_active = '1' and is_active = '1' limit 1
limit 1
</select> </select>
<select id="getEyId" resultType="com.bonus.boot.manager.manager.model.SysUser"> <select id="getEyId" resultType="com.bonus.boot.manager.manager.model.SysUser">
SELECT SELECT phy_name AS username,
phy_name AS username, telep_number AS phone
telep_number AS phone
FROM pm_base_physical FROM pm_base_physical
WHERE id = #{userId}; WHERE id = #{userId};
</select> </select>
<select id="getInfoById" resultType="com.bonus.boot.manager.basic.entity.PersonnelReservationBean">
SELECT id
from pm_base_physical
where is_active = '1' and if_job = '1' and phy_name = #{personName} and idcard = #{idNumber}
and telep_number = #{phone}
</select>
<select id="getMealName" resultType="com.bonus.boot.manager.basic.entity.PersonnelReservationBean">
select id as setMealId,check_id as checkType
from pm_base_combination
where `comb_name` = #{setMeal}
and is_active = '1' LIMIT 1
</select>
<update id="updateReservation">
update pm_base_physical
set
depart_id=#{department},
nosocomium=#{hospital},
set_meal = #{checkType}
where is_active = '1' and id=#{id}
</update>
</mapper> </mapper>

View File

@ -115,6 +115,9 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function () {
case "exportBtn": case "exportBtn":
//导出 //导出
break; break;
case "exportBtnYu":
download()
break;
} }
}); });
}); });
@ -202,5 +205,59 @@ function importExcel() {
} }
function showMessage(message, isSuccess) { function showMessage(message, isSuccess) {
layer.msg(message, { time: 4500, icon: isSuccess ? 1 : 2 }); layer.msg(message, { time: 10000, icon: isSuccess ? 1 : 2 });
}
function download(){
window.location.href = ctxPath + "/download/download?filename=体检人员名单导入.xlsx"
}
function importExcelYu() {
var formData = new FormData($('form')[0]);
var name = $("#articleImageFileYu").val();
if (name == null || name == "") {
layer.msg("请上传Excel表格(.xlsx)");
return;
}
if (!(name.endsWith(".xlsx"))) {
layer.msg("请上传正确的Excel表格(.xlsx)!");
$("#articleImageFileYu").val("");
return;
}
formData.append("file", $("#articleImageFileYu")[0].files[0]);
console.log(formData)
var idx = layer.msg('正在提交数据,请稍等...', {
icon: 16
, shade: 0.01
, time: '-1'
});
$.ajax({
url: ctxPath + "/export/reservation",
type: 'POST',
async: true,
data: formData,
timeout: 60 * 1000 * 10,
// 告诉jQuery不要去处理发送的数据
processData: false,
// 告诉jQuery不要去设置Content-Type请求头
contentType: false,
success: function (data) {
if (data.resMsg == '导入成功') {
showMessage('导入成功!', true);
setTimeout(() => {
window.location.reload();
}, 10001)
} else {
showMessage(data.resMsg, false);
}
console.log(data)
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log(JSON.stringify(errorThrown));
layer.close(idx);
}
});
$("#articleImageFileYu").val("");
} }

View File

@ -107,13 +107,13 @@
<script type="text/html" id="toolbar"> <script type="text/html" id="toolbar">
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-inline" style="width: 20%;"> <div class="layui-input-inline" style="width: 20%;">
<label class="layui-form-label" style="width: 30%;">人员类型:</label> <label class="layui-form-label" style="width: 30%;padding: 12px 0px">人员类型:</label>
<select name="personType" id="personType" class="layui-select"> <select name="personType" id="personType" class="layui-select">
</select> </select>
</div> </div>
<div class="layui-input-inline" style="width: 20%;"> <div class="layui-input-inline" style="width: 20%;">
<label class="layui-form-label" style="width: 30%;">高职人员:</label> <label class="layui-form-label" style="width: 30%;;padding: 12px 0px">高职人员:</label>
<select class="layui-select" id="higherJob" name="higherJob"> <select class="layui-select" id="higherJob" name="higherJob">
<option value="">--请选择是否高职人员--</option> <option value="">--请选择是否高职人员--</option>
<option value="1"></option> <option value="1"></option>
@ -139,5 +139,14 @@
<button id="addBtn" class="layui-btn layui-btn-sm" lay-event="addBtn"><i class="layui-icon">&#xe624;</i>新增</button> <button id="addBtn" class="layui-btn layui-btn-sm" lay-event="addBtn"><i class="layui-icon">&#xe624;</i>新增</button>
</div> </div>
<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">&#xe67d;</i>导出预约模板</button>
</div>
<div class="layui-inline" >
<input id="articleImageFileYu" name="excelFile" type="file" class="form-control" style="width: 200px; padding-top: 8px;margin-left: 50px;" />
<button id="importExcelYu" style="margin-bottom: 3px" onclick="importExcelYu()" class="layui-btn layui-btn-sm" ><i class="layui-icon">&#xe601;</i>导入预约</button>
</div>
</div> </div>
</script> </script>