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: "9", //婚姻状况 默认未知 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: [], //选中套餐所包含的组合项目 customerOrgGroupChange: 0, //控制体检列表记录切换时,0 无需触发更换分组操作 medicalPackageChange: 0, //控制体检列表记录切换时,0 无需触发更换套餐操作 query: { times: 0, //触发查询次数 customerOrgId: "", //体检单位ID CustomerOrgParentId: "", //单位父级ID customerOrgFlag: true, //单位作为查询条件 }, //查询条件 customerOrgGroup: [], //分组(针对单位) patientRegisterAbs: [], //人员已选组合项目 }, //体检医生诊台 doctorCheck: { prBase: { id: '', //体检登记ID }, //人员体检登记显示基本信息 RegisterCheckEdit: { id: '', checkDoctorId: null, checkDate: '', completeFlag: '0', LastModificationTime: '', LastModifierId: null, isLock: 'N', isAudit: 'N', auditorUserId: null, auditTime: '', }, //组合项目详情 RegisterCheckList:[], //人员体检 组合项目列表 RegisterCheck:{}, //单组合项目记录 RegisterCheckId:'', // checkItemList:[], //组合项目包含的明细项目 checkItem:{}, //单项目记录 checkSummaryList:[], //小结 checkSuggestionList:[], //建议 }, //总检医生 sumDoctorCheck:{ sumPREdit:{}, //总检医生时间等相关信息(sumPREditInit) summaryList:[], //综述 suggestionList:[], //建议 }, //公共字典数据 add by pengjun dict: { personOrgId: "00000000-0000-0000-0000-000000000000", //个人体检单位ID organization: [], //体检中心 sex: [], //性别(人员档案用) forSex: [], //适用性别 medicalType: [], //体检类别 personnelType: [], //人员类别 maritalStatus: [], //婚姻状况 sexHormoneTerm: [], //性激素期 nation: [], //民族 birthPlace: [], //籍惯 ,出生地 completeFlag: [ //体检完成标志 { id: "0", displayName: "预登记" }, { id: "1", displayName: "正式登记" }, { id: "2", displayName: "部份已检" }, { id: "3", displayName: "已总检" }, ], checkCompleteFlag: [ //体检完成标志 { id: "0", displayName: "未检" }, { id: "1", displayName: "已检" }, { id: "2", displayName: "弃检" }, ], sumAudit: [ //总检审核 { id: "Y", displayName: "已审核" }, { id: "N", displayName: "未审核" } ], payType: [ //支付方式,比如是0自费、2免费、1单位支付 { id: "0", displayName: "个人支付" }, { id: "1", displayName: "单位支付" }, { id: "2", displayName: "赠送" }, ], checkTypeFlag: [ { id: "0", displayName: "检验" }, { id: "1", 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; } }, doctorCheckPrBaseInit(state) { state.doctorCheck.prBase = { id: '', //体检登记ID patientRegisterNo: '', //条码号 patientNo: '', //档案号 patientName: '', //姓名 sexId: '', //性别 medicalTimes: '', //体检次数 maritalStatusId: '', //婚姻 creationTime: '', //体检日期 customerOrgParentName: '', //单位 customerOrgName: '', //部门 medicalTypeId: '', //体检类别 personnelTypeId: '', //人员类别 nationId: '', //民族 mobileTelephone: '', //手机 } //人员体检登记显示基本信息 }, sumPREditInit(state) { state.sumDoctorCheck.sumPREdit = { id:'', //体检登记ID completeFlag:'', //完成状态 summaryDoctor:'', //总检医生 summaryDate:'', //总检日期 isAudit:'', //审核状态 auditDoctor:'', //审核医生 auditDate:'', //审核日期 isLock:'', //锁定状态 } //人员体检登记显示基本信息 }, }, actions: { //获取体检人员所选组合项目 getPatientRegisterAbs(context, id) { //console.log(`vuex getPatientRegisterAbs /api/app/registerasbitem/getlistinpatientregisterid?PatientRegisterId=${id}`, context.state.dict.asbItemAll) getapi(`/api/app/registerasbitem/getlistinpatientregisterid?PatientRegisterId=${id}`).then( (res) => { console.log(`/api/app/registerasbitem/getlistinpatientregisterid?PatientRegisterId=${id}`, 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.asbItem], [...context.state.patientRegister.patientRegisterAbs], "id=asbitemId" ), }); //console.log(`getPatientRegisterAbs ${id}`,context.state.dict.asbItem) } } ); }, //获取单位分组 /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: {}, });