| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- <template>
- <div >
- <el-row :gutter="10" class="mb8" style="float: right; top: -30px;">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['his:patient:add']"
- >新增</el-button>
- </el-col>
- </el-row>
- <el-table v-loading="loading" border :data="patientList" @selection-change="handleSelectionChange" style="top: -30px;">
- <el-table-column label="患者姓名" align="center" prop="patientName" />
- <el-table-column label="所属会员" align="center" width="150px">
- <template slot-scope="scope">
- <div v-if="scope.row.nickName!=null"> {{scope.row.nickName}}-{{scope.row.phone}}</div>
- </template>
- </el-table-column>
- <el-table-column label="身份证号" align="center" prop="idCard" width="170px"/>
- <el-table-column label="出生年月" align="center" prop="birthday" width="180">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column label="性别" align="center" prop="sex" >
- <template slot-scope="scope">
- <dict-tag :options="sexOptions" :value="scope.row.sex"/>
- </template>
- </el-table-column>
- <el-table-column label="体重G" align="center" prop="weight" />
- <el-table-column label="手机号" align="center" prop="mobile" />
- <el-table-column label="状态" align="center" prop="status" >
- <template slot-scope="scope">
- <dict-tag :options="pOptions" :value="scope.row.status"/>
- </template>
- </el-table-column>
- <el-table-column label="与本人关系" align="center" prop="relation" />
- <el-table-column label="肝功能是否异常" align="center" prop="liverUnusual" />
- <el-table-column label="肾功能是否异常" align="center" prop="renalUnusual" />
- <el-table-column label="过敏史" align="center" prop="historyAllergic" />
- <el-table-column label="家族病史" align="center" prop="familyMedHistory" />
- <el-table-column label="个人病史" align="center" prop="selfMedHistory" />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150px">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['his:patient:edit']"
- >修改</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['his:patient:remove']"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <!-- 添加或修改病人对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="125px">
- <el-form-item label="患者姓名" prop="patientName">
- <el-input v-model="form.patientName" placeholder="请输入患者姓名" />
- </el-form-item>
- <el-form-item label="身份证号" prop="idCard">
- <el-input v-model="form.idCard" placeholder="请输入身份证号" @blur="parseBirthdayFromIdCard(form.idCard)" />
- </el-form-item>
- <el-form-item label="出生年月" prop="birthday">
- <el-date-picker clearable size="small"
- v-model="form.birthday"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="选择出生年月">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="性别" prop="sex">
- <el-select v-model="form.sex" placeholder="性别" clearable size="small">
- <el-option
- v-for="dict in sexOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="体重KG" prop="weight">
- <el-input v-model="form.weight" placeholder="请输入体重KG" />
- </el-form-item>
- <el-form-item label="手机号" prop="mobile">
- <el-input v-model="form.mobile" placeholder="请输入手机号" />
- </el-form-item>
- <el-form-item label="状态" prop="status">
- <el-select v-model="form.status" placeholder="状态" clearable size="small">
- <el-option
- v-for="dict in pOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="是否默认" prop="isDefault">
- <el-radio-group v-model="form.isDefault">
- <el-radio :label="item.dictValue" v-for="item in orOptions" >{{item.dictLabel}}</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="与本人关系" prop="relation">
- <el-select v-model="form.relation">
- <el-option v-for="(option, index) in relationOptions" :key="index" :value="option" clearable></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="肝功能是否异常" prop="liverUnusual">
- <el-radio-group v-model="form.liverUnusual">
- <el-radio :label="item" v-for="item in isGoodOptions" >{{item}}</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="肾功能是否异常" prop="renalUnusual">
- <el-radio-group v-model="form.renalUnusual" >
- <el-radio :label="item" v-for="item in isGoodOptions" >{{item}}</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="过敏史" prop="historyAllergic">
- <el-radio-group v-model="form.historyAllergic">
- <el-radio :label="item" v-for="item in isOptions" >{{item}}</el-radio>
- </el-radio-group>
- <el-checkbox-group v-model="historyAllergic" size="medium" v-if="form.historyAllergic=='有'">
- <el-checkbox v-for="item in historyAllergicOptions" :key="item" :label="item"
- >{{item}}</el-checkbox>
- </el-checkbox-group>
- </el-form-item>
- <el-form-item label="家族病史" prop="familyMedHistory">
- <el-radio-group v-model="form.familyMedHistory">
- <el-radio :label="item" v-for="item in isOptions" >{{item}}</el-radio>
- </el-radio-group>
- <el-checkbox-group v-model="familyMedHistory" size="medium" v-if="form.familyMedHistory=='有'">
- <el-checkbox v-for="item in historyOptions" :key="item" :label="item"
- >{{item}}</el-checkbox>
- </el-checkbox-group>
- </el-form-item>
- <el-form-item label="个人病史" prop="selfMedHistory" >
- <el-radio-group v-model="form.selfMedHistory">
- <el-radio :label="item" v-for="item in isOptions" >{{item}}</el-radio>
- </el-radio-group>
- <el-checkbox-group v-model="selfMedHistory" size="medium" v-if="form.selfMedHistory=='有'">
- <el-checkbox v-for="item in historyOptions" :key="item" :label="item"
- >{{item}}</el-checkbox>
- </el-checkbox-group>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- listPatient,
- getPatient,
- delPatient,
- addPatient,
- updatePatient,
- exportPatient,
- listPatientList
- } from '@/api/his/patient'
- import {getUserList} from "@/api/his/doctor";
- export default {
- name: "Patient",
- data() {
- return {
- addPatientInfo: process.env.VUE_APP_ADD_PATIENT,
- show:{
- title:"患者详情",
- open:false,
- },
- // 遮罩层
- userList:[],
- userName: {name:null},
- sexOptions: [],
- pOptions: [],
- orOptions:[],
- historyAllergic:[],
- familyMedHistory:[],
- selfMedHistory:[],
- historyAllergicOptions:['阿司匹林', '磺胺类', '头孢类', '青霉素类', '奶制品', '其他'],
- historyOptions:['糖尿病', '哮喘', '恶性肿瘤', '高血压', '其他'],
- isOptions:['有', '无'],
- isGoodOptions:['正常', '异常'],
- relationOptions: ['本人', '配偶', '父母', '子女', '朋友', '亲戚', '其他'],
- loading: true,
- // 导出遮罩层
- exportLoading: false,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 病人表格数据
- patientList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- patientName: null,
- nickName:null,
- userId: null,
- idCard: null,
- birthday: null,
- sex: null,
- weight: null,
- mobile: null,
- isDel: null,
- status: null,
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- patientName: [
- { required: true, message: "名称不能为空", trigger: "blur" }
- ],
- // idCard: [
- // { required: true, message: "身份证号不能为空", trigger: "blur" },
- // ],
- sex: [
- { required: true, message: "性别不能为空", trigger: "blur" }
- ],
- // birthday: [
- // { required: true, message: "生日不能为空", trigger: "blur" }
- // ],
- // mobile:[
- // { required: true, message: "手机号不能为空", trigger: "blur" },
- // ],
- status: [
- { required: true, message: "状态不能为空", trigger: "blur" }
- ],
- relation: [
- { required: true, message: '请选择与本人关系', trigger: 'change' }
- ],
- liverUnusual: [
- { required: true, message: '请选择肝功能是否异常', trigger: 'change' }
- ],
- renalUnusual: [
- { required: true, message: '请选择肾功能是否异常', trigger: 'change' }
- ],
- historyAllergic: [
- { required: true, message: '请选择过敏史', trigger: 'change' }
- ],
- familyMedHistory: [
- { required: true, message: '请选择家族病史', trigger: 'change' }
- ],
- selfMedHistory: [
- { required: true, message: '请选择个人病史', trigger: 'change' }
- ]
- }
- };
- },
- created() {
- this.getDicts("sys_company_or").then(response => {
- this.orOptions = response.data;
- });
- this.getDicts("sys_patient_status").then(response => {
- this.pOptions = response.data;
- });
- this.getDicts("sys_patient_sex").then(response => {
- this.sexOptions = response.data;
- });
- },
- methods: {
- /**识别身份证的出生日期 */
- parseBirthdayFromIdCard(idCard) {
- const year = idCard.substr(6, 4);
- const month = idCard.substr(10, 2);
- const day = idCard.substr(12, 2);
- this.form.birthday = `${year}-${month}-${day}`;
- },
- /** 查询病人列表 */
- getList() {
- this.loading = true;
- listPatient(this.queryParams).then(response => {
- this.patientList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- getPatList(id){
- this.loading = true;
- this.queryParams.userId=id;
- listPatient(this.queryParams).then(response => {
- this.patientList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- patientId: null,
- patientName: null,
- userId: null,
- idCard: null,
- birthday: null,
- nickName:null,
- sex: null,
- weight: null,
- mobile: null,
- isDel: null,
- status: null,
- createTime: null,
- updateTime: null
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.patientId)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = this.addPatientInfo||"添加病人";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const patientId = row.patientId || this.ids
- getPatient(patientId).then(response => {
- this.form = response.data;
- this.open = true;
- this.title = "修改病人";
- this.form.status = String(this.form.status);
- this.form.sex = String(this.form.sex)
- this.form.isDefault = String(this.form.isDefault)
- if(this.form.historyAllergic=="无"){
- this.historyAllergic=[];
- }else{
- this.historyAllergic=(this.form.historyAllergic).split(",")
- this.form.historyAllergic="有"
- }
- if(this.form.familyMedHistory=="无"){
- this.familyMedHistory=[];
- }else{
- this.familyMedHistory=(this.form.familyMedHistory).split(",")
- this.form.familyMedHistory="有"
- }
- console.log(this.form.selfMedHistory)
- if(this.form.selfMedHistory=="无"){
- this.selfMedHistory=[];
- }else{
- this.selfMedHistory=(this.form.selfMedHistory).split(",")
- this.form.selfMedHistory="有"
- }
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if(this.form.historyAllergic=="有"){
- if(this.historyAllergic==""){
- return this.$message("过敏史不能为空");
- }
- }
- if(this.form.familyMedHistory=="有"){
- if(this.familyMedHistory==""){
- return this.$message("家族病史不能为空");
- }
- }
- if(this.form.selfMedHistory=="有"){
- if(this.selfMedHistory==""){
- return this.$message("个人病史不能为空");
- }
- }
- if(this.form.historyAllergic=="有"){
- this.form.historyAllergic=(this.historyAllergic).toString()
- }
- if(this.form.familyMedHistory=="有"){
- this.form.familyMedHistory=(this.familyMedHistory).toString()
- }
- if(this.form.selfMedHistory=="有"){
- this.form.selfMedHistory=(this.selfMedHistory).toString()
- }
- if (this.form.patientId != null) {
- updatePatient(this.form).then(response => {
- this.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- this.form.userId=this.queryParams.userId
- addPatient(this.form).then(response => {
- this.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const patientIds = row.patientId || this.ids;
- this.$confirm('是否确认删除病人编号为"' + patientIds + '"的数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delPatient(patientIds);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- }).catch(() => {});
- },
- }
- };
- </script>
|