diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/healthCheckup/h5controller/H5HealthCheckupController.java b/src/main/java/com/budwk/app/zhgh/dayofficework/healthCheckup/h5controller/H5HealthCheckupController.java new file mode 100644 index 00000000..673a971a --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/healthCheckup/h5controller/H5HealthCheckupController.java @@ -0,0 +1,195 @@ +package com.budwk.app.zhgh.dayofficework.healthCheckup.h5controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.dev33.satoken.annotation.SaMode; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.result.Result; +import com.budwk.app.base.service.BaseService; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.dayofficework.healthCheckup.model.HealthCheckupCampus; +import com.budwk.app.zhgh.dayofficework.healthCheckup.model.HealthCheckupProject; +import com.budwk.app.zhgh.dayofficework.healthCheckup.model.HealthCheckupUserSelection; +import com.budwk.app.zhgh.dayofficework.healthCheckup.service.HealthCheckupProjectService; +import io.swagger.annotations.ApiOperation; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; +import org.nutz.trans.Trans; + +import java.util.Date; + +/** + * @author : hongqiwei + * @description : + * @createDate : 2025/9/11 14:31 + */ + +@IocBean +@Ok("json:full") +@At("/platform/healthCheckup/h5") +public class H5HealthCheckupController { + + @Inject + private BaseService baseService; + + @Inject + private HealthCheckupProjectService healthCheckupProjectService; + + @At("/list") + @Ok("beetl:/platform/zhghh5/dayofficework/healthCheckup/list/index.html") + @SaCheckPermission("h5.healthCheckup.list") + public void list() { + } + + @At("/mine") + @Ok("beetl:/platform/zhghh5/dayofficework/healthCheckup/mine/index.html") + @SaCheckPermission("h5.healthCheckup.mine") + public void mine() { + } + + + @At + @ApiOperation("获取项目列表") + @SaCheckPermission(value = {"h5.healthCheckup.list", "h5.healthCheckup.mine"}, mode = SaMode.OR) + public Object pageData(PageForm pageForm, + String status, + String name) { + Sql sql = Sqls.create(""" + select + *, + (select count(*) from health_checkup_user_selection s where s.projectId=p.id and s.selectUserId=@userId) as selectCount + from + health_checkup_project p + $condition + """); + sql.setParam("userId", SecurityUtil.getUserId()); + Cnd cnd = Cnd.NEW(); + // 根据 status 参数筛选进行中或已结束的项目 + if ("ongoing".equals(status)) { + // 进行中的项目:结束时间大于等于当前时间 + cnd.and("p.choiceTimeEnd", ">=", DateUtil.now()); + } else if ("finished".equals(status)) { + // 已结束的项目:结束时间小于当前时间 + cnd.and("p.choiceTimeEnd", "<", DateUtil.now()); + } + + // 只有当name参数不为空时才添加名称查询条件 + if (StrUtil.isNotBlank(name)) { + cnd.and("p.name", "like", "%" + name + "%"); + } + cnd.asc("selectCount"); + sql.setCondition(cnd); + return Result.success(healthCheckupProjectService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql)); + } + + @At + @SaCheckPermission(value = {"h5.healthCheckup.list", "h5.healthCheckup.mine"}, mode = SaMode.OR) + public Object mineData(PageForm pageForm, String status) { + Sql sql = Sqls.create(""" + SELECT + us.*, + p.name, + p.choiceTimeStart, + p.choiceTimeEnd, + p.cover + FROM + health_checkup_user_selection us + LEFT JOIN health_checkup_project p ON us.projectId = p.id + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("us.selectUserId", "=", SecurityUtil.getUserId()); + // 根据 status 参数筛选进行中或已结束的项目 + if ("ongoing".equals(status)) { + // 进行中的项目:结束时间大于等于当前时间 + cnd.and("p.choiceTimeEnd", ">=", DateUtil.now()); + } else if ("finished".equals(status)) { + // 已结束的项目:结束时间小于当前时间 + cnd.and("p.choiceTimeEnd", "<", DateUtil.now()); + } + sql.setCondition(cnd); + Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pagination); + } + + @At + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"h5.healthCheckup.list", "h5.healthCheckup.mine"}, mode = SaMode.OR) + public Result doSubmit(@Param("userSelection") HealthCheckupUserSelection userSelection) { + if (StrUtil.isNotBlank(userSelection.getId())) { + baseService.dao().clearLinks(userSelection, "companionList"); + baseService.dao().delete(HealthCheckupUserSelection.class, userSelection.getId()); + userSelection.setId(null); + } + userSelection.setSelectUserId(SecurityUtil.getUserId()); + userSelection.setSelectTime(new Date()); + baseService.dao().insertWith(userSelection, "companionList"); + return Result.success("提交成功"); + } + + @At + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"h5.healthCheckup.list", "h5.healthCheckup.mine"}, mode = SaMode.OR) + public Result cancel(String id, String projectId) { + HealthCheckupProject checkupProject = baseService.dao().fetch(HealthCheckupProject.class, projectId); + if (DateUtil.compare(new Date(), checkupProject.getChoiceTimeEnd()) > 0) { + return Result.error("抱歉,当前时间已经不能取消"); + } + HealthCheckupUserSelection userSelection = baseService.dao().fetch(HealthCheckupUserSelection.class, id); + baseService.dao().clearLinks(userSelection, "companionList"); + baseService.dao().delete(HealthCheckupUserSelection.class, userSelection.getId()); + return Result.success("取消成功"); + } + + + @At + @SaCheckPermission(value = {"h5.healthCheckup.list", "h5.healthCheckup.mine"}, mode = SaMode.OR) + public Object getCampus() { + return Result.success(baseService.dao().query(HealthCheckupCampus.class, Cnd.NEW().asc("campusCode"))); + } + + @At + @SaCheckPermission(value = {"h5.healthCheckup.list", "h5.healthCheckup.mine"}, mode = SaMode.OR) + public Object selectInfo(String projectId) { + HealthCheckupUserSelection userSelection = healthCheckupProjectService.dao().fetch(HealthCheckupUserSelection.class, + Cnd.where("projectId", "=", projectId).and("selectUserId", "=", SecurityUtil.getUserId())); + if (userSelection != null) { + baseService.dao().fetchLinks(userSelection, "companionList"); + NutMap nutMap = Lang.obj2map(userSelection, NutMap.class); + if (userSelection.getCompanionList().size() > 0) { + nutMap.put("isFamily", "是"); + } else { + nutMap.put("isFamily", "否"); + } + return Result.success(nutMap); + } + return Result.success(); + } + +// @At +// public Object validCondition(String cndId) { +// if(StrUtil.isBlank(cndId)) { +// return Result.success(); +// } +// NutMap nutMap = healthCheckupProjectService.validCondition(cndId); +// if(!nutMap.getBoolean("flag")) { +// return Result.error("选择条件:" + nutMap.getString("msg")); +// } +// return null; +// } + + +} + diff --git a/src/main/resources/views/platform/zhghh5/dayofficework/healthCheckup/list/index.html b/src/main/resources/views/platform/zhghh5/dayofficework/healthCheckup/list/index.html new file mode 100644 index 00000000..f9cf51af --- /dev/null +++ b/src/main/resources/views/platform/zhghh5/dayofficework/healthCheckup/list/index.html @@ -0,0 +1,214 @@ + + + + +
+ + + + + + + + + + + + + + + +
+ + + diff --git a/src/main/resources/views/platform/zhghh5/dayofficework/healthCheckup/mine/index.html b/src/main/resources/views/platform/zhghh5/dayofficework/healthCheckup/mine/index.html new file mode 100644 index 00000000..c24dbf6a --- /dev/null +++ b/src/main/resources/views/platform/zhghh5/dayofficework/healthCheckup/mine/index.html @@ -0,0 +1,130 @@ + + +
+ + + + + + + + + + + + + + + + +
+ + + + diff --git a/src/main/resources/views/platform/zhghh5/dayofficework/healthCheckup/projectManageForm.js b/src/main/resources/views/platform/zhghh5/dayofficework/healthCheckup/projectManageForm.js new file mode 100644 index 00000000..c1dbec02 --- /dev/null +++ b/src/main/resources/views/platform/zhghh5/dayofficework/healthCheckup/projectManageForm.js @@ -0,0 +1,301 @@ +let H5_PROJECT_MANAGE_FROM = { + template: /*language=HTML*/ ` + +
+ + +
+ + + + + + + + +
+
+ + +
+ + + + + +
+
+ + +
+
+ 家属信息 +
+ + 删除家属 + + + 添加家属 + +
+
+ +
+ + + + + + + + + + + + + + + + + + +
+
+ 如有家属,请添加家属 +
+
+
+ + +
+ 提交 +
+
+
+ + + + + + + + + +
+
+
+ `, dicts: ["ASSET_USAGE_STATE"], data() { + return { + visible: false, + viewData: {}, + row: null, + formData: { + subjectId: '', campus: '', campusName: '', isFamily: '否', companionList: [], projectId: '' + }, + assetUsageStateNameOption: [], + showAssetUsageStateNamePopup: false, + assetUseUserOption: [], + assetUseNameShow: false, + searchKeyword: "", + active: 0, + campusList: [], + campusVisible: false, + descVisible: false, + desc: '', + project: {} + } + }, + methods: { + // 打开表单 + async onOpen(row) { + this.row = row; + this.visible = true; + await this.getCampus() + await this.findSubject(row.projectId) + if (row.projectId) { + this.selectInfo(row); + } + }, + + async selectInfo(row) { + //this.formData.projectId = row.projectId; + const resp = await $.post('/platform/healthCheckup/h5/selectInfo', {projectId: row.projectId}); + if (resp.data !== null) { + this.formData = resp.data; + const o = this.campusList.find(o => o.id === this.formData.campus) + this.formData.campusName = o.campusName + } + }, + + // 查看说明 + viewDesc(item) { + if (item.description) { + this.desc = item.description; + this.descVisible = true; + } else { + vant.Toast('暂无详细说明'); + } + }, + + // 执行提交 + async doSubmit() { + const loading = this.$toast.loading({ + message: "报名中...", + forbidClick: true, + overlay: true, + duration: 0 + }) + const formData = clone(this.formData); + formData.projectId = this.row.projectId; + if (formData.isFamily === '否') { + formData.companionList = []; + } else { + // 过滤空的家属信息 + formData.companionList = formData.companionList.filter(item => item.userName && item.userName.trim() !== ''); + } + + const resp = await $.post('/platform/healthCheckup/h5/doSubmit', { + userSelection: JSON.stringify(formData), + }); + loading.clear() + if (resp.code === 0) { + this.visible = false; + this.$toast.success(resp.msg) + this.$emit('submit_success'); + } else { + this.$toast.fail(resp.msg) + } + + }, + + // 添加家属 + addCompanion() { + // 检查是否已达到最大数量限制 + if (this.companionList && this.formData.companionList.length >= 5) { + vant.Toast('最多只能添加5个家属'); + return; + } + if (!this.formData.companionList) { + this.$set(this.formData, 'companionList', []); + } + this.formData.companionList.push({ + userName: '', sex: '', marry: '', age: '', idCard: '', mobile: '' + }); + }, + + // 删除家属 + delCompanion() { + if (this.formData.companionList && this.formData.companionList.length > 0) { + this.formData.companionList.splice(this.active, 1); + // 确保active索引有效 + if (this.active >= this.formData.companionList.length && this.active > 0) { + this.active = this.formData.companionList.length - 1; + } + } + }, + + // 院区选择确认 + onCampusConfirm(value) { + this.formData.campusName = value.campusName; + this.formData.campus = value.id; + this.campusVisible = false; + }, + + // 查询体检套餐 + async findSubject(id) { + try { + const resp = await $.post('/platform/healthCheckup/project/mange/findOne', { + id: id + }); + this.project = resp.data || {}; + } catch (error) { + console.error('获取体检套餐失败:', error); + vant.Toast('获取体检套餐失败'); + } + }, + + // 获取院区 + async getCampus() { + try { + const resp = await $.post('/platform/healthCheckup/h5/getCampus'); + this.campusList = resp.data || []; + } catch (error) { + vant.Toast('获取院区失败'); + } + } + } +} diff --git a/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/apply/index.html b/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/apply/index.html index 8ea09234..1cbcbdb6 100644 --- a/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/apply/index.html +++ b/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/apply/index.html @@ -11,8 +11,7 @@ layout("/layouts/platform_h5.html"){
- - + @@ -302,7 +301,7 @@ layout("/layouts/platform_h5.html"){
保存 提交 - 提交1 + 提交
diff --git a/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/info.js b/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/info.js index 97a5641f..b134fdf2 100644 --- a/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/info.js +++ b/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/info.js @@ -44,15 +44,9 @@ const UNION_REIMBURSE_INFO = { {{ viewData.invoiceNumber }} {{ viewData.invoice }} {{ viewData.paymentNotes }} - -
- -
-
+ + + - - - - -
- -
-
- + @@ -72,12 +64,13 @@ layout("/layouts/platform_h5.html"){ store, dicts: ["CHILD_MANAGE_GRADE"], components: { - info:childManageInfo + "child-manage-info":CHILD_MANAGE_INFO }, data() { return { viewShow: false, yearList: [], + infoShow: false, pageForm: { pageNumber: 1, pageSize: 10, @@ -88,10 +81,8 @@ layout("/layouts/platform_h5.html"){ }, methods: { onView(row) { - this.viewShow = true - this.$nextTick(() => { - this.$refs.infoRef.onOpen(row) - }) + this.showApprovalForm = false + this.$refs.childManageInfoRef.onOpen(row) }, onEdit(row) { window.location.href = '/platform/childManage/write/h5?bizId=' + row.id diff --git a/src/main/resources/views/platform/zhghh5/staffmanage/childmanage/mine/index.html b/src/main/resources/views/platform/zhghh5/staffmanage/childmanage/mine/index.html index 42fabc88..8b855323 100644 --- a/src/main/resources/views/platform/zhghh5/staffmanage/childmanage/mine/index.html +++ b/src/main/resources/views/platform/zhghh5/staffmanage/childmanage/mine/index.html @@ -46,15 +46,7 @@ layout("/layouts/platform_h5.html"){ - - - - -
- -
-
- + @@ -65,12 +57,13 @@ layout("/layouts/platform_h5.html"){ store, dicts: ["CHILD_MANAGE_GRADE"], components: { - info:childManageInfo + "child-manage-info":CHILD_MANAGE_INFO }, data() { return { viewShow: false, yearList: [], + infoShow: false, pageForm: { pageNumber: 1, pageSize: 10, @@ -81,10 +74,8 @@ layout("/layouts/platform_h5.html"){ }, methods: { onView(row) { - this.viewShow = true - this.$nextTick(() => { - this.$refs.infoRef.onOpen(row) - }) + this.showApprovalForm = false + this.$refs.childManageInfoRef.onOpen(row) }, onEdit(row) { window.location.href = '/platform/childManage/write/h5?bizId=' + row.id