pengjun 3 years ago
parent
commit
c63125379d
  1. 4
      src/api/request.js
  2. 316
      src/components/patientRegister/PatientRegisterItem.vue
  3. 6
      src/utlis/istoken.js
  4. 7
      src/utlis/proFunc.js

4
src/api/request.js

@ -14,8 +14,8 @@ const instance = axios.create({
//请求拦截 //请求拦截
instance.interceptors.request.use( instance.interceptors.request.use(
async function (config) { async function (config) {
console.log('old token:',localStorage.getItem("token"))
console.log('old expires_in',localStorage.getItem("expires_in"))
//console.log('old token:',localStorage.getItem("token"))
//console.log('old expires_in',localStorage.getItem("expires_in"))
await yztoken(); await yztoken();
let token = localStorage.getItem("token"); let token = localStorage.getItem("token");

316
src/components/patientRegister/PatientRegisterItem.vue

@ -26,14 +26,13 @@
</el-button> </el-button>
</div> </div>
<div style="margin-left: 10px"> <div style="margin-left: 10px">
<el-button type="success" @click="onSubmit">保存 <i class="el-icon-check"></i>
<el-button type="success" @click="onSubmit('保存')">保存 <i class="el-icon-check"></i>
</el-button> </el-button>
</div> </div>
</div> </div>
<div class="mainareaBox"> <div class="mainareaBox">
<el-table :data="patientRegister.patientRegisterAbs" height="350"
:summary-method="getSummaries" show-summary
<el-table :data="patientRegister.patientRegisterAbs" height="350" :summary-method="getSummaries" show-summary
@selection-change="selecteditems" size="small"> @selection-change="selecteditems" size="small">
<!-- temporaryselection personnelUnit.nogroupselected--> <!-- temporaryselection personnelUnit.nogroupselected-->
<el-table-column type="selection"></el-table-column> <el-table-column type="selection"></el-table-column>
@ -116,44 +115,65 @@ export default {
// ] // ]
// //
batchEditAsb(body,msg){
batchEditAsb(body, msg) {
console.log(`/api/app/registerasbitem/updatemany`, body) console.log(`/api/app/registerasbitem/updatemany`, body)
postapi(`/api/app/registerasbitem/updatemany`, body) postapi(`/api/app/registerasbitem/updatemany`, body)
.then((res) => {
console.log("onSubmit", res);
if (res.code == 1) {
if(msg){
//
this.getPatientRegisterAbs(this.patientRegisterForm.id)
this.$message.success(`${msg}操作成功`);
}
}
})
.catch((err) => {
this.$message({ type: "error", message: `${msg}操作失败,原因:${err}` });
});
.then((res) => {
console.log("onSubmit", res);
if (res.code == 1) {
if (msg) {
//
this.getPatientRegisterAbs(this.patientRegisterForm.id)
this.$message.success(`${msg}操作成功`);
}
}
})
.catch((err) => {
this.$message({ type: "error", message: `${msg}操作失败,原因:${err}` });
});
}, },
// //
onSubmit() {
let body = []
onSubmit(msg) {
let body = [],insBody=[]
if(!this.patientRegisterForm.id) return
if (this.patientRegister.patientRegisterAbs.length < 1) { if (this.patientRegister.patientRegisterAbs.length < 1) {
alert("暂无可操作的数据") alert("暂无可操作的数据")
return return
} }
for (let i = 0; i < this.patientRegister.patientRegisterAbs.length; i++) { for (let i = 0; i < this.patientRegister.patientRegisterAbs.length; i++) {
body.push({
registerAsbitemId: this.patientRegister.patientRegisterAbs[i].id,
input: {
chargePrice: this.patientRegister.patientRegisterAbs[i].chargePrice,
payTypeFlag: this.patientRegister.patientRegisterAbs[i].payTypeFlag,
if(this.patientRegister.patientRegisterAbs[i].id){
body.push({
registerAsbitemId: this.patientRegister.patientRegisterAbs[i].id,
input: {
chargePrice: this.patientRegister.patientRegisterAbs[i].chargePrice,
payTypeFlag: this.patientRegister.patientRegisterAbs[i].payTypeFlag,
isCharge: this.patientRegister.patientRegisterAbs[i].isCharge,
amount: this.patientRegister.patientRegisterAbs[i].amount,
groupPackageId: this.patientRegister.patientRegisterAbs[i].groupPackageId
}
})
}else{
insBody.push({
asbitemId: this.patientRegister.patientRegisterAbs[i].id,
patientRegisterId: this.patientRegisterForm.id,
standardPrice: this.patientRegister.patientRegisterAbs[i].price,
chargePrice: this.patientRegister.patientRegisterAbs[i].price,
payTypeFlag:this.patientRegister.patientRegisterAbs[i].payTypeFlag,
isCharge: this.patientRegister.patientRegisterAbs[i].isCharge, isCharge: this.patientRegister.patientRegisterAbs[i].isCharge,
amount: this.patientRegister.patientRegisterAbs[i].amount, amount: this.patientRegister.patientRegisterAbs[i].amount,
groupPackageId: this.patientRegister.patientRegisterAbs[i].groupPackageId groupPackageId: this.patientRegister.patientRegisterAbs[i].groupPackageId
}
})
})
}
}
if(body.length > 0 && insBody.length > 0){
this.batchAddAsb(insBody, '');
this.batchEditAsb(body, msg);
}else if(body.length > 0 && insBody.length < 1){
this.batchEditAsb(body, msg);
}else if(body.length < 1 && insBody.length > 0){
this.batchAddAsb(insBody, msg);
} }
this.batchEditAsb(body,'保存');
}, },
// //
@ -164,15 +184,15 @@ export default {
}, },
// //
batchAddAsb(body,msg){
batchAddAsb(body, msg) {
console.log(`/api/app/registerasbitem/createmany?CustomerOrgId=${this.patientRegisterForm.customerOrgId}`, body) console.log(`/api/app/registerasbitem/createmany?CustomerOrgId=${this.patientRegisterForm.customerOrgId}`, body)
postapi(`/api/app/registerasbitem/createmany?CustomerOrgId=${this.patientRegisterForm.customerOrgId}`, body) postapi(`/api/app/registerasbitem/createmany?CustomerOrgId=${this.patientRegisterForm.customerOrgId}`, body)
.then((res) => { .then((res) => {
console.log("addAbs", res);
console.log("batchAddAsb", res);
if (res.code == 1) { if (res.code == 1) {
// //
this.getPatientRegisterAbs(this.patientRegisterForm.id) this.getPatientRegisterAbs(this.patientRegisterForm.id)
if(msg) this.$message.success(`${msg}操作成功`);
if (msg) this.$message.success(`${msg}操作成功`);
} }
}) })
.catch((err) => { .catch((err) => {
@ -227,10 +247,10 @@ export default {
}) })
} }
this.batchAddAsb(body,'添加组合项目');
this.batchAddAsb(body, '添加组合项目');
}, },
// //
selecteditems(val) { selecteditems(val) {
@ -238,7 +258,7 @@ export default {
}, },
// //
batchDelAsb(body,msg){
batchDelAsb(body, msg) {
console.log(`/api/app/registerasbitem/deletemany`, body) console.log(`/api/app/registerasbitem/deletemany`, body)
postapi(`/api/app/registerasbitem/deletemany`, body) postapi(`/api/app/registerasbitem/deletemany`, body)
.then((res) => { .then((res) => {
@ -247,12 +267,12 @@ export default {
// //
this.getAsbItemByItemTypeAll() this.getAsbItemByItemTypeAll()
if(msg){
if (msg) {
// //
this.getPatientRegisterAbs(this.patientRegisterForm.id) this.getPatientRegisterAbs(this.patientRegisterForm.id)
this.$message.success(`${msg}操作成功`); this.$message.success(`${msg}操作成功`);
} }
} }
}) })
.catch((err) => { .catch((err) => {
@ -289,7 +309,7 @@ export default {
body = { registerAsbitemIds } body = { registerAsbitemIds }
this.batchDelAsb(body,'删除组合项目');
this.batchDelAsb(body, '删除组合项目');
}, },
@ -319,18 +339,18 @@ export default {
// //
registerAsbitem(body) {
console.log("registerAsbitem");
postapi(
`/api/app/register-asbitem?CustomerOrgId=${this.patientRegisterForm.customerOrgId}`,
body
).then((res) => {
console.log("medicalPackageAsb", res);
if (res.code == 1) {
//
}
});
},
// registerAsbitem(body) {
// console.log("registerAsbitem");
// postapi(
// `/api/app/register-asbitem?CustomerOrgId=${this.patientRegisterForm.customerOrgId}`,
// body
// ).then((res) => {
// console.log("medicalPackageAsb", res);
// if (res.code == 1) {
// //
// }
// });
// },
// //
getCustomerOrgGroupAsb(customerOrgGroupId, oldVal) { getCustomerOrgGroupAsb(customerOrgGroupId, oldVal) {
@ -342,114 +362,87 @@ export default {
this.patientRegister.customerOrgGroupAsb = res.data; this.patientRegister.customerOrgGroupAsb = res.data;
// //
this.removeGroupPackageAsb(oldVal);
this.removeGroupPackageAsb();
// //
this.addCustomerOrgGroupAsb(customerOrgGroupId);
this.addCustomerOrgGroupAsb(customerOrgGroupId);
} }
}); });
}, },
// //
getMedicalPackageAsb(medicalPackageId, oldVal) {
console.log(
`/api/app/medical-package-detail/medical-package-in-asbitem?MedicalPackageId=${medicalPackageId}`
);
getapi(
`/api/app/medical-package-detail/medical-package-in-asbitem?MedicalPackageId=${medicalPackageId}`
).then((res) => {
getMedicalPackageAsb(medicalPackageId) {
console.log(`/api/app/medical-package-detail/medical-package-in-asbitem?MedicalPackageId=${medicalPackageId}`);
getapi(`/api/app/medical-package-detail/medical-package-in-asbitem?MedicalPackageId=${medicalPackageId}`)
.then((res) => {
console.log("getMedicalPackageAsb", res); console.log("getMedicalPackageAsb", res);
if (res.code == 1) { if (res.code == 1) {
this.patientRegister.medicalPackageAsb = res.data; this.patientRegister.medicalPackageAsb = res.data;
//
this.addMedicalPackageAsb(medicalPackageId);
// //
this.removeGroupPackageAsb(oldVal);
this.removeGroupPackageAsb();
//
this.getAsbItemByItemType()
//
this.addMedicalPackageAsb(medicalPackageId);
} }
}); });
}, },
// //
addCustomerOrgGroupAsb(groupPackageId) { addCustomerOrgGroupAsb(groupPackageId) {
console.log('addCustomerOrgGroupAsb')
let finded = false;
let body = []
let payTypeFlag = '0'
let lfind = -1
let editCount = 0
if (this.patientRegisterForm.customerOrgId != this.dict.personOrgId) payTypeFlag = '1'
for (let i = 0; i < this.patientRegister.customerOrgGroupAsb.length; i++) { for (let i = 0; i < this.patientRegister.customerOrgGroupAsb.length; i++) {
finded = false;
for (let j = 0; j < this.patientRegister.patientRegisterAbs.length; j++) {
if (this.patientRegister.customerOrgGroupAsb[i].asbitemId == this.patientRegister.patientRegisterAbs[j].asbitemId) {
this.patientRegister.patientRegisterAbs[j].groupPackageId = groupPackageId
this.patientRegisterAbsEdit.push({ ...this.patientRegister.patientRegisterAbs[j] })
finded = true
}
lfind = arrayExistObj(this.patientRegister.patientRegisterAbs,'asbitemId',this.patientRegister.customerOrgGroupAsb[i].asbitemId)
if(lfind > - 1){
this.patientRegister.patientRegisterAbs[lfind] = groupPackageId
editCount++
continue
} }
if (!finded) {
let asbItem = {
asbitemId: this.patientRegister.customerOrgGroupAsb[i].id, // string($uuid)
asbitemName: this.patientRegister.customerOrgGroupAsb[i].displayName, // string($uuid)
patientRegisterId: this.patientRegisterForm.id, //string($uuid)
standardPrice: this.patientRegister.customerOrgGroupAsb[i].price, //number($double)
chargePrice: this.patientRegister.customerOrgGroupAsb[i].price, // number($double)
payTypeFlag: "1", // string ,021
isCharge: "N", // string
lisRequestId: null, // string($uuid)LISID
amount: 1, // integer($int32)
groupPackageId: groupPackageId, // string($uuid) ID
};
console.log('i', i, asbItem)
//
let exist = arrayExistObj(this.patientRegisterAbsDel, 'asbitemId', asbItem.asbitemId)
if (exist > -1) {
this.patientRegister.patientRegisterAbs.push({ ...this.patientRegisterAbsDel[exist] })
this.patientRegisterAbsDel.splice(exist, 1)
} else {
this.patientRegister.patientRegisterAbs.push(asbItem);
}
let pojo = {
asbitemId: this.patientRegister.customerOrgGroupAsb[i].asbitemId,
patientRegisterId: this.patientRegisterForm.id,
standardPrice: this.patientRegister.customerOrgGroupAsb[i].price,
chargePrice: this.patientRegister.customerOrgGroupAsb[i].customerOrgGroupDetailPrice,
payTypeFlag,
isCharge: "N",
amount: 1,
groupPackageId: groupPackageId
} }
body.push(pojo)
this.patientRegister.patientRegisterAbs.push({...pojo,asbitemName:this.patientRegister.customerOrgGroupAsb[i].displayName})
} }
if(editCount>0) this.onSubmit()
if (body.length > 0 && this.patientRegisterForm.id) this.batchAddAsb(body, '更换分组');
}, },
// //
addMedicalPackageAsb(groupPackageId) { addMedicalPackageAsb(groupPackageId) {
let finded = false;
let body = []
let payTypeFlag = '0'
if (this.patientRegisterForm.customerOrgId != this.dict.personOrgId) payTypeFlag = '1'
for (let i = 0; i < this.patientRegister.medicalPackageAsb.length; i++) { for (let i = 0; i < this.patientRegister.medicalPackageAsb.length; i++) {
finded = false;
for (let j = 0; j < this.patientRegister.patientRegisterAbs.length; j++) {
if (this.patientRegister.medicalPackageAsb[i].asbitemId == this.patientRegister.patientRegisterAbs[j].asbitemId) {
this.patientRegister.patientRegisterAbs[j].groupPackageId = groupPackageId
this.patientRegisterAbsEdit.push({ ...this.patientRegister.patientRegisterAbs[j], })
finded = true
}
}
if (!finded) {
let asbItem = {
asbitemId: this.patientRegister.medicalPackageAsb[i].id, // string($uuid)
asbitemName: this.patientRegister.medicalPackageAsb[i].displayName, // string($uuid)
patientRegisterId: this.patientRegisterForm.id, //string($uuid)
standardPrice: this.patientRegister.medicalPackageAsb[i].price, //number($double)
chargePrice: this.patientRegister.medicalPackageAsb[i].price, // number($double)
payTypeFlag: "0", // string ,021
isCharge: "N", // string
lisRequestId: null, // string($uuid)LISID
amount: 1, // integer($int32)
groupPackageId: groupPackageId, // string($uuid) ID
};
//
let exist = arrayExistObj(this.patientRegisterAbsDel, 'asbitemId', asbItem.asbitemId)
if (exist > -1) {
this.patientRegister.patientRegisterAbs.push({ ...this.patientRegisterAbsDel[exist] })
this.patientRegisterAbsDel.splice(exist, 1)
} else {
this.patientRegisterAbsAdd.push(asbItem);
}
let pojo = {
asbitemId: this.patientRegister.medicalPackageAsb[i].id,
patientRegisterId: this.patientRegisterForm.id,
standardPrice: this.patientRegister.medicalPackageAsb[i].price,
chargePrice: this.patientRegister.medicalPackageAsb[i].price,
payTypeFlag,
isCharge: "N",
amount: 1,
groupPackageId: groupPackageId
} }
body.push(pojo)
this.patientRegister.patientRegisterAbs.push({...pojo,asbitemName:this.patientRegister.medicalPackageAsb[i].displayName})
} }
if (body.length > 0 && this.patientRegisterForm.id) this.batchAddAsb(body, '更换套餐');
}, },
// //
@ -457,14 +450,28 @@ export default {
let body = {} let body = {}
let registerAsbitemIds = [] let registerAsbitemIds = []
let chargeComplete = '' let chargeComplete = ''
//
if(!this.patientRegisterForm.id){
this.patientRegister.patientRegisterAbs = []
return
}
// groupPackageId null // groupPackageId null
for (let i = 0; i < this.patientRegister.patientRegisterAbs.length; i++) { for (let i = 0; i < this.patientRegister.patientRegisterAbs.length; i++) {
if(!this.patientRegister.patientRegisterAbs[i].id){
this.patientRegister.patientRegisterAbs.splice(i, 1)
i--
continue
}
if (this.patientRegister.patientRegisterAbs[i].isCharge == 'Y' || this.patientRegister.patientRegisterAbs[i].checkCompleteFlag != '0') { if (this.patientRegister.patientRegisterAbs[i].isCharge == 'Y' || this.patientRegister.patientRegisterAbs[i].checkCompleteFlag != '0') {
chargeComplete += this.patientRegister.patientRegisterAbs[i].asbitemName + ',' chargeComplete += this.patientRegister.patientRegisterAbs[i].asbitemName + ','
this.patientRegister.patientRegisterAbs[i].groupPackageId = null this.patientRegister.patientRegisterAbs[i].groupPackageId = null
} else{
registerAsbitemIds.push(this.patientRegister.patientRegisterAbs[i].id)
} else {
//
if(this.patientRegister.patientRegisterAbs[i].id){
registerAsbitemIds.push(this.patientRegister.patientRegisterAbs[i].id)
}
this.patientRegister.patientRegisterAbs.splice(i, 1) this.patientRegister.patientRegisterAbs.splice(i, 1)
i-- i--
} }
@ -475,27 +482,30 @@ export default {
} }
body = { registerAsbitemIds } body = { registerAsbitemIds }
if(registerAsbitemIds.length > 0){
this.batchDelAsb(body,'');
if (registerAsbitemIds.length > 0) {
this.batchDelAsb(body, '');
} }
let updateBody = [] let updateBody = []
if (this.patientRegister.patientRegisterAbs.length > 0) {
if (this.patientRegister.patientRegisterAbs.length > 0) {
for (let i = 0; i < this.patientRegister.patientRegisterAbs.length; i++) { for (let i = 0; i < this.patientRegister.patientRegisterAbs.length; i++) {
updateBody.push({
registerAsbitemId: this.patientRegister.patientRegisterAbs[i].id,
input: {
chargePrice: this.patientRegister.patientRegisterAbs[i].chargePrice,
payTypeFlag: this.patientRegister.patientRegisterAbs[i].payTypeFlag,
isCharge: this.patientRegister.patientRegisterAbs[i].isCharge,
amount: this.patientRegister.patientRegisterAbs[i].amount,
groupPackageId: this.patientRegister.patientRegisterAbs[i].groupPackageId
}
})
//
if(this.patientRegister.patientRegisterAbs[i].id){
updateBody.push({
registerAsbitemId: this.patientRegister.patientRegisterAbs[i].id,
input: {
chargePrice: this.patientRegister.patientRegisterAbs[i].chargePrice,
payTypeFlag: this.patientRegister.patientRegisterAbs[i].payTypeFlag,
isCharge: this.patientRegister.patientRegisterAbs[i].isCharge,
amount: this.patientRegister.patientRegisterAbs[i].amount,
groupPackageId: this.patientRegister.patientRegisterAbs[i].groupPackageId
}
})
}
} }
this.batchEditAsb(updateBody,'');
this.batchEditAsb(updateBody, '');
} }
}, },
// //
@ -507,11 +517,11 @@ export default {
sums[index] = '合计'; sums[index] = '合计';
return; return;
} }
if(index == 0 || index == 4 || index == 5){
if (index == 0 || index == 4 || index == 5) {
sums[index] = ''; sums[index] = '';
return; return;
} }
const values = data.map(item => Number(item[column.property]));
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) { if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => { sums[index] = values.reduce((prev, curr) => {
const value = Number(curr); const value = Number(curr);
@ -528,8 +538,8 @@ export default {
}); });
return sums; return sums;
},
},
}, },
// //
@ -538,7 +548,7 @@ export default {
"patientRegisterForm.customerOrgGroupId"(newVal, oldVal) { "patientRegisterForm.customerOrgGroupId"(newVal, oldVal) {
console.log("watch patientRegisterForm.customerOrgGroupId newVal:", newVal, " oldVal:", oldVal); console.log("watch patientRegisterForm.customerOrgGroupId newVal:", newVal, " oldVal:", oldVal);
if (newVal != oldVal) { if (newVal != oldVal) {
this.getCustomerOrgGroupAsb(newVal, oldVal);
this.getCustomerOrgGroupAsb(newVal);
} }
}, },
@ -546,13 +556,13 @@ export default {
"patientRegisterForm.medicalPackageId"(newVal, oldVal) { "patientRegisterForm.medicalPackageId"(newVal, oldVal) {
console.log("watch patientRegisterForm.medicalPackageId newVal:", newVal, " oldVal:", oldVal); console.log("watch patientRegisterForm.medicalPackageId newVal:", newVal, " oldVal:", oldVal);
if (newVal != oldVal) { if (newVal != oldVal) {
this.getMedicalPackageAsb(newVal, oldVal);
this.getMedicalPackageAsb(newVal);
} }
}, },
// //
"patientRegister.saveTimes"(newVal, oldVal) { "patientRegister.saveTimes"(newVal, oldVal) {
this.onSubmit()
this.onSubmit('')
}, },
}, },
}; };

6
src/utlis/istoken.js

@ -3,14 +3,14 @@ import axios from "axios";
import mm from "@/utlis/mm"; import mm from "@/utlis/mm";
export const yztoken = async () => { export const yztoken = async () => {
console.log("验证");
//console.log("验证");
//let dqtime = parseInt(new Date().getTime() / 1000); // 当前时间的时间戳 //let dqtime = parseInt(new Date().getTime() / 1000); // 当前时间的时间戳
//let tokentime = parseInt(window.localStorage.getItem("expires_in")); //登录缓存后的时间戳 //let tokentime = parseInt(window.localStorage.getItem("expires_in")); //登录缓存后的时间戳
let dqtime = new Date().getTime(); // 当前时间的时间戳 let dqtime = new Date().getTime(); // 当前时间的时间戳
let expires_in = parseInt(window.localStorage.getItem("expires_in")) let expires_in = parseInt(window.localStorage.getItem("expires_in"))
console.log("dqtime / expires_in",dqtime,expires_in)
//console.log("dqtime / expires_in",dqtime,expires_in)
if (dqtime > expires_in) { if (dqtime > expires_in) {
console.log("重新拉取");
console.log("刷新 token dqtime / expires_in",dqtime,expires_in);
//少于300秒 重新拉取 //少于300秒 重新拉取
await axios await axios
.post( .post(

7
src/utlis/proFunc.js

@ -109,13 +109,14 @@ exports.arrayReduce = function (arrFront, reduceArr, key) {
}; };
//判断数组中 是否存在 某个值的对象记录 如不存在返回 - 1,存在返回相应的 序列 //判断数组中 是否存在 某个值的对象记录 如不存在返回 - 1,存在返回相应的 序列
exports.arrayExistObj = function (arrFront, key, value) {
exports.arrayExistObj = function (arr, key, value) {
let ret = - 1 let ret = - 1
for(let i = 0;i<arrFront.length;i++){
if(arrFront[i][key] == value){
for(let i = 0;i<arr.length;i++){
if(arr[i][key] == value){
ret = i ret = i
break break
} }
} }
return ret return ret
} }
Loading…
Cancel
Save