体检管理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.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
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 io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
@@ -299,11 +301,11 @@ public class HealthCheckupSingleController {
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("healthCheckup.statisticsSingle")
|
||||
@SLog(type = "healthCheckup", tag = "体检管理", msg = "管理员给没选的人统一选择去年的数据")
|
||||
public Result selectOptionByLastYear(String projectId) {
|
||||
public Result selectOptionByLastYear(String projectId, String lastYearProjectId) {
|
||||
|
||||
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) {
|
||||
return Result.error("请先创建去年的体检项目");
|
||||
}
|
||||
@@ -317,10 +319,12 @@ public class HealthCheckupSingleController {
|
||||
$projectCnd $condition
|
||||
""");
|
||||
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");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> mapList = healthCheckupSingleService.listMap(sql);
|
||||
if(CollectionUtil.isEmpty(mapList)) return Result.success();
|
||||
|
||||
List<String> userIds = mapList.stream().map(v -> v.getString("id")).toList();
|
||||
|
||||
@@ -340,41 +344,43 @@ public class HealthCheckupSingleController {
|
||||
userIds.forEach(v -> {
|
||||
//获取去年这个人选择的记录
|
||||
HealthCheckupUserSelection userSelection = lastYearSelectionList.stream().filter(item -> item.getSelectUserId().equals(v)).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) {
|
||||
//获取今年这个选项的收费
|
||||
List<HealthCheckupProjectSubjectMoney> list = dao.query(HealthCheckupProjectSubjectMoney.class,
|
||||
Cnd.where(HealthCheckupProjectSubjectMoney::getSubjectId, "=", thisYearSubject.getId()));
|
||||
BigDecimal money = BigDecimal.valueOf(0.00);
|
||||
String subjectMoneyId = null;
|
||||
for (HealthCheckupProjectSubjectMoney subject : list) {
|
||||
//找出这个人符合哪个项目
|
||||
Cnd cndUser = Cnd.where("id", "=", v);
|
||||
ConditionGroupUtil.applyConditionGroup(cndUser, subject.getMatchCnd());
|
||||
int count = dao.count(View_user.class, cndUser);
|
||||
if (count > 0) {
|
||||
money = subject.getMoney();
|
||||
subjectMoneyId = subject.getId();
|
||||
break;
|
||||
if(ObjectUtil.isNotEmpty(userSelection)){
|
||||
//去年这个人选择的选项是什么
|
||||
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) {
|
||||
//获取今年这个选项的收费
|
||||
List<HealthCheckupProjectSubjectMoney> list = dao.query(HealthCheckupProjectSubjectMoney.class,
|
||||
Cnd.where(HealthCheckupProjectSubjectMoney::getSubjectId, "=", thisYearSubject.getId()));
|
||||
BigDecimal money = BigDecimal.valueOf(0.00);
|
||||
String subjectMoneyId = null;
|
||||
for (HealthCheckupProjectSubjectMoney subject : list) {
|
||||
//找出这个人符合哪个项目
|
||||
Cnd cndUser = Cnd.where("id", "=", v);
|
||||
ConditionGroupUtil.applyConditionGroup(cndUser, subject.getMatchCnd());
|
||||
int count = dao.count(View_user.class, cndUser);
|
||||
if (count > 0) {
|
||||
money = subject.getMoney();
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
+30
-12
@@ -74,12 +74,12 @@ layout("/layouts/platform.html"){
|
||||
type="primary"
|
||||
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">管理员代选择
|
||||
</el-button>-->
|
||||
<!-- <el-button @click="openLastYear"-->
|
||||
<!-- icon="el-icon-printer"-->
|
||||
<!-- size="small"-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">一键选择去年数据-->
|
||||
<!-- </el-button>-->
|
||||
<el-button @click="openLastYear"
|
||||
icon="el-icon-printer"
|
||||
size="small"
|
||||
type="primary"
|
||||
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">一键选择去年数据
|
||||
</el-button>
|
||||
<el-button @click="msgNotSelect"
|
||||
icon="el-icon-printer"
|
||||
size="small"
|
||||
@@ -231,9 +231,9 @@ layout("/layouts/platform.html"){
|
||||
width="35%">
|
||||
<el-form label-position="right" label-width="120px">
|
||||
<el-form-item label="体检项目">
|
||||
<el-select style="width: 100%" v-model="noSelectOptionId">
|
||||
<el-option :key="item.id" :label="item.optionName" :value="item.id"
|
||||
v-for="item in projectSubjectOptions"></el-option>
|
||||
<el-select style="width: 100%" v-model="lastYearProjectId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id"
|
||||
v-for="item in lastYearProjectSubjectOptions"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -283,6 +283,8 @@ layout("/layouts/platform.html"){
|
||||
campus: null,
|
||||
loading: false,
|
||||
selectLastYearProject: false,
|
||||
lastYearProjectId: null,
|
||||
lastYearProjectSubjectOptions: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -346,11 +348,17 @@ layout("/layouts/platform.html"){
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if(!this.lastYearProjectId){
|
||||
this.$message().error('请选择上年度体检项目');
|
||||
}
|
||||
if (confirm === "confirm") {
|
||||
const resp = await this.$axios.post(loc() + '/selectOptionByLastYear', {
|
||||
projectId: this.pageForm.projectId
|
||||
projectId: this.pageForm.projectId,
|
||||
lastYearProjectId: this.lastYearProjectId
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.lastYearProjectId = '';
|
||||
this.selectLastYearProject = false;
|
||||
this.doSearch()
|
||||
this.notifySuccess(resp.msg)
|
||||
} else {
|
||||
@@ -528,8 +536,18 @@ layout("/layouts/platform.html"){
|
||||
});
|
||||
return sums;
|
||||
},
|
||||
openLastYear(){
|
||||
this.selectLastYearProject = true;
|
||||
async openLastYear(){
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user