|
|
<template> <div style="display: flex;">
<div :style="'display: flex;flex-wrap: wrap;height: 80px;width: 1216px;background-color: #fff;border-radius: 8px;margin-bottom: 15px;align-items: center;padding: 10px;width:' + (window.pageWidth - (orgEnable == 'Y' ? 0 : 200) - 110 - 10) + 'px;'"> <div class="query">
<el-select v-model="patientRegister.query.dateType" placeholder="请选择" style="width: 80px" size="small"> <el-option label="登记日期" :value="'1'" /> <el-option label="体检日期" :value="'2'" /> <el-option label="登记或体检" :value="'3'" /> </el-select> <!-- dateType 1 登记,2 体检,3 体检或登记-->
<el-date-picker v-model="patientRegister.query.startDate" type="date" placeholder="起始日期" size="small" style="width:90px;" value-format="yyyy-MM-dd" :picker-options="pickerOptions" /> <span class="spanClass">至</span> <el-date-picker v-model="patientRegister.query.endDate" type="date" placeholder="截止日期" size="small" style="width:90px;" value-format="yyyy-MM-dd" :picker-options="pickerOptions" /> </div> <div class="query"> <span class="spanClass">条码号</span> <el-input placeholder="条码号" v-model="patientRegister.query.patientRegisterNo" size="small" clearable style="width: 120px" /> </div> <div class="query"> <span class="spanClass">档案号</span> <el-input placeholder="档案号" v-model="patientRegister.query.patientNo" size="small" clearable style="width: 110px" /> </div> <div class="query"> <span class="spanClass">姓名</span> <el-input placeholder="姓名" v-model="patientRegister.query.patientName" size="small" clearable style="width: 80px" /> </div> <div class="query"> <span class="spanClass">检查条码</span> <el-input placeholder="检查条码" v-model="patientRegister.query.pacsNo" size="small" clearable style="width: 120px" /> </div> <div class="query"> <span class="spanClass">检验条码</span> <el-input placeholder="检验条码" v-model="patientRegister.query.lisNo" size="small" clearable style="width: 120px" /> </div> <div class="query"> <span class="spanClass">性别</span> <el-select v-model="patientRegister.query.sex" placeholder="请选择" style="width: 80px" size="small"> <el-option v-for="item in dict.forSex" :key="item.id" :label="item.displayName" :value="item.id"> </el-option> </el-select> </div> <div class="query"> <span class="spanClass">手机号</span> <el-input placeholder="手机号/电话" v-model="patientRegister.query.phone" size="small" clearable style="width: 100px" /> </div> <div class="query"> <span class="spanClass">身份证号</span> <el-input placeholder="身份证号" v-model="patientRegister.query.idCardNo" size="small" clearable style="width: 150px" /> </div> <div class="query"> <el-checkbox v-model="patientRegister.query.customerOrgFlag">单位作为查询条件</el-checkbox> <el-cascader v-model="patientRegister.query.customerOrgId" :options="patientRegister.customerOrgTreeAll" :props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }" placeholder="请选择单位" :show-all-levels="false" clearable :disabled="orgEnable == 'Y' ? false : true" size="small" style="width:120px;"> </el-cascader> </div> <div class="query"> <span class="spanClass">次数</span> <el-select v-model="patientRegister.query.customerOrgRegister" placeholder="次数" @change="changeCustomerOrgRegister" style="width: 60px;" size="small" value-key="id"> <el-option v-for="item in customerOrgRegisterList" :key="item.id" :label="item.medicalTimes" :value="item">{{ item.medicalTimes + '次' }}</el-option> </el-select> </div> <div class="query"> <span class="spanClass">状态</span> <el-select v-model="patientRegister.query.completeFlag" placeholder="请选择" clearable style="width: 80px" size="small"> <el-option v-for="item in dict.completeFlag" :key="item.id" :label="item.displayName" :value="item.id"> </el-option> </el-select> </div> </div>
<!-- 按钮区域 --> <div style="margin-left: 10px;margin-top: -10px;"> <div v-show="checkPagePriv(pagePriv.privs, '查询')" class="listBtn"> <el-button class="commonbutton" @click="btnQuery">查询</el-button> </div> <div v-show="checkPagePriv(pagePriv.privs, '读身份证')" class="listBtn"> <el-button type="danger" class="commonbutton" @click="readIdCard">读身份证</el-button> </div> <div class="listBtn"> <el-button type="danger" class="commonbutton" @click="btnClear">清除条件</el-button> </div> </div> </div></template><script>import { mapState } from "vuex";import { getapi, postapi, putapi, deletapi } from "@/api/api";import { getPagePriv, checkPagePriv, parsIcCardtoLocal, deepCopy } from '../../utlis/proFunc'
export default { components: {}, props: ["orgEnable"], data() { return { pagePriv: { routeUrlorPageName: 'patientRegister', //当前页面归属路由或归属页面权限名称
privs: [] // 页面权限
}, pickerOptions: { disabledDate(time) { return time.getTime() > Date.now(); }, shortcuts: [{ text: '今天', onClick(picker) { picker.$emit('pick', new Date()); } }, { text: '昨天', onClick(picker) { const date = new Date(); date.setTime(date.getTime() - 3600 * 1000 * 24); picker.$emit('pick', date); } }, { text: '一周前', onClick(picker) { const date = new Date(); date.setTime(date.getTime() - 3600 * 1000 * 24 * 7); picker.$emit('pick', date); } }] }, dialogVisible: false, customerOrgRegisterList: [], }; },
created() { //获取用户当前页面的权限
let userPriv = window.sessionStorage.getItem('userPriv') if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName))
let ldate = new Date(); this.patientRegister.query.startDate = ldate; this.patientRegister.query.endDate = ldate; this.patientRegister.query.dateType = '2' },
//挂载完成
mounted() { this.init(this.patientRegister.query.customerOrgId) this.enterToQuery() },
computed: { ...mapState(["window", "dict", "dataTransOpts", "patientRegister", "customerOrg"]), }, methods: { checkPagePriv,
btnClear(){ this.patientRegister.query.patientRegisterNo = '' this.patientRegister.query.patientNo = '' this.patientRegister.query.patientName = '' this.patientRegister.query.pacsNo = '' this.patientRegister.query.lisNo = '' this.patientRegister.query.sex = '' this.patientRegister.query.phone = '' this.patientRegister.query.idCardNo = '' },
init(customerOrgId) { if (!customerOrgId || customerOrgId == this.dict.personOrgId) { this.patientRegister.query.customerOrgRegister = null this.customerOrgRegisterList = [] if (customerOrgId == this.dict.personOrgId) { let today = new Date() this.patientRegister.query.startDate = today this.patientRegister.query.endDate = today } return }
// 获取顶级ID
getapi(`/api/app/customer-org/parent/${customerOrgId}`).then(res => { if (res.code > - 1) { this.patientRegister.query.CustomerOrgParentId = res.data return getapi(`/api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=${res.data}`) } }).then(res => { if (res && res.code > -1) { this.customerOrgRegisterList = res.data; if (res.data.length > 0) { this.patientRegister.query.customerOrgRegister = res.data[res.data.length - 1]; this.changeCustomerOrgRegister(res.data[res.data.length - 1]) } // this.patientRegister.query.times++
// console.log('this.patientRegister.query.customerOrgRegister',this.patientRegister.query.customerOrgRegister)
} }); },
//查询
btnQuery() { this.patientRegister.query.times++; console.log("this.patientRegister.query", this.patientRegister.query); },
changeCustomerOrgRegister(v) { this.patientRegister.query.startDate = new Date(v.beginTime) if (v.isComplete == 'Y') { this.patientRegister.query.endDate = new Date(v.endTime) } else { this.patientRegister.query.endDate = new Date() } },
//读身份证
readIdCard() { if (!this.$peisAPI) { this.$message.info({ showClose: true, message: "此功能,需要在壳客户端才可运行!" }) return } this.$peisAPI.peopleIcCard().then(res => { console.log('peopleIcCard', res) let lres = JSON.parse(res) if (lres.code > -1) { let idNos = parsIcCardtoLocal(lres.data, this.dict.sex, this.dict.nation) // this.form.patientName = idNos.Name
// this.form.birthDate = idNos.birthDate
// this.form.sexId = idNos.sexId
// this.form.age = idNos.age
// this.form.nationId = idNos.nationId
// this.form.idNo = idNos.IDCode
// this.form.address = idNos.Address
// this.patientRegister.photo = 'data:image/bmp;base64,' + idNos.Photo
this.patientRegister.query.patientName = idNos.Name this.patientRegister.query.sex = idNos.sexId this.patientRegister.query.idCardNo = idNos.IDCode
this.patientRegister.query.times++;
} else { this.$message.error({ showClose: true, message: lres.message }) } }) .catch(err => { this.$message.error({ showClose: true, message: `读取身份证失败,原因:${err}` }) }) },
// 根据pacs条码查询
onQueryByPacsNo(checkRequestNo) { postapi('/api/app/PatientRegister/GetPatientRegisterNoByCheckRequestNo', {checkRequestNo}).then(res => { if (res.code > 0) { this.patientRegister.query.patientRegisterNo = res.data.patientRegisterNo this.patientRegister.query.times++; } }) },
// 根据lis条码查询
onQueryByLisNo(lisRequestNo) { postapi('/api/app/PatientRegister/GetPatientRegisterNoByLisRequestNo', {lisRequestNo}).then(res => { if (res.code > 0) { this.patientRegister.query.patientRegisterNo = res.data.patientRegisterNo this.patientRegister.query.times++; } }) },
//回车替代查询
enterToQuery() { // console.log('enterToTab');
this.$nextTick(() => { let inputs = document.querySelectorAll(["input"]); //用数组可以读取多个标签的元素 //.inline-input
// 为每个输入框添加键盘事件监听器
inputs.forEach((input, i) => { // console.log('input',input);
input.addEventListener('keydown', (event) => { if (event.keyCode === 13) { // 阻止回车键的默认行为(换行)
event.preventDefault();
// 如果按下的是回车查询
// console.log(input.getAttribute('placeholder'),input.value)
let placeholder = input.getAttribute('placeholder') switch (placeholder) { case '条码号': case '档案号': case '姓名': case '预约手机号': case '身份证号': if (input.value) this.patientRegister.query.times++; input.select() break; case '检查条码': if (input.value) this.onQueryByPacsNo(input.value) input.select() break; case '检验条码': if (input.value) this.onQueryByLisNo(input.value) input.select() break; } } });
input.addEventListener('click', (event) => { let placeholder = input.getAttribute('placeholder') switch (placeholder) { case '条码号': case '档案号': case '姓名': case '预约手机号': case '身份证号': case '检查条码': case '检验条码': input.select() break; } }); }); }); }, },
watch: { "dataTransOpts.plus.PatientRegisterEditQuery": { // immediate: true,
handler(newVal, oldVal) { console.log(`watch 体检单位切换 newVal:${newVal} oldVal:${oldVal} registerCheckId: ${this.patientRegister.query.customerOrgId}`); if (newVal != oldVal) this.init(this.patientRegister.query.customerOrgId) } }, },
}</script><style scoped>@import "../../assets/css/global_button.css";@import "../../assets/css/global_input.css";@import "../../assets/css/global_font.css";
.query { margin-right: 10px; font-size: 14px; color: #232748; font-weight: 400; font-family: "NotoSansSC-Regular";}
.listBtn { margin-top: 5px;
text-align: center;}
.btnClass { /* position: absolute; */ /* left: 0; top: 0; */ width: 100px;}
.spanClass { font-size: 14px; padding: 0 2px 0 0;}</style>
|