You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

200 lines
7.3 KiB

import Vue from "vue";
import Vuex from "vuex";
import { getapi, postapi, putapi, deletapi } from "@/api/api";
import { arrayReduce } from "@/utlis/proFunc";
Vue.use(Vuex);
export default new Vuex.Store({
state: {
set: "qqqq",
customerOrg: {
//体检单位设置
customerOrgTree: [], //体检单位列表
treeprops: {
label: "displayName",
value: "id",
children: "treeChildren",
}, //树形组件的数据结构
customerOrgId: "", //当前单位ID(可根据此值是否为空,判断是新增还是编辑)
customerOrgRd: { id: "", displayName: "单位名称" }, //单个体检单位记录值
customerOrgRegisterList: [], //单位体检次数登记列表
contactPersonList: [], //联系人列表
contactMethodList: [], //联系方式列表
},
//体检单位分组
personnelUnit: {
customerOrgGroupId: "",
personnelgrouping: [], //人员分组
id: "", //根据Id选择的数据
form: { id: "" }, //列表每一项
nogroupselected: [], //已选分组
},
//体检人员登记 add by pengjun
patientRegister: {
customerOrgTreeAll: [], //体检单位列表(含个人)
patientRegisterId: "", //当前单位ID(可根据此值是否为空,判断是新增还是编辑)
patientRegisterRd: { id: "" }, //体检人员记录
patientRegisterTimes: 0, //体检人员登记窗口显示次数(弃用)
addTimes: 0, //用于触发新增时初始化赋值
saveTimes:0, //用于体检登记时,触发分组调整保存
photo:
"https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg", //单独抽出,拍照时会更新
cameraVisble: false, //拍照控件显示
patientRegisterRdInit: {
id: "", //id
patientId: "00000000-0000-0000-0000-000000000000", //档案号ID 选择了档案就传档案号,未选就传00000-0000...
patientNo: "", //档案号
customerOrgId: null, //单位编号
customerOrgGroupId: null, //分组
medicalPackageId: null, //套餐
patientName: "", //姓名
birthDate: "", //字符串 如:2012-01-29
sexId: "U", //性别 默认未知U
age: null, //年龄
jobCardNo: "", //工卡号
medicalCardNo: "", //体检卡号
maritalStatusId: "U", //婚姻状况 默认未知
medicalTypeId: null, //体检类别
personnelTypeId: null, //人员类别
jobPost: "", //职务
jobTitle: "", //职称
photo: "", //照片
salesman: "", //介绍人
sexHormoneTermId: null, //性激素期限
isNameHide: "N", //隐藏姓名
isPhoneFollow: "N", //电话随访
isVip: "N", //vip客户
remark: "", //
isLock: "N", //是否锁住
completeFlag: "1", //完成标志 0:预登记,1:未检,2:部份已检,3:已总检 【创建编辑时不操作】
isMedicalStart: "N", //体检开始标志 【创建编辑时不操作】
patientRegisterNo: "", //条码号 【创建编辑时不操作】
medicalTimes: 1, //条码号 【创建编辑时不操作】
organizationUnitId: null, //体检中心
address: "", //地址
email: "", //email
idNo: "", //身份证号
telephone: "", //电话
mobileTelephone: "", //手机号
nationId: null, //民族编号
postalCode: "", //邮编
creatorId: null,
creationTime: "",
lastModificationTime: "",
lastModifierId: null,
}, //体检人员记录(初始值)一般创建用
customerOrgGroupAsb: [], //选中分组所包含的组合项目
medicalPackageAsb: [], //选中套餐所包含的组合项目
query: {
times: 0, //触发查询次数
customerOrgId: "", //体检单位ID
CustomerOrgParentld: "", //单位父级ID
}, //查询条件
customerOrgGroup: [], //分组(针对单位)
patientRegisterAbs: [], //人员已选组合项目
},
//公共字典数据 add by pengjun
dict: {
personOrgId: "00000000-0000-0000-0000-000000000000", //个人体检单位ID
organization: [], //体检中心
sex: [], //性别
medicalType: [], //体检类别
personnelType: [], //人员类别
maritalStatus: [], //婚姻状况
sexHormoneTerm: [], //性激素期
nation: [], //民族
birthPlace: [], //籍惯 ,出生地
completeFlag: [
//体检完成标志
{ id: "0", displayName: "预登记" },
{ id: "1", displayName: "正式登记" },
{ id: "2", displayName: "部份已检" },
{ id: "3", displayName: "已总检" },
],
payType: [
//支付方式,比如是0自费、2免费、1单位支付
{ id: "0", displayName: "个人支付" },
{ id: "1", displayName: "单位支付" },
{ id: "2", displayName: "赠送" },
],
medicalPackage: [], //所有套餐
customerOrgGroupAll: [], //所有分组,不限单位,不限次数
customerOrg: [], //所有单位,非树结构
payMode: [], //支付方式
itemTypeTree: [], //体检类别 树结构
asbItemAll: [], //所有组合项目
asbItem: [], //显示的 未选组合项目
},
},
getters: {},
mutations: {
//同步更改状态
//通用设置 state 值 option {key:,value:} add by pengjun
setData(state, option) {
let array = option.key.split(".");
switch (array.length) {
case 1:
state[array[0]] = option.value;
break;
case 2:
state[array[0]][array[1]] = option.value;
break;
case 3:
state[array[0]][array[1]][array[2]] = option.value;
break;
case 4:
state[array[0]][array[1]][array[2]][array[3]] = option.value;
break;
}
},
},
actions: {
//获取体检人员所选组合项目
getPatientRegisterAbs(context, id) {
//console.log('vuex getPatientRegisterAbs', context.state.dict.asbItemAll)
getapi(`/api/app/register-asbitem/in-patient-register-id/${id}`).then(
(res) => {
if (res.code == 1) {
context.commit("setData", {
key: "patientRegister.patientRegisterAbs",
value: res.data,
});
context.commit("setData", {
key: "dict.asbItem",
value: arrayReduce(
[...context.state.dict.asbItemAll],
[...context.state.patientRegister.patientRegisterAbs],
"id=asbitemId"
),
});
}
}
);
},
//获取单位分组 /api/app/customer-org-group/in-customer-org-id/3a0c0444-d7a0-871f-4074-19faf1655caf
getCustomerOrgGroup(context, customerOrgld) {
console.log(
`vuex /api/app/customer-org-group/in-customer-org-id/${customerOrgld}`
);
getapi(
`/api/app/customer-org-group/in-customer-org-id/${customerOrgld}`
).then((res) => {
console.log("vuex getCustomerOrgGroup", res.data);
if (res.code == 1) {
//this.patientRegister.customerOrgGroup = res.data
context.commit("setData", {
key: "patientRegister.customerOrgGroup",
value: res.data,
});
}
});
},
},
modules: {},
});