<template>
    <div style="margin-left: 5px;z-index: 2001;">
        <div v-show="checkPagePriv(pagePriv.privs, '人员列表')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="prList">人员列表</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '体检日期')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="dialogVisibleSetStartDate = true">体检日期</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '增加人员')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="btnAddPr">增加人员</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '编辑人员')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="btnEditPr"
                :disabled="doctorBtnDisabled('editPr')">编辑人员</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '删除人员')" class="divBtnClass">
            <el-button type="primary" class="deleteButton" @click="btnDelPr"
                :disabled="doctorBtnDisabled('delPr')">删除人员</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '上一人')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="btnStep(-1)">上一人</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '下一人')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="btnStep(1)">下一人</el-button>
        </div>
        <!--
        <div>
            <el-button type="primary" class="btnClass" @click="save">保存结果</el-button>
        </div>
        -->
        <div v-show="checkPagePriv(pagePriv.privs, '修改结果')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="btnEdit"
                :disabled="doctorBtnDisabled('btnEdit')">修改结果</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '删除结果')" class="divBtnClass">
            <el-button type="primary" class="deleteButton" @click="btnDel"
                :disabled="doctorBtnDisabled('btnDel')">删除结果</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '放弃明细项目检查')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="refuseItem" style="font-size:11px;"
                :disabled="doctorBtnDisabled('refuseItem')">放弃明细项目检查</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '放弃项目检查')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="refuse" 
                :disabled="doctorBtnDisabled('refuse')">放弃项目检查</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '删除明细项目')" class="divBtnClass">
            <el-button type="primary" class="deleteButton" @click="delItem"
                :disabled="doctorBtnDisabled('delItem')">删除明细项目</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '取消审核')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="unAudit"
                :disabled="doctorBtnDisabled('unAudit')">取消审核</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '历次结果')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="btnCheckHistory"
                :disabled="doctorBtnDisabled('btnCheckHistory')">历次结果</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '体检报告')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="btnReport"
                :disabled="doctorBtnDisabled('btnReport')">体检报告</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '总检')" class="divBtnClass">
            <el-button type="primary" class="commonbutton" @click="toSumDoctorCheck">总检</el-button>
        </div>

        <!--
        <div>
            <el-button type="primary" class="btnClass" @click="btnMakeDiagnosis">生成小结</el-button>
        </div> 
        <div>
            <el-button type="primary" class="btnClass" @click="addSummary">新增小结</el-button>
        </div>
        <div>
            <el-button type="primary" class="btnClass" @click="audit">审核</el-button>
        </div>        
        <div>
            <el-button type="primary" class="btnClass">排队</el-button>
        </div>
        -->


        <div v-show="doctorCheck.doctorCheckDialogVisible"
            :style="`z-index:2;border-radius: 10px;border: 1px solid #ddd;background-color:#FFF; position: absolute;top:50px;right:0px;width:300px;height: ${window.pageHeight - 42 - 10}px;opacity:1;`">

            <PatientRegisterList win="doctorCheck" :winAbsolute="true" />

        </div>

        <!-- 抽屉方式，遮罩层不能操作 
        <el-drawer title="体检人员列表" :visible.sync="doctorCheck.doctorCheckDialogVisible" direction="rtl" 
          :wrapperClosable="false" :modal="false" :size="300">
          <PatientRegisterList win="doctorCheck" />
        </el-drawer>
        -->


        <!-- 体检人员登记 -->
        <el-dialog :title="doctorCheck.prBase.id ? '体检人员--编辑' : '体检人员--新增'" :visible.sync="dialogWin.PatientRegisterEdit"
            :close-on-click-modal="false" fullscreen @close="closeDialogWinPatientRegisterEdit">
            <!-- :formInitData="formData" -->
            <PatientRegisterEdit style="z-index:30001;" :isDoctor="'1'" :patientRegisterId="doctorCheck.prBase.id"
                :editTimes="editTimes" :refreshRegister="refreshRegister" />
        </el-dialog>
        <el-dialog title="设置体检日期" style="z-index:30002;" :visible.sync="dialogVisibleSetStartDate"
            :close-on-click-modal="false" :show-close="false" width="300px">
            <div style="padding: 0 20px;">
                <span style="margin-right:5px ;">体检日期</span>
                <el-date-picker v-model="medicalStartDateTemp" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                    placeholder="出生日期" prefix-icon="" size="small" style="width:150px;" />
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button class="commonbutton" @click="dialogVisibleSetStartDate = false">取 消</el-button>
                <el-button class="commonbutton" type="primary" @click="btnSetStartDate">确 定</el-button>
            </span>
        </el-dialog>

        <el-dialog title="历次结果" :visible.sync="dialogVisibleCheckHistory" :close-on-click-modal="false" width="800px">
            <div style="padding: 0 20px;">
                <el-tabs v-model="tabChoosed">
                    <el-tab-pane label="明细结果" name="2">
                        <CheckDetails :patientRegisterId="doctorCheck.prBase.id" />
                    </el-tab-pane>
                    <el-tab-pane label="项目对比" name="4">
                        <SumItemsType :patientId="doctorCheck.prBase.patientId" />
                    </el-tab-pane>
                    <el-tab-pane label="横向对比" name="5">
                        <SumItems :patientId="doctorCheck.prBase.patientId" />
                    </el-tab-pane>
                    <el-tab-pane label="历次综述" name="6">
                        <SumHistory :patientId="doctorCheck.prBase.patientId" />
                    </el-tab-pane>
                </el-tabs>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import { mapState, mapActions, mapMutations } from "vuex";
import { getapi, postapi, putapi, deletapi } from "@/api/api";
import { getPagePriv, checkPagePriv, deepCopy, arrayExistObj, objCopy } from "../../utlis/proFunc";

import PatientRegisterEdit from "../../components/patientRegister/PatientRegisterEdit.vue";
import PatientRegisterList from "./PatientRegisterList.vue";

import CheckDetails from "../../components/sumDoctorCheck/CheckDetails.vue";
import SumItemsType from "../../components/sumDoctorCheck/SumItemsType.vue";
import SumItems from "../../components/sumDoctorCheck/SumItems.vue";
import SumHistory from "../../components/sumDoctorCheck/SumHistory.vue";

import moment from 'moment';

export default {
    components: {
        PatientRegisterEdit,
        PatientRegisterList,
        CheckDetails,
        SumItemsType,
        SumItems,
        SumHistory
    },
    props: ["optGrant", "addSummary", "btnMakeDiagnosis", "save", "audit", "unAudit", "doctorBtnDisabled"],

    data() {
        return {
            pagePriv: {
                routeUrlorPageName: 'doctorCheck', //当前页面归属路由或归属页面权限名称
                privs: [] // 页面权限
            },
            medicalStartDate: '',  //设置体检日期
            medicalStartDateTemp: '',  //设置体检日期 临时体检日期 
            refreshPatientRegisterList: 0, // 当有 人员登记有 新增/编辑/删除 时，强制刷新 上一人/下一人的人员列表
            medicalStartDateDatas: [], // 设置体检日期 的人员信息登记信息，按登记日期排序 (用于上一人，下一人)

            dialogVisibleSetStartDate: false, //设置体检日期窗口
            editTimes: 0,
            nextTodialogVisible: false,  //设置完体检日期是否显示 体检人员登记窗口
            dialogVisible: false,  //体检人员登记窗口
            formData: {
                registerManType: 'doctor', //登记人员类型，客服：customer 医生：doctor 支持在医生诊台处理登记人员
                id: "", //id
                photo: '', //照片
                patientId: "00000000-0000-0000-0000-000000000000", //档案号ID 选择了档案就传档案号，未选就传00000-0000...
                patientNo: "", //档案号
                customerOrgId: ["00000000-0000-0000-0000-000000000001"], //单位编号 默认个人 
                customerOrgGroupId: null, //分组
                medicalPackageId: null, //套餐
                patientName: "", //姓名
                birthDate: null, //日期型
                sexId: "U", //性别 默认未知U
                age: null, //年龄
                jobCardNo: "", //工卡号
                medicalCardNo: "", //体检卡号
                maritalStatusId: "9", //婚姻状况 默认未知
                medicalTypeId: null, //体检类别
                personnelTypeId: null, //人员类别
                jobPost: "", //职务
                jobTitle: "", //职称
                salesman: "", //介绍人
                sexHormoneTermId: null, //性激素期限
                isNameHide: "N", //隐藏姓名
                isPhoneFollow: "N", //电话随访
                isVip: "N", //vip客户
                remark: "", //
                isLock: "N", //是否锁住
                completeFlag: "1", //完成标志 0:预登记，1：未检，2：部份已检，3：已总检  【创建编辑时不操作】
                isMedicalStart: "N", //体检开始标志 【创建编辑时不操作】
                patientRegisterNo: "", //条码号 【创建编辑时不操作】
                medicalTimes: 1, //条码号 【创建编辑时不操作】
                medicalCenterId: null, //体检中心
                address: "", //地址
                email: "", //email
                idNo: "", //身份证号
                telephone: "", //电话
                mobileTelephone: "", //手机号
                nationId: null, //民族编号
                birthPlaceId: null, //籍惯（出生地）
                postalCode: "", //邮编
                creatorId: null,
                creationTime: "",
                lastModificationTime: "",
                lastModifierId: null,
                isVipBox: false, //vip客户
                isNameHideBox: false, //隐藏姓名
                isPhoneFollowBox: false, //电话随访
                isLockBox: false, //是否锁住
                customerOrgRegisterId: null,
                isMaxMedicalTimes: 'N',
                medicalStartDate: null,
            }, //单位 记录 目前新增与更新是一致
            formInitData: {},

            medicalStartDateLoadOpts: {  //按体检日期 查询参数
                totalCount: 0,
                skipCount: 0,
                maxResultCount: 50000,
            },

            displayPrList: false,    //是否显示人员列表
            dialogVisibleCheckHistory: false,  //历次结果
            tabChoosed: '2',
        };
    },

    created() {
        //获取用户当前页面的权限
        let userPriv = window.sessionStorage.getItem('userPriv')
        if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName))

        this.formInitData = Object.assign({}, this.formData)
        this.medicalStartDateTemp = new Date()
    },

    //挂载完成
    mounted() {

    },

    computed: {
        ...mapState(["window", "dialogWin", "dataTransOpts", "dict", "patientRegister", "doctorCheck", "sumDoctorCheck"]),
    },

    methods: {
        ...mapActions(["getCustomerOrgGroup"]),
        ...mapMutations(['doctorCheckPrBaseInit']),
        checkPagePriv,

        prList() {
            this.doctorCheck.doctorCheckDialogVisible = true
        },

        //设置体检日期
        btnSetStartDate() {
            this.medicalStartDate = this.medicalStartDateTemp
            this.dialogVisibleSetStartDate = false
            setTimeout(() => {
                this.refreshPatientRegisterList++
            }, 20);
            if (this.nextTodialogVisible) this.btnAddPr()
        },

        //人员登记
        btnAddPr() {
            // debugger
            if (this.medicalStartDate) {
                //this.formData = Object.assign({},this.formInitData,{medicalStartDate:moment(this.medicalStartDate).format('yyyy-MM-DD')}) 
                this.dataTransOpts.tableS.patient_register.id = ''
                this.dialogWin.PatientRegisterEdit = true
                setTimeout(() => {
                    this.dataTransOpts.refresh.patient_register.S++
                }, 20);
                this.patientRegister.photo = ''
            } else {
                this.nextTodialogVisible = true
                this.dialogVisibleSetStartDate = true
            }
        },

        //人员删除
        btnDelPr() {
            if (!this.dataTransOpts.tableS.patient_register.id) {
                this.$message.warning({ showClose: true, message: "未选中要删除的人员记录" })
                return
            }
            let id = this.dataTransOpts.tableS.patient_register.id
            this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
                confirmButtonText: "是",
                cancelButtonText: "否",
                type: "warning",
            }).then(() => {
                //console.log('{patientRegisterIds}',{patientRegisterIds})
                return postapi(`/api/app/patient-register/delete-many`, { patientRegisterIds: [id] })
            }).then((res) => {
                if (res.code != -1) {
                    console.log("操作成功！")
                    // this.doctorCheckPrBaseInit();
                    this.dataTransOpts.tableS.patient_register.id = ''
                    setTimeout(() => {
                        // 刷新当前界面数据 及 上一人/下一人 列表数据
                        this.closeDialogWinPatientRegisterEdit()
                    }, 20);
                }
            }).catch((err) => {
                if (err == "cancel") {
                    // this.$message.info("已取消删除");
                    console.log('已取消删除')
                }
            });

        },


        //人员编辑
        btnEditPr() {
            if (!this.dataTransOpts.tableS.patient_register.id) {
                this.$message.warning({ showClose: true, message: "未选中要编辑的人员记录" })
                return
            }

            // this.patientRegister.patientRegisterRd = Object.assign({},this.doctorCheck.prBase)
            // this.formData = Object.assign({},this.doctorCheck.prBase)

            //console.log(this.patientRegister.patientRegisterRd,this.patientRegister.prList)
            this.dialogWin.PatientRegisterEdit = true;
            setTimeout(() => {
                this.dataTransOpts.refresh.patient_register.S++
            }, 20);
        },

        // 关闭人员登记 新增/编辑 时，刷新当前界面数据 及 上一人/下一人 列表数据
        closeDialogWinPatientRegisterEdit() {
            this.dataTransOpts.refresh.patient_register.S++  // 刷新当前界面数据
            this.refreshPatientRegisterList++  // 刷新 上一人/下一人 列表
        },

        // 上(下)一人 step 1 表示下一人， -1 表示上一人
        btnStep(step) {
            if (!this.medicalStartDate) {
                this.$message.warning({ showClose: true, message: "请先设置体检日期" })
                return
            }
            if (this.medicalStartDateDatas.length == 0) {
                this.$message.warning({ showClose: true, message: "当前设置的体检日期，无体检人员信息" })
                return
            }

            let lstep = -1
            if (step && step > 0) lstep = 1

            let lfind = -1
            let patientRegisterId = this.dataTransOpts.tableS.patient_register.id
            if (patientRegisterId) {
                lfind = arrayExistObj(this.medicalStartDateDatas, 'id', patientRegisterId)
                if (lfind > - 1) {
                    if (lstep < 0 && lfind == 0) {
                        this.$message.warning({ showClose: true, message: "已是第一个人" })
                        return
                    } else if (lstep > 0 && lfind == this.medicalStartDateDatas.length - 1) {
                        this.$message.warning({ showClose: true, message: "已是最后一人" })
                        return
                    }
                    lfind = Number(lfind) + Number(lstep)
                    this.dataTransOpts.tableS.patient_register = deepCopy(this.medicalStartDateDatas[lfind])
                }
            } else {
                if (this.medicalStartDateDatas && this.medicalStartDateDatas.length > 0) {
                    this.dataTransOpts.tableS.patient_register = deepCopy(this.medicalStartDateDatas[0])
                }
            }

            this.dataTransOpts.refresh.patient_register.S++
        },

        //查询找到相关信息处理
        findPR(rd) {
            this.doctorCheck.prBase = Object.assign({}, this.doctorCheck.prBase, rd)
            this.patientRegister.photo = rd.photo
        },


        //刷新或添加列表数据
        refreshRegister(patientRegister) {
            console.log('编辑/新增的 form :', patientRegister)
            this.doctorCheck.prBase = Object.assign({}, patientRegister)
            this.patientRegister.photo = patientRegister.photo
        },

        //修改结果
        btnEdit() {
            let ret = this.optGrant('edit')
            if (ret) {
                this.$message.warning({ showClose: true, message: ret })
                return
            }
            this.doctorCheck.RegisterCheckEdit.completeFlag = '0'
        },

        //删除结果
        btnDel() {
            let ret = this.optGrant('del')
            if (ret) {
                this.$message.warning({ showClose: true, message: ret })
                return
            }

            postapi('/api/app/registercheck/updatecompletemany', [{ registerCheckId: this.doctorCheck.RegisterCheckEdit.id, completeFlag: '0' }])
                .then((res) => {
                    console.log("del", res.data);
                    if (res.code != -1) {
                        this.doctorCheck.RegisterCheckEdit.completeFlag = '0';
                        let lfind = arrayExistObj(this.doctorCheck.RegisterCheckList, 'id', this.doctorCheck.RegisterCheckEdit.id)
                        if (lfind > -1) this.doctorCheck.RegisterCheckList[lfind].completeFlag = '0'
                        // 刷新明细项目，小结与建议
                        this.dataTransOpts.refresh.register_check_item.M++
                        this.dataTransOpts.refresh.register_check.S++
                        console.log("操作成功！");
                    }
                });
        },

        //放弃明细项目检查                
        refuseItem() {
            let ret = this.optGrant('refuseItem')
            if (ret) {
                this.$message.warning({ showClose: true, message: ret })
                return
            }
            // console.log('this.doctorCheck.checkItem',this.doctorCheck.checkItem)
            if (!this.doctorCheck.checkItem) {
                this.$message.warning({ showClose: true, message: "请选择要操作的明细项目" })
                return
            }
            if (!this.doctorCheck.checkItem.itemId) {
                this.$message.warning({ showClose: true, message: "请选择要操作的明细项目" })
                return
            }

            let lfind = arrayExistObj(this.doctorCheck.checkItemList, 'itemId', this.doctorCheck.checkItem.itemId)
            if (lfind == -1) {
                this.$message.warning({ showClose: true, message: "请选择要操作的明细项目" })
                return
            }

            this.doctorCheck.checkItemList[lfind].result = "放弃检查"

        },

        //放弃项目检查                
        refuse() {
            if (!this.doctorCheck.RegisterCheckEdit.id) {
                this.$message.warning({ showClose: true, message: '请选择要操作的项目' })
                return
            }

            // [
            //   {
            //     "registerCheckId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            //     "completeFlag": "0"
            //   }
            // ]
            postapi(`/api/app/registercheck/updatecompletemany`, [{registerCheckId:this.doctorCheck.RegisterCheckEdit.id,completeFlag:'2'}])
                .then((res) => {
                    if (res.code > -1) {               
                        this.doctorCheck.RegisterCheckEdit.completeFlag = '2'
                        let lfind = arrayExistObj(this.doctorCheck.RegisterCheckList,'id',this.doctorCheck.RegisterCheckEdit.id)
                        if(lfind > -1) this.doctorCheck.RegisterCheckList[lfind].completeFlag = '2'
                    }
                })
                ;


        },

        //删除明细项目                
        delItem() {
            let ret = this.optGrant('delItem')
            if (ret) {
                this.$message.warning({ showClose: true, message: ret })
                return
            }

            if (!this.doctorCheck.checkItem) {
                this.$message.warning({ showClose: true, message: "请选择要删除的明细项目" })
                return
            }
            if (!this.doctorCheck.checkItem.itemId) {
                this.$message.warning({ showClose: true, message: "请选择要删除的明细项目" })
                return
            }

            let lfind = arrayExistObj(this.doctorCheck.checkItemList, 'itemId', this.doctorCheck.checkItem.itemId)
            if (lfind == -1) {
                this.$message.warning({ showClose: true, message: "请选择要删除的明细项目" })
                return
            }

            this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
                confirmButtonText: "是",
                cancelButtonText: "否",
                type: "warning",
            }).then(() => {
                return postapi(`/api/app/registercheckitem/deleteregistercheckitem?RegisterCheckId=${this.doctorCheck.checkItem.registerCheckId}&ItemId=${this.doctorCheck.checkItem.itemId}`)
            }).then(res => {
                if (res.code != -1) {
                    this.doctorCheck.checkItemList.splice(lfind, 1);
                    this.doctorCheck.checkItem.itemId = ''
                }
            }).catch((err) => {
                if (err == "cancel") {
                    this.$message.info({ showClose: true, message: "已取消" });
                } else {
                    this.$message.error({ showClose: true, message: `项目明细删除失败，原因：${err}` });
                }
            });

        },

        // 历次结果
        btnCheckHistory() {
            if (!this.doctorCheck.prBase.id) return;
            this.dialogVisibleCheckHistory = true;
        },

        //体检报告
        btnReport() {

            if (!this.$peisAPI) {
                this.$message.info({ showClose: true, message: "此功能，需要在壳客户端才可运行！" })
                return
            }
            ///3a0c990e-5756-2dc0-19d5-69a617fe4048
            let ReportCode = '0005';
            let token = window.sessionStorage.getItem('token');
            let user = window.sessionStorage.getItem('user');
            let toOutShell = {
                isBuildImage: 'N',
                IsUploadPdf: 'N',
                ReportCode, token,
                preViewCanPrint: this.doctorCheck.prBase.isAudit, //this.dataTransOpts.tableS.patient_register.isAudit
                Parameters: [
                    { Name: 'printer', Value: user },
                    { Name: 'LTS', Value: 'Y' }, //Y、N   N只看不能打印
                    { Name: 'hisLog', Value: 'pic/hisLog.jpg' },
                    { Name: "peisReportFirstPage", Value: "pic/peisReportFirstPage.jpg" },
                    { Name: "peisReportPageHeader", Value: "pic/peisReportPageHeader.jpg" },
                    { Name: "peisReportPageFooter", Value: "pic/peisReportPageFooter.jpg" }
                ],
            };
            
            toOutShell.BusinessCode = this.doctorCheck.prBase.id
            this.$peisAPI.printPre(JSON.stringify(toOutShell))
                .then(res => {
                    if (res) {
                        let lres = JSON.parse(res)
                        if (lres.code < 0) this.$message.error({ showClose: true, message: lres.message })
                    }
                })
                .catch(err => {
                    this.$message.warning({ showClose: true, message: err });
                });

        },

        //总检
        toSumDoctorCheck() {
            this.dataTransOpts.tableS.patient_register = Object.assign({}, this.doctorCheck.prBase)
            this.$router.push({ path: "/sumDoctorCheck", query: { patient_register: this.dataTransOpts.tableS.patient_register } });
        },

    },

    //监听事件()
    watch: {
        //1级单位值改变，分组改变
        "patientRegister.query.CustomerOrgParentId"(newVal, oldVal) {
            console.log(
                "watch patientRegister.query.CustomerOrgParentId newVal：",
                newVal,
                " oldVal：",
                oldVal
            );
            if (newVal != oldVal && newVal !== this.dict.personOrgId) {
                this.getCustomerOrgGroup(newVal);
            }
        },

        // 设置体检日期
        "refreshPatientRegisterList": {
            // immediate:true,
            handler(newVal, oldVal) {
                if (newVal != oldVal) {
                    if (!this.medicalStartDate) return
                    let body = {
                        customerOrgs: [
                            {
                                startDate: moment(this.medicalStartDate).format('yyyy-MM-DD'),
                                endDate: moment(this.medicalStartDate).format('yyyy-MM-DD'),
                                dateType: '2'  //体检日期
                            }
                        ],
                        maxResultCount: 1000
                    }

                    postapi('/api/patientregister/getpeisrecordlist', body).then(res => {
                        if (res.code != -1) this.medicalStartDateDatas = res.data.items
                    })

                } else {
                    this.medicalStartDateDatas = []
                }
            }
        },
    },
};
</script>
<style scoped>
@import '../../assets/css/global_button.css';

.divBtnClass {
    margin-top: 5px;
}
</style>