Browse Source

merge

master
pengjun 2 years ago
parent
commit
d50adfc22d
  1. 2
      src/components/patientRegister/Camera.vue
  2. 298
      src/components/patientRegister/MergeAsbitem.vue
  3. 2
      src/components/patientRegister/PatientRegisterEdit.vue
  4. 35
      src/utlis/proFunc.js

2
src/components/patientRegister/Camera.vue

@ -166,6 +166,7 @@ export default {
);
// base64url
this.imgSrc = this.thisCancas.toDataURL("image/png");
console.log('this.imgSrc',this.imgSrc);
},
//
uploadPicture() {
@ -182,6 +183,7 @@ export default {
//console.log('body',body)
this.patientRegister.photo = this.imgSrc;
//id
postapi(`/api/app/patient-register/up-load-img`, uploadPhoto)
.then((res) => {

298
src/components/patientRegister/MergeAsbitem.vue

@ -1,34 +1,39 @@
<template>
<div>
<div>
<el-table :data="tableData" border style="width: 100%" row-key="id" height="300" highlight-current-row size="small">
<el-table-column label="组合项目" width="120" prop="asbitemName" />
<el-table-column label="操作" width="130" prop="operate">
<div style="margin-top: -20px; margin-bottom: 5px;">
<span>项目类别</span>
<el-cascader :options="dict.itemTypeTree" v-model="itemTypeIds" style="margin-left: 3px;width:160px;"
:props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }" :show-all-levels="false"
clearable filterable @change="getAsbItemByItemType" size="small">
</el-cascader>
</div>
<el-table :data="tableData" border style="width: 100%" row-key="id" height="300" highlight-current-row size="small"
@selection-change="handleSelectionChange" ref="tableData">
<el-table-column type="selection" />
<el-table-column label="项目类别" width="120" prop="itemTypeName" />
<el-table-column label="组合项目" width="140" prop="asbitemName" />
<!-- isItemResultMerger 项目是否可以合并 -->
<el-table-column label="已合并" width="60" prop="isAsbitemMerger" align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.operate" placeholder="请操作方式" size="small" :disabled="scope.row.disabled"
@change="changeOperate(scope.row)">
<el-option v-for="(item, index) in options" :key="index" :label="item.label" :value="item.value" />
</el-select>
<div>{{ scope.row.isAsbitemMerger == 'Y' ? '是' : '否' }}</div>
</template>
</el-table-column>
<el-table-column label="条码分组" width="120" prop="sampleGroupName" />
<el-table-column label="检验申请号" width="180" prop="lisRequestNo">
<el-table-column label="合并后项目名称" width="190" prop="mergerAsbitemName">
<template slot-scope="scope">
<el-select v-model="scope.row.lisRequestNo" size="small" :disabled="scope.row.disabled">
<el-option v-for="(item, index) in lisRequestNos" :key="index" :label="item.lisRequestNo"
:value="item.lisRequestId" />
</el-select>
<div>{{ scope.row.isAsbitemMerger == 'Y' ? scope.row.mergerAsbitemName : '' }}</div>
</template>
</el-table-column>
</el-table>
</div>
<!-- 按钮区域 -->
<div style="display: flex; margin-top: 30px; margin-left: 280px">
<div style="margin-left: 10px">
<el-button type="primary" @click="submit" style="width:80px;">合并项目</el-button>
<el-button type="primary" @click="mergeSubmit" style="width:80px;">合并项目</el-button>
</div>
<div style="margin-left: 10px">
<el-button type="info" @click="lisPrint('0002', false)" style="width:80px;">取消合并</el-button>
<el-button type="info" @click="unMergeSubmit" style="width:80px;">取消合并</el-button>
</div>
<div style="margin-left: 10px">
<el-button type="danger" @click="patientRegister.mergeAsbitemVisble = false" style="width:80px;">关闭</el-button>
@ -41,19 +46,22 @@
import { mapState } from "vuex";
import { getapi, postapi, putapi, deletapi } from "@/api/api";
import { examinationgender } from "@/request/systemapi";
import { dddw, arrayExistObj } from "../../utlis/proFunc";
import { dddw, arrayExistObj, deepCopy } from "../../utlis/proFunc";
import { getTreeAllChildIdsById } from "../../utlis/tree";
// import
export default {
props: ["id", "brushTimes"],
props: ["id", "organizationUnitId", "brushTimes"],
data() {
return {
tableData: [], //
tableData: [], //
tableDataAll: [], //
itemTypeIds: [], //ID
options: [
{ label: "无", value: "no" },
{ label: "追加到以前条码", value: "append" },
{ label: "申请新的条码", value: "new" },
], //
lisRequestNos: [], //
selectedData: [], //
};
},
@ -63,131 +71,185 @@ export default {
this.getAsbItemList(this.id);
},
computed: {
...mapState(["patientRegister"]),
...mapState(["dict", "customerOrg", "patientRegister"]),
},
methods: {
parseData(asbItem) {
// "registerAsbitemId": "3a0d2e90-db36-09fe-4210-53fadb4f7d02",
// asbitemId": "3a0c5600-ae78-9ed4-e3c1-993ef41d3c51",
// "asbitemName": "",
// "isCharge": "N",
// "completeFlag": "0",
// "sampleGroupId": "3a0c55c2-0f26-71a1-1f1a-ebbcbd77105b",
// "sampleGroupName": "1",
// "lisRequestId": "3a0d2fa9-aaba-4837-0775-20d13937f357",
// "lisRequestNo": "T202308220016"
if (asbItem.length < 1) return;
let lfind = -1;
this.lisRequestNos = [];
asbItem.forEach((e) => {
if (e.lisRequestNo) {
e["operate"] = "no";
e["disabled"] = true;
lfind = arrayExistObj(
this.lisRequestNos,
"lisRequestNo",
e.lisRequestNo
);
if (lfind == -1) {
this.lisRequestNos.push({
sampleGroupId: e.sampleGroupId,
lisRequestNo: e.lisRequestNo,
lisRequestId: e.lisRequestId,
});
}
handleSelectionChange(v) {
console.log('this.selectedData ,v', this.selectedData,v);
if (!v || v.length < 1) {
this.selectedData = v;
return;
}
this.selectedData = v;
//
// let currSelectedIds = [];
// let finalSelected = deepCopy(v); //
// v.forEach(e => {
// currSelectedIds.push(e.registerAsbitemId);
// });
// console.log('currSelectedIds', currSelectedIds);
// //
// this.selectedData.forEach(e => {
// //
// if (currSelectedIds.indexOf(e.registerAsbitemId) < 0) {
// for (let i = finalSelected.length - 1; i > -1; i--) {
// if(finalSelected[i].registerCheckId == e.registerCheckId){
// finalSelected.splice(i,1);
// }
// }
// }
// });
// //
// let currMergeIds = [];
// currSelectedIds = [];
// finalSelected.forEach(e => {
// currSelectedIds.push(e.registerAsbitemId);
// if(currMergeIds.indexOf(e.registerCheckId) < 0){
// currMergeIds.push(e.registerCheckId);
// }
// });
// this.tableData.forEach(e =>{
// if(currMergeIds.indexOf(e.registerCheckId) > - 1){
// if(currSelectedIds.indexOf(e.registerAsbitemId) < 0){
// finalSelected.push(e);
// }
// }
// });
// this.selectedData = deepCopy(finalSelected);
// console.log('this.selectedData', this.selectedData);
// this.$nextTick(function () {
// //this.$refs['tableData'].clearSelection();
// this.selectedData.forEach(row => {
// this.$refs['tableData'].toggleRowSelection(row,true)
// })
// });
},
//
getAsbItemByItemType() {
let itemTypeIdsChild = [], id = '';
if (this.itemTypeIds && this.itemTypeIds.length > 0) {
id = this.itemTypeIds[this.itemTypeIds.length - 1];
itemTypeIdsChild = getTreeAllChildIdsById(this.dict.itemTypeTree, "treeChildren", "id", id);
if (!itemTypeIdsChild) {
itemTypeIdsChild = [id];
} else {
e["disabled"] = false;
itemTypeIdsChild.push(id);
}
return e;
});
}
if (!itemTypeIdsChild || itemTypeIdsChild.length < 1) {
this.tableData = deepCopy(this.tableDataAll);
} else {
this.tableData = [];
this.tableDataAll.forEach(e => {
if (itemTypeIdsChild.indexOf(e.itemTypeId) < 0) {
this.tableData.push(e);
}
});
}
},
getAsbItemList(id) {
this.tableDataAll = [];
this.tableData = [];
postapi(
`/api/app/lisrequest/getregisterasbitemlisrequest?PatientRegisterId=${id}`
// /api/app/registerasbitem/getmergeregisterasbitemlist?PatientRegisterId=3fa85f64-5717-4562-b3fc-2c963f66afa6
// "registerAsbitemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
// "asbitemName": "string",
// "isItemResultMerger": "string",
// "itemTypeName": "string",
// "registerCheckId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
// "isAsbitemMerger": "string",
// "mergerAsbitemName": "string"
getapi(
`/api/app/registerasbitem/getmergeregisterasbitemlist?PatientRegisterId=${id}`
).then((res) => {
this.tableData = res.data;
this.parseData(this.tableData);
this.tableDataAll = res.data;
this.getAsbItemByItemType();
});
},
//
changeOperate(row) {
let lfind = -1;
if (row.operate == "append") {
if (row.sampleGroupId) {
lfind = arrayExistObj(
this.lisRequestNos,
"sampleGroupId",
row.sampleGroupId
);
if (lfind > -1) {
row.lisRequestNo = this.lisRequestNos[lfind].lisRequestNo;
row.lisRequestId = this.lisRequestNos[lfind].lisRequestId;
}
}
} else {
row.lisRequestNo = "";
row.lisRequestId = "";
//
mergeSubmit() {
let registerAsbitemIds = [];
this.selectedData.forEach(e =>{
registerAsbitemIds.push(e.registerAsbitemId);
});
if(registerAsbitemIds.length == 0){
this.$message.warning("请勾选要合并的项目!");
return;
}
},
//
submit() {
let append = [],
news = [];
let validMsg = "",
lfind = -1;
this.tableData.forEach((item) => {
if (item.operate == "append") {
if (item.lisRequestId) {
lfind = arrayExistObj(append, "lisRequestId", item.lisRequestId);
if ((lfind = -1)) {
append.push({
lisRequestId: item.lisRequestId,
registerAsbitemIds: [item.registerAsbitemId],
});
} else {
append[lfind]["registerAsbitemIds"].push(item.registerAsbitemId);
}
} else {
validMsg = row.asbitemName + "项目,未选择追加到哪个检验申请单号!";
let body={
registerAsbitemIds,
organizationUnitId:this.organizationUnitId
};
postapi("/api/app/registerasbitem/mergeregisterasbitem", body).then(
(res) => {
if (res.Code != -1) {
this.$message.success("操作成功!");
this.getAsbItemList(this.id);
}
} else if (item.operate == "new") {
news.push(item.registerAsbitemId);
}
);
},
//
unMergeSubmit() {
let registerCheckIds = [];
this.selectedData.forEach(e =>{
if(registerCheckIds.indexOf(e.registerCheckId) < 0){
registerCheckIds.push(e.registerCheckId);
}
});
if (validMsg) {
this.$message.warning(validMsg);
if(registerCheckIds.length == 0){
this.$message.warning("未选择已合并的项目,不可执行此操作!");
return;
}
if (append.length > 0) {
postapi("/api/app/lisrequest/appendlisrequestmany", append).then(
(res) => {
if (res.code != -1) {
this.$message.success("项目追加到检验申请单成功!");
this.getAsbItemList(this.id);
}
}
);
}
if (news.length > 0) {
postapi("/api/app/lisrequest/addlisrequest", news).then((res) => {
console.log('registerCheckIds',registerCheckIds);
let body={
registerCheckIds,
organizationUnitId:this.organizationUnitId
};
postapi("/api/app/registerasbitem/cancelmergeregisterasbitem", body).then(
(res) => {
if (res.code != -1) {
this.$message.success("项目创建检验申请单成功!");
this.$message.success("操作成功!");
this.getAsbItemList(this.id);
}
});
}
}
);
},
},
//

2
src/components/patientRegister/PatientRegisterEdit.vue

@ -451,7 +451,7 @@
<!-- 手动合并项目 -->
<el-dialog title="手动合并项目" :visible.sync="patientRegister.mergeAsbitemVisble" width="600px" height="400"
:show-close="false" :close-on-click-modal="false" :append-to-body="true">
<MergeAsbitem :id="form.id" :brushTimes="brushTimes" />
<MergeAsbitem :id="form.id" :organizationUnitId="form.organizationUnitId" :brushTimes="brushTimes" />
</el-dialog>

35
src/utlis/proFunc.js

@ -176,38 +176,3 @@ exports.birthdayToAge = function (birthday) {
return Math.floor((new Date().getTime() - new Date(birthday).getTime())/yearInMs)
}
//通过ID值,找出所有父节点值
function getTreeParents(tree,nodeName,parentIdName,idName,idVal,parentIds){
for(let i=0;i<tree.length;i++){
parentIds = [];
if(tree[i][idName] == idVal){
break;
}else{
parentIds.push(tree[i][idName]);
getTreeParents(tree[i][nodeName],nodeName,parentIdName,idName,idVal,parentIds);
}
}
}
exports.getTreeParents = getTreeParents;
//通过ID值,找出所有子节点值
function getTreeAllChilds(tree,nodeName,idName,childIds){
tree.forEach(e =>{
childIds.push(e[idName]);
getTreeAllChilds(e[nodeName],nodeName,idName,childIds);
});
return nodeIds;
}
function getTreeChilds(tree,nodeName,parentIdName,idName,idVal){
for(let i=0;i<tree.length;i++){
let childIds = [];
if(tree[i][idName] == idVal){
break;
}else{
getTreeParents(tree[i][nodeName],nodeName,parentIdName,idName,idVal);
}
}
}
exports.getTreeChilds = getTreeChilds;
Loading…
Cancel
Save