pengjun 2 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(
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();
let token = localStorage.getItem("token");

316
src/components/patientRegister/PatientRegisterItem.vue

@ -26,14 +26,13 @@
</el-button>
</div>
<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>
</div>
</div>
<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">
<!-- temporaryselection personnelUnit.nogroupselected-->
<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)
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) {
alert("暂无可操作的数据")
return
}
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,
amount: this.patientRegister.patientRegisterAbs[i].amount,
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)
postapi(`/api/app/registerasbitem/createmany?CustomerOrgId=${this.patientRegisterForm.customerOrgId}`, body)
.then((res) => {
console.log("addAbs", res);
console.log("batchAddAsb", res);
if (res.code == 1) {
//
this.getPatientRegisterAbs(this.patientRegisterForm.id)
if(msg) this.$message.success(`${msg}操作成功`);
if (msg) this.$message.success(`${msg}操作成功`);
}
})
.catch((err) => {
@ -227,10 +247,10 @@ export default {
})
}
this.batchAddAsb(body,'添加组合项目');
this.batchAddAsb(body, '添加组合项目');
},
//
selecteditems(val) {
@ -238,7 +258,7 @@ export default {
},
//
batchDelAsb(body,msg){
batchDelAsb(body, msg) {
console.log(`/api/app/registerasbitem/deletemany`, body)
postapi(`/api/app/registerasbitem/deletemany`, body)
.then((res) => {
@ -247,12 +267,12 @@ export default {
//
this.getAsbItemByItemTypeAll()
if(msg){
if (msg) {
//
this.getPatientRegisterAbs(this.patientRegisterForm.id)
this.$message.success(`${msg}操作成功`);
}
}
})
.catch((err) => {
@ -289,7 +309,7 @@ export default {
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) {
@ -342,114 +362,87 @@ export default {
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);
if (res.code == 1) {
this.patientRegister.medicalPackageAsb = res.data;
//
this.addMedicalPackageAsb(medicalPackageId);
//
this.removeGroupPackageAsb(oldVal);
this.removeGroupPackageAsb();
//
this.getAsbItemByItemType()
//
this.addMedicalPackageAsb(medicalPackageId);
}
});
},
//
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++) {
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) {
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++) {
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 registerAsbitemIds = []
let chargeComplete = ''
//
if(!this.patientRegisterForm.id){
this.patientRegister.patientRegisterAbs = []
return
}
// groupPackageId null
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') {
chargeComplete += this.patientRegister.patientRegisterAbs[i].asbitemName + ','
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)
i--
}
@ -475,27 +482,30 @@ export default {
}
body = { registerAsbitemIds }
if(registerAsbitemIds.length > 0){
this.batchDelAsb(body,'');
if (registerAsbitemIds.length > 0) {
this.batchDelAsb(body, '');
}
let updateBody = []
if (this.patientRegister.patientRegisterAbs.length > 0) {
if (this.patientRegister.patientRegisterAbs.length > 0) {
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] = '合计';
return;
}
if(index == 0 || index == 4 || index == 5){
if (index == 0 || index == 4 || index == 5) {
sums[index] = '';
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))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
@ -528,8 +538,8 @@ export default {
});
return sums;
},
},
},
//
@ -538,7 +548,7 @@ export default {
"patientRegisterForm.customerOrgGroupId"(newVal, oldVal) {
console.log("watch patientRegisterForm.customerOrgGroupId newVal:", newVal, " oldVal:", oldVal);
if (newVal != oldVal) {
this.getCustomerOrgGroupAsb(newVal, oldVal);
this.getCustomerOrgGroupAsb(newVal);
}
},
@ -546,13 +556,13 @@ export default {
"patientRegisterForm.medicalPackageId"(newVal, oldVal) {
console.log("watch patientRegisterForm.medicalPackageId newVal:", newVal, " oldVal:", oldVal);
if (newVal != oldVal) {
this.getMedicalPackageAsb(newVal, oldVal);
this.getMedicalPackageAsb(newVal);
}
},
//
"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";
export const yztoken = async () => {
console.log("验证");
//console.log("验证");
//let dqtime = parseInt(new Date().getTime() / 1000); // 当前时间的时间戳
//let tokentime = parseInt(window.localStorage.getItem("expires_in")); //登录缓存后的时间戳
let dqtime = new Date().getTime(); // 当前时间的时间戳
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) {
console.log("重新拉取");
console.log("刷新 token dqtime / expires_in",dqtime,expires_in);
//少于300秒 重新拉取
await axios
.post(

7
src/utlis/proFunc.js

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