后管:护理记录的标签操作

master
382696293@qq.com 2 years ago
parent a9b1cfd1b5
commit 7c6a792525

@ -50,19 +50,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectNursingLogListByVm" parameterType="UserNursingLogVm" resultMap="WxNursingLogResult">
<include refid="selectWxNursingLogVo"/>
<where>
<if test="userIdList != null ">
<if test="userIdList != null and userIdList.size > 0">
and user_id in
<foreach item="item" collection="userIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="instrumentIdList != null ">
<if test="instrumentIdList != null and instrumentIdList.size > 0">
and instrument_id in
<foreach item="item" collection="instrumentIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="modeIdList != null ">
<if test="modeIdList != null and modeIdList.size > 0 ">
and mode_id in
<foreach item="item" collection="modeIdList" open="(" separator="," close=")">
#{item}

@ -2,10 +2,15 @@ package com.flossom.system.controller;
import java.util.List;
import java.io.IOException;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.entity.WxNursingLog;
import com.flossom.common.core.domain.entity.WxUserMember;
import com.flossom.common.core.domain.req.UserNursingLogReq;
import com.flossom.common.core.domain.req.WxUserMemberVm;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.utils.poi.ExcelUtil;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
@ -14,15 +19,9 @@ import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
import com.flossom.system.service.IWxNursingLogService;
import com.flossom.system.service.IWxUserMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* Controller
@ -37,13 +36,16 @@ public class WxNursingLogController extends BaseController {
@Autowired
private IWxNursingLogService wxNursingLogService;
@Autowired
private IWxUserMemberService wxUserMemberService;
/**
*
*/
@RequiresPermissions("system:nursingLog:list")
@GetMapping("/list")
public TableDataInfo list(UserNursingLogReq userNursingLogReq) {
List<WxNursingLog> list = wxNursingLogService.selectWxNursingLogList(userNursingLogReq);
List<WxNursingLog> list = wxNursingLogService.selectWxNursingLogList(userNursingLogReq, true);
return getDataTable(list);
}
@ -54,7 +56,7 @@ public class WxNursingLogController extends BaseController {
@Log(title = "用户护理日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, UserNursingLogReq userNursingLogReq) {
List<WxNursingLog> list = wxNursingLogService.selectWxNursingLogList(userNursingLogReq);
List<WxNursingLog> list = wxNursingLogService.selectWxNursingLogList(userNursingLogReq, false);
ExcelUtil<WxNursingLog> util = new ExcelUtil<WxNursingLog>(WxNursingLog.class);
util.exportExcel(response, list, "用户护理日志数据");
}
@ -97,4 +99,40 @@ public class WxNursingLogController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(wxNursingLogService.deleteWxNursingLogByIds(ids));
}
/**
*
*/
@PostMapping("/allAddMiniProgramTag")
public R allAddMiniProgramTag(@RequestParam("tagIdList") List<Integer> tagIdList, @RequestBody UserNursingLogReq userNursingLogReq) {
if (tagIdList == null || tagIdList.size() == 0) {
logger.error("参数有误");
throw new ServiceException("参数有误");
}
List<WxNursingLog> list = wxNursingLogService.selectWxNursingLogList(userNursingLogReq, false);
if (list != null && list.size() > 0) {
List<Integer> collect = list.stream().map(wxNursingLog -> wxNursingLog.getUserId().intValue()).collect(Collectors.toList());
wxUserMemberService.batchAddMiniProgramTag(tagIdList, collect);
}
return R.ok();
}
/**
*
*/
@PostMapping("/allDelMiniProgramTag")
public R allDelMiniProgramTag(@RequestParam("tagIdList") List<Integer> tagIdList, @RequestBody UserNursingLogReq userNursingLogReq) {
if (tagIdList == null || tagIdList.size() == 0) {
logger.error("参数有误");
throw new ServiceException("参数有误");
}
List<WxNursingLog> list = wxNursingLogService.selectWxNursingLogList(userNursingLogReq, false);
if (list != null && list.size() > 0) {
List<Integer> collect = list.stream().map(wxNursingLog -> wxNursingLog.getUserId().intValue()).collect(Collectors.toList());
wxUserMemberService.batchDelMiniProgramTag(tagIdList, collect);
}
return R.ok();
}
}

@ -28,7 +28,7 @@ public interface IWxNursingLogService {
* @param wxNursingLog
* @return
*/
public List<WxNursingLog> selectWxNursingLogList(UserNursingLogReq wxNursingLog);
public List<WxNursingLog> selectWxNursingLogList(UserNursingLogReq wxNursingLog, boolean isPage);
/**
*

@ -59,7 +59,7 @@ public class WxNursingLogServiceImpl implements IWxNursingLogService {
*
*/
@Override
public List<WxNursingLog> selectWxNursingLogList(UserNursingLogReq userNursingLogReq) {
public List<WxNursingLog> selectWxNursingLogList(UserNursingLogReq userNursingLogReq, boolean isPage) {
// 查询条件
UserNursingLogVm userNursingLogVm = new UserNursingLogVm();
WxUserMemberVm wxUserMemberVm = new WxUserMemberVm();
@ -92,7 +92,9 @@ public class WxNursingLogServiceImpl implements IWxNursingLogService {
userNursingLogVm.setNursingTimeRange(userNursingLogReq.getNursingTimeRange());
userNursingLogVm.setUpdateTimeRange(userNursingLogReq.getUpdateTimeRange());
if(isPage) {
PageUtils.startPage();
}
List<WxNursingLog> wxNursingLogList = wxNursingLogMapper.selectNursingLogListByVm(userNursingLogVm);
if (wxNursingLogList != null && wxNursingLogList.size() > 0) {
wxNursingLogList.forEach(wxNursingLog -> {

@ -42,3 +42,21 @@ export function delNursingLog(id) {
method: 'delete'
})
}
// 全量添加小程序标签
export function allAddMiniProgramTag(tagIdList, data) {
return request({
url: '/system/nursingLog/allAddMiniProgramTag?tagIdList=' + tagIdList,
method: 'post',
data: data
})
}
// 全量删除小程序标签
export function allDelMiniProgramTag(tagIdList, data) {
return request({
url: '/system/nursingLog/allDelMiniProgramTag?tagIdList=' + tagIdList,
method: 'post',
data: data
})
}

@ -90,15 +90,17 @@
</div>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-select v-model="batchOperateValue" placeholder="批量操作" size="mini" clearable>
<el-select v-model="batchOperate.operateValue" placeholder="批量操作" size="mini" clearable>
<el-option label="批量添加小程序标签" :value="1"></el-option>
<el-option label="批量删除小程序标签" :value="2"></el-option>
<el-option label="全量添加小程序标签" :value="3"></el-option>
<el-option label="导出批量数据" :value="12"></el-option>
<el-option label="导出全量数据" :value="13"></el-option><!-- @click="handleExport" -->
<el-option label="全量删除小程序标签" :value="4"></el-option>
<el-option label="导出批量数据" :value="5"></el-option>
<el-option label="导出全量数据" :value="6"></el-option><!-- @click="handleExport" -->
</el-select>
</el-col>
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-warning" size="mini" @click="batchOperate()"></el-button>
<el-button type="primary" plain icon="el-icon-warning" size="mini" @click="batchOperatePop()"></el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"/>
</el-row>
@ -150,16 +152,45 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 小程序标签批量操作 -->
<el-dialog :title="title" :visible.sync="batchOperate.tagOperateVisible" width="50%"
:before-close="cancelMiniProgramDialog">
<el-form ref="miniProgramForm" :model="miniProgramForm" :rules="batchMiniProgramRules" label-width="150px">
<el-row>
<el-col :span="100">
<el-form-item label="小程序标签" prop="tagIdArray" label-width="100px">
<treeselect v-model="miniProgramForm.tagIdArray" :options="batchOperate.tagTree" :multiple="true"
:show-count="true" placeholder="请选择小程序标签" :disable-branch-nodes="true"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelMiniProgramDialog(false)"> </el-button>
<el-button type="primary" @click="submitBatchOperate"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listNursingLog, getNursingLog, delNursingLog, addNursingLog, updateNursingLog} from "@/api/system/nursingLog";
import {listNursingLog, allAddMiniProgramTag, allDelMiniProgramTag} from "@/api/system/nursingLog";
import {listAllMode, listInstrument} from "@/api/system/instrument";
import {getMiniProgramTags, getRegionByPid, getWecomTags} from "@/api/system/member";
import {
batchAddMiniProgramTag, batchDelMiniProgramTag,
getMiniProgramTags,
getRegionByPid,
getWecomTags
} from "@/api/system/member";
import {tagTreeSelect} from "@/api/system/wechatTab";
import Treeselect from "@riophae/vue-treeselect";
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
name: "NursingLog",
components: {Treeselect},
data() {
return {
//
@ -215,6 +246,20 @@ export default {
modeList: [],
//
instrumentList: [],
//
batchOperate: {
operateValue: null,
tagOperateVisible: false,
title: null,
tagTree: [],
userIdList: [],
},
miniProgramForm: {
tagIdArray: [],
},
//
form: {},
//
@ -226,7 +271,11 @@ export default {
{required: true, message: "设备id不能为空", trigger: "blur"}
],
},
batchMiniProgramRules: {
tagIdArray: [
{required: true, message: '请选择小程序标签', trigger: 'change'},
],
}
};
},
created() {
@ -289,6 +338,7 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.batchOperate.userIdList = selection.map(item => item.userId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
@ -298,10 +348,138 @@ export default {
...this.queryParams
}, `nursingLog_${new Date().getTime()}.xlsx`)
},
/** 批量操作按钮,显示批量操作弹窗 */
batchOperatePop() {
if (this.batchOperate.operateValue == null) {
this.$message({
message: '请选择要批量操作类型',
type: 'warning',
})
return
} else {
/* 批量操作 */
if (this.batchOperate.operateValue == 1 || this.batchOperate.operateValue == 2 || this.batchOperate.operateValue == 5) {
if (this.ids.length == 0) {
this.$message({
message: '请选择要操作的数据',
type: 'warning',
})
return
}
if (this.batchOperate.operateValue == 1) {
this.batchOperate.title = '批量添加小程序标签';
//
this.getTagTree();
this.batchOperate.tagOperateVisible = true;
}
if (this.batchOperate.operateValue == 2) {
this.batchOperate.title = '批量删除小程序标签';
//
this.getTagTree();
this.batchOperate.tagOperateVisible = true;
}
if (this.batchOperate.operateValue == 5) {
console.log("批量导出数据");
}
} else {
/* 全量操作 */
if (this.batchOperate.operateValue == 3) {
this.batchOperate.title = '全量添加小程序标签';
//
this.getTagTree();
this.batchOperate.tagOperateVisible = true;
}
if (this.batchOperate.operateValue == 4) {
this.batchOperate.title = '全量删除小程序标签';
//
this.getTagTree();
this.batchOperate.tagOperateVisible = true;
}
if (this.batchOperate.operateValue == 6) {
console.log("全量导出数据");
}
}
}
},
/** 查询小程序标签树 */
getTagTree() {
tagTreeSelect({type: 1}).then((response) => {
this.batchOperate.tagTree = response.data
})
},
//
cancelMiniProgramDialog(isClose) {
this.$refs.miniProgramForm.clearValidate();
this.miniProgramForm.tagIdArray = [];
if (isClose) {
this.batchOperate.title = null;
this.batchOperate.tagOperateVisible = false;
}
},
/* 批量操作提交按钮 */
submitBatchOperate() {
//
if (this.batchOperate.operateValue == 1) {
this.$refs['miniProgramForm'].validate((valid) => {
if (valid) {
batchAddMiniProgramTag(
this.miniProgramForm.tagIdArray,
Array.from(new Set(this.batchOperate.userIdList))
).then((Response) => {
this.$modal.msgSuccess('批量添加小程序标签成功');
this.cancelMiniProgramDialog(true)
this.getList();
})
}
})
}
//
if (this.batchOperate.operateValue == 2) {
this.$refs['miniProgramForm'].validate((valid) => {
if (valid) {
batchDelMiniProgramTag(
this.miniProgramForm.tagIdArray,
Array.from(new Set(this.batchOperate.userIdList))
).then((Response) => {
this.$modal.msgSuccess('批量删除小程序标签成功')
this.cancelMiniProgramDialog(true)
this.getList();
})
}
})
}
//
if (this.batchOperate.operateValue == 3) {
this.$refs['miniProgramForm'].validate((valid) => {
if (valid) {
allAddMiniProgramTag(
this.miniProgramForm.tagIdArray,this.queryParams
).then((Response) => {
this.$modal.msgSuccess('全量添加小程序标签成功')
this.cancelMiniProgramDialog(true)
this.getList();
})
}
})
}
//
if (this.batchOperate.operateValue == 4) {
this.$refs['miniProgramForm'].validate((valid) => {
if (valid) {
allDelMiniProgramTag(
this.miniProgramForm.tagIdArray,this.queryParams
).then((Response) => {
this.$modal.msgSuccess('全量删除小程序标签成功')
this.cancelMiniProgramDialog(true)
this.getList();
})
}
})
}
},
//
queryInstrument() {
listInstrument({}).then(response => {

Loading…
Cancel
Save