体检管理bug调整
This commit is contained in:
+40
-34
@@ -7,6 +7,7 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.budwk.app.base.annotation.SLog;
|
import com.budwk.app.base.annotation.SLog;
|
||||||
import com.budwk.app.base.page.Pagination;
|
import com.budwk.app.base.page.Pagination;
|
||||||
import com.budwk.app.base.param.PageForm;
|
import com.budwk.app.base.param.PageForm;
|
||||||
@@ -24,6 +25,7 @@ import com.budwk.app.zhgh.dayofficework.healthCheckup.model.HealthCheckupUserSel
|
|||||||
import com.budwk.app.zhgh.dayofficework.healthCheckup.service.HealthCheckupSingleService;
|
import com.budwk.app.zhgh.dayofficework.healthCheckup.service.HealthCheckupSingleService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
@@ -299,11 +301,11 @@ public class HealthCheckupSingleController {
|
|||||||
@Ok("json:full")
|
@Ok("json:full")
|
||||||
@SaCheckPermission("healthCheckup.statisticsSingle")
|
@SaCheckPermission("healthCheckup.statisticsSingle")
|
||||||
@SLog(type = "healthCheckup", tag = "体检管理", msg = "管理员给没选的人统一选择去年的数据")
|
@SLog(type = "healthCheckup", tag = "体检管理", msg = "管理员给没选的人统一选择去年的数据")
|
||||||
public Result selectOptionByLastYear(String projectId) {
|
public Result selectOptionByLastYear(String projectId, String lastYearProjectId) {
|
||||||
|
|
||||||
Dao dao = healthCheckupSingleService.dao();
|
Dao dao = healthCheckupSingleService.dao();
|
||||||
//获取去年项目
|
//获取去年项目
|
||||||
HealthCheckupProject lastYearProject = dao.fetch(HealthCheckupProject.class, Cnd.where("YEAR(year)", "=", DateUtil.thisYear() - 1));
|
HealthCheckupProject lastYearProject = dao.fetch(HealthCheckupProject.class, Cnd.where("id", "=", lastYearProjectId));
|
||||||
if (lastYearProject == null) {
|
if (lastYearProject == null) {
|
||||||
return Result.error("请先创建去年的体检项目");
|
return Result.error("请先创建去年的体检项目");
|
||||||
}
|
}
|
||||||
@@ -317,10 +319,12 @@ public class HealthCheckupSingleController {
|
|||||||
$projectCnd $condition
|
$projectCnd $condition
|
||||||
""");
|
""");
|
||||||
cnd.and("hcu.projectId", "=", projectId);
|
cnd.and("hcu.projectId", "=", projectId);
|
||||||
sql.setVar("projectCnd", "AND u.id NOT IN ( SELECT selectUserId FROM `health_checkup_user_selection` WHERE projectId = '" + projectId + "' AND selectUserId IS NOT NULL )");
|
sql.setVar("projectCnd",
|
||||||
|
"AND u.id NOT IN ( SELECT selectUserId FROM `health_checkup_user_selection` WHERE projectId = '" + projectId + "' AND selectUserId IS NOT NULL )");
|
||||||
cnd.groupBy("u.loginname");
|
cnd.groupBy("u.loginname");
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
List<NutMap> mapList = healthCheckupSingleService.listMap(sql);
|
List<NutMap> mapList = healthCheckupSingleService.listMap(sql);
|
||||||
|
if(CollectionUtil.isEmpty(mapList)) return Result.success();
|
||||||
|
|
||||||
List<String> userIds = mapList.stream().map(v -> v.getString("id")).toList();
|
List<String> userIds = mapList.stream().map(v -> v.getString("id")).toList();
|
||||||
|
|
||||||
@@ -340,41 +344,43 @@ public class HealthCheckupSingleController {
|
|||||||
userIds.forEach(v -> {
|
userIds.forEach(v -> {
|
||||||
//获取去年这个人选择的记录
|
//获取去年这个人选择的记录
|
||||||
HealthCheckupUserSelection userSelection = lastYearSelectionList.stream().filter(item -> item.getSelectUserId().equals(v)).findFirst().orElse(null);
|
HealthCheckupUserSelection userSelection = lastYearSelectionList.stream().filter(item -> item.getSelectUserId().equals(v)).findFirst().orElse(null);
|
||||||
//去年这个人选择的选项是什么
|
if(ObjectUtil.isNotEmpty(userSelection)){
|
||||||
HealthCheckupProjectSubject lastYearSubject = lastYearSubjectList.stream().filter(last -> last.getId().equals(userSelection.getSubjectId())).findFirst().orElse(null);
|
//去年这个人选择的选项是什么
|
||||||
//今年项目下的选项
|
HealthCheckupProjectSubject lastYearSubject = lastYearSubjectList.stream().filter(last -> last.getId().equals(userSelection.getSubjectId())).findFirst().orElse(null);
|
||||||
HealthCheckupProjectSubject thisYearSubject = thisYearSubjectList.stream().filter(thisYear -> thisYear.getOptionName().equals(lastYearSubject.getOptionName())).findFirst().orElse(null);
|
//今年项目下的选项
|
||||||
if (userSelection != null && thisYearSubject != null) {
|
HealthCheckupProjectSubject thisYearSubject = thisYearSubjectList.stream().filter(thisYear -> thisYear.getOptionName().equals(lastYearSubject.getOptionName())).findFirst().orElse(null);
|
||||||
//获取今年这个选项的收费
|
if (userSelection != null && thisYearSubject != null) {
|
||||||
List<HealthCheckupProjectSubjectMoney> list = dao.query(HealthCheckupProjectSubjectMoney.class,
|
//获取今年这个选项的收费
|
||||||
Cnd.where(HealthCheckupProjectSubjectMoney::getSubjectId, "=", thisYearSubject.getId()));
|
List<HealthCheckupProjectSubjectMoney> list = dao.query(HealthCheckupProjectSubjectMoney.class,
|
||||||
BigDecimal money = BigDecimal.valueOf(0.00);
|
Cnd.where(HealthCheckupProjectSubjectMoney::getSubjectId, "=", thisYearSubject.getId()));
|
||||||
String subjectMoneyId = null;
|
BigDecimal money = BigDecimal.valueOf(0.00);
|
||||||
for (HealthCheckupProjectSubjectMoney subject : list) {
|
String subjectMoneyId = null;
|
||||||
//找出这个人符合哪个项目
|
for (HealthCheckupProjectSubjectMoney subject : list) {
|
||||||
Cnd cndUser = Cnd.where("id", "=", v);
|
//找出这个人符合哪个项目
|
||||||
ConditionGroupUtil.applyConditionGroup(cndUser, subject.getMatchCnd());
|
Cnd cndUser = Cnd.where("id", "=", v);
|
||||||
int count = dao.count(View_user.class, cndUser);
|
ConditionGroupUtil.applyConditionGroup(cndUser, subject.getMatchCnd());
|
||||||
if (count > 0) {
|
int count = dao.count(View_user.class, cndUser);
|
||||||
money = subject.getMoney();
|
if (count > 0) {
|
||||||
subjectMoneyId = subject.getId();
|
money = subject.getMoney();
|
||||||
break;
|
subjectMoneyId = subject.getId();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//如果有符合的就添加
|
||||||
|
if (subjectMoneyId != null) {
|
||||||
|
HealthCheckupUserSelection selection = new HealthCheckupUserSelection();
|
||||||
|
selection.setProjectId(projectId);
|
||||||
|
selection.setSelectUserId(v);
|
||||||
|
selection.setSubjectId(thisYearSubject.getId());
|
||||||
|
selection.setSubjectMoneyId(subjectMoneyId);
|
||||||
|
selection.setMoney(money);
|
||||||
|
selection.setSelectTime(new Date());
|
||||||
|
selections.add(selection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果有符合的就添加
|
|
||||||
if (subjectMoneyId != null) {
|
|
||||||
HealthCheckupUserSelection selection = new HealthCheckupUserSelection();
|
|
||||||
selection.setProjectId(projectId);
|
|
||||||
selection.setSelectUserId(v);
|
|
||||||
selection.setSubjectId(thisYearSubject.getId());
|
|
||||||
selection.setSubjectMoneyId(subjectMoneyId);
|
|
||||||
selection.setMoney(money);
|
|
||||||
selection.setSelectTime(new Date());
|
|
||||||
selections.add(selection);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
dao.insert(selections);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+30
-12
@@ -74,12 +74,12 @@ layout("/layouts/platform.html"){
|
|||||||
type="primary"
|
type="primary"
|
||||||
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">管理员代选择
|
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">管理员代选择
|
||||||
</el-button>-->
|
</el-button>-->
|
||||||
<!-- <el-button @click="openLastYear"-->
|
<el-button @click="openLastYear"
|
||||||
<!-- icon="el-icon-printer"-->
|
icon="el-icon-printer"
|
||||||
<!-- size="small"-->
|
size="small"
|
||||||
<!-- type="primary"-->
|
type="primary"
|
||||||
<!-- v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">一键选择去年数据-->
|
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">一键选择去年数据
|
||||||
<!-- </el-button>-->
|
</el-button>
|
||||||
<el-button @click="msgNotSelect"
|
<el-button @click="msgNotSelect"
|
||||||
icon="el-icon-printer"
|
icon="el-icon-printer"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -231,9 +231,9 @@ layout("/layouts/platform.html"){
|
|||||||
width="35%">
|
width="35%">
|
||||||
<el-form label-position="right" label-width="120px">
|
<el-form label-position="right" label-width="120px">
|
||||||
<el-form-item label="体检项目">
|
<el-form-item label="体检项目">
|
||||||
<el-select style="width: 100%" v-model="noSelectOptionId">
|
<el-select style="width: 100%" v-model="lastYearProjectId">
|
||||||
<el-option :key="item.id" :label="item.optionName" :value="item.id"
|
<el-option :key="item.id" :label="item.name" :value="item.id"
|
||||||
v-for="item in projectSubjectOptions"></el-option>
|
v-for="item in lastYearProjectSubjectOptions"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -283,6 +283,8 @@ layout("/layouts/platform.html"){
|
|||||||
campus: null,
|
campus: null,
|
||||||
loading: false,
|
loading: false,
|
||||||
selectLastYearProject: false,
|
selectLastYearProject: false,
|
||||||
|
lastYearProjectId: null,
|
||||||
|
lastYearProjectSubjectOptions: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -346,11 +348,17 @@ layout("/layouts/platform.html"){
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
|
if(!this.lastYearProjectId){
|
||||||
|
this.$message().error('请选择上年度体检项目');
|
||||||
|
}
|
||||||
if (confirm === "confirm") {
|
if (confirm === "confirm") {
|
||||||
const resp = await this.$axios.post(loc() + '/selectOptionByLastYear', {
|
const resp = await this.$axios.post(loc() + '/selectOptionByLastYear', {
|
||||||
projectId: this.pageForm.projectId
|
projectId: this.pageForm.projectId,
|
||||||
|
lastYearProjectId: this.lastYearProjectId
|
||||||
})
|
})
|
||||||
if (resp.code === 0) {
|
if (resp.code === 0) {
|
||||||
|
this.lastYearProjectId = '';
|
||||||
|
this.selectLastYearProject = false;
|
||||||
this.doSearch()
|
this.doSearch()
|
||||||
this.notifySuccess(resp.msg)
|
this.notifySuccess(resp.msg)
|
||||||
} else {
|
} else {
|
||||||
@@ -528,8 +536,18 @@ layout("/layouts/platform.html"){
|
|||||||
});
|
});
|
||||||
return sums;
|
return sums;
|
||||||
},
|
},
|
||||||
openLastYear(){
|
async openLastYear(){
|
||||||
this.selectLastYearProject = true;
|
const resp = await this.$axios.post("/platform/healthCheckup/project/mange/getHealthCheckupProject", {year: this.pageForm.year - 1})
|
||||||
|
if (resp.code === 0) {
|
||||||
|
if(resp.data.length > 0){
|
||||||
|
this.lastYearProjectSubjectOptions = resp.data
|
||||||
|
this.selectLastYearProject = true;
|
||||||
|
} else {
|
||||||
|
this.$message().error("无上一年度体检项目");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.notifyError(resp.msg)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
|
|||||||
Reference in New Issue
Block a user