userPatietDetails.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <template>
  2. <div >
  3. <el-row :gutter="10" class="mb8" style="float: right; top: -30px;">
  4. <el-col :span="1.5">
  5. <el-button
  6. type="primary"
  7. plain
  8. icon="el-icon-plus"
  9. size="mini"
  10. @click="handleAdd"
  11. v-hasPermi="['his:patient:add']"
  12. >新增</el-button>
  13. </el-col>
  14. </el-row>
  15. <el-table v-loading="loading" border :data="patientList" @selection-change="handleSelectionChange" style="top: -30px;">
  16. <el-table-column label="患者姓名" align="center" prop="patientName" />
  17. <el-table-column label="所属会员" align="center" width="150px">
  18. <template slot-scope="scope">
  19. <div v-if="scope.row.nickName!=null"> {{scope.row.nickName}}-{{scope.row.phone}}</div>
  20. </template>
  21. </el-table-column>
  22. <el-table-column label="身份证号" align="center" prop="idCard" width="170px"/>
  23. <el-table-column label="出生年月" align="center" prop="birthday" width="180">
  24. <template slot-scope="scope">
  25. <span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>
  26. </template>
  27. </el-table-column>
  28. <el-table-column label="性别" align="center" prop="sex" >
  29. <template slot-scope="scope">
  30. <dict-tag :options="sexOptions" :value="scope.row.sex"/>
  31. </template>
  32. </el-table-column>
  33. <el-table-column label="体重G" align="center" prop="weight" />
  34. <el-table-column label="手机号" align="center" prop="mobile" />
  35. <el-table-column label="状态" align="center" prop="status" >
  36. <template slot-scope="scope">
  37. <dict-tag :options="pOptions" :value="scope.row.status"/>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="与本人关系" align="center" prop="relation" />
  41. <el-table-column label="肝功能是否异常" align="center" prop="liverUnusual" />
  42. <el-table-column label="肾功能是否异常" align="center" prop="renalUnusual" />
  43. <el-table-column label="过敏史" align="center" prop="historyAllergic" />
  44. <el-table-column label="家族病史" align="center" prop="familyMedHistory" />
  45. <el-table-column label="个人病史" align="center" prop="selfMedHistory" />
  46. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150px">
  47. <template slot-scope="scope">
  48. <el-button
  49. size="mini"
  50. type="text"
  51. icon="el-icon-edit"
  52. @click="handleUpdate(scope.row)"
  53. v-hasPermi="['his:patient:edit']"
  54. >修改</el-button>
  55. <el-button
  56. size="mini"
  57. type="text"
  58. icon="el-icon-delete"
  59. @click="handleDelete(scope.row)"
  60. v-hasPermi="['his:patient:remove']"
  61. >删除</el-button>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <pagination
  66. v-show="total>0"
  67. :total="total"
  68. :page.sync="queryParams.pageNum"
  69. :limit.sync="queryParams.pageSize"
  70. @pagination="getList"
  71. />
  72. <!-- 添加或修改病人对话框 -->
  73. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
  74. <el-form ref="form" :model="form" :rules="rules" label-width="125px">
  75. <el-form-item label="患者姓名" prop="patientName">
  76. <el-input v-model="form.patientName" placeholder="请输入患者姓名" />
  77. </el-form-item>
  78. <el-form-item label="身份证号" prop="idCard">
  79. <el-input v-model="form.idCard" placeholder="请输入身份证号" @blur="parseBirthdayFromIdCard(form.idCard)" />
  80. </el-form-item>
  81. <el-form-item label="出生年月" prop="birthday">
  82. <el-date-picker clearable size="small"
  83. v-model="form.birthday"
  84. type="date"
  85. value-format="yyyy-MM-dd"
  86. placeholder="选择出生年月">
  87. </el-date-picker>
  88. </el-form-item>
  89. <el-form-item label="性别" prop="sex">
  90. <el-select v-model="form.sex" placeholder="性别" clearable size="small">
  91. <el-option
  92. v-for="dict in sexOptions"
  93. :key="dict.dictValue"
  94. :label="dict.dictLabel"
  95. :value="dict.dictValue"
  96. />
  97. </el-select>
  98. </el-form-item>
  99. <el-form-item label="体重KG" prop="weight">
  100. <el-input v-model="form.weight" placeholder="请输入体重KG" />
  101. </el-form-item>
  102. <el-form-item label="手机号" prop="mobile">
  103. <el-input v-model="form.mobile" placeholder="请输入手机号" />
  104. </el-form-item>
  105. <el-form-item label="状态" prop="status">
  106. <el-select v-model="form.status" placeholder="状态" clearable size="small">
  107. <el-option
  108. v-for="dict in pOptions"
  109. :key="dict.dictValue"
  110. :label="dict.dictLabel"
  111. :value="dict.dictValue"
  112. />
  113. </el-select>
  114. </el-form-item>
  115. <el-form-item label="是否默认" prop="isDefault">
  116. <el-radio-group v-model="form.isDefault">
  117. <el-radio :label="item.dictValue" v-for="item in orOptions" >{{item.dictLabel}}</el-radio>
  118. </el-radio-group>
  119. </el-form-item>
  120. <el-form-item label="与本人关系" prop="relation">
  121. <el-select v-model="form.relation">
  122. <el-option v-for="(option, index) in relationOptions" :key="index" :value="option" clearable></el-option>
  123. </el-select>
  124. </el-form-item>
  125. <el-form-item label="肝功能是否异常" prop="liverUnusual">
  126. <el-radio-group v-model="form.liverUnusual">
  127. <el-radio :label="item" v-for="item in isGoodOptions" >{{item}}</el-radio>
  128. </el-radio-group>
  129. </el-form-item>
  130. <el-form-item label="肾功能是否异常" prop="renalUnusual">
  131. <el-radio-group v-model="form.renalUnusual" >
  132. <el-radio :label="item" v-for="item in isGoodOptions" >{{item}}</el-radio>
  133. </el-radio-group>
  134. </el-form-item>
  135. <el-form-item label="过敏史" prop="historyAllergic">
  136. <el-radio-group v-model="form.historyAllergic">
  137. <el-radio :label="item" v-for="item in isOptions" >{{item}}</el-radio>
  138. </el-radio-group>
  139. <el-checkbox-group v-model="historyAllergic" size="medium" v-if="form.historyAllergic=='有'">
  140. <el-checkbox v-for="item in historyAllergicOptions" :key="item" :label="item"
  141. >{{item}}</el-checkbox>
  142. </el-checkbox-group>
  143. </el-form-item>
  144. <el-form-item label="家族病史" prop="familyMedHistory">
  145. <el-radio-group v-model="form.familyMedHistory">
  146. <el-radio :label="item" v-for="item in isOptions" >{{item}}</el-radio>
  147. </el-radio-group>
  148. <el-checkbox-group v-model="familyMedHistory" size="medium" v-if="form.familyMedHistory=='有'">
  149. <el-checkbox v-for="item in historyOptions" :key="item" :label="item"
  150. >{{item}}</el-checkbox>
  151. </el-checkbox-group>
  152. </el-form-item>
  153. <el-form-item label="个人病史" prop="selfMedHistory" >
  154. <el-radio-group v-model="form.selfMedHistory">
  155. <el-radio :label="item" v-for="item in isOptions" >{{item}}</el-radio>
  156. </el-radio-group>
  157. <el-checkbox-group v-model="selfMedHistory" size="medium" v-if="form.selfMedHistory=='有'">
  158. <el-checkbox v-for="item in historyOptions" :key="item" :label="item"
  159. >{{item}}</el-checkbox>
  160. </el-checkbox-group>
  161. </el-form-item>
  162. </el-form>
  163. <div slot="footer" class="dialog-footer">
  164. <el-button type="primary" @click="submitForm">确 定</el-button>
  165. <el-button @click="cancel">取 消</el-button>
  166. </div>
  167. </el-dialog>
  168. </div>
  169. </template>
  170. <script>
  171. import {
  172. listPatient,
  173. getPatient,
  174. delPatient,
  175. addPatient,
  176. updatePatient,
  177. exportPatient,
  178. listPatientList
  179. } from '@/api/his/patient'
  180. import {getUserList} from "@/api/his/doctor";
  181. export default {
  182. name: "Patient",
  183. data() {
  184. return {
  185. addPatientInfo: process.env.VUE_APP_ADD_PATIENT,
  186. show:{
  187. title:"患者详情",
  188. open:false,
  189. },
  190. // 遮罩层
  191. userList:[],
  192. userName: {name:null},
  193. sexOptions: [],
  194. pOptions: [],
  195. orOptions:[],
  196. historyAllergic:[],
  197. familyMedHistory:[],
  198. selfMedHistory:[],
  199. historyAllergicOptions:['阿司匹林', '磺胺类', '头孢类', '青霉素类', '奶制品', '其他'],
  200. historyOptions:['糖尿病', '哮喘', '恶性肿瘤', '高血压', '其他'],
  201. isOptions:['有', '无'],
  202. isGoodOptions:['正常', '异常'],
  203. relationOptions: ['本人', '配偶', '父母', '子女', '朋友', '亲戚', '其他'],
  204. loading: true,
  205. // 导出遮罩层
  206. exportLoading: false,
  207. // 选中数组
  208. ids: [],
  209. // 非单个禁用
  210. single: true,
  211. // 非多个禁用
  212. multiple: true,
  213. // 显示搜索条件
  214. showSearch: true,
  215. // 总条数
  216. total: 0,
  217. // 病人表格数据
  218. patientList: [],
  219. // 弹出层标题
  220. title: "",
  221. // 是否显示弹出层
  222. open: false,
  223. // 查询参数
  224. queryParams: {
  225. pageNum: 1,
  226. pageSize: 10,
  227. patientName: null,
  228. nickName:null,
  229. userId: null,
  230. idCard: null,
  231. birthday: null,
  232. sex: null,
  233. weight: null,
  234. mobile: null,
  235. isDel: null,
  236. status: null,
  237. },
  238. // 表单参数
  239. form: {},
  240. // 表单校验
  241. rules: {
  242. patientName: [
  243. { required: true, message: "名称不能为空", trigger: "blur" }
  244. ],
  245. // idCard: [
  246. // { required: true, message: "身份证号不能为空", trigger: "blur" },
  247. // ],
  248. sex: [
  249. { required: true, message: "性别不能为空", trigger: "blur" }
  250. ],
  251. // birthday: [
  252. // { required: true, message: "生日不能为空", trigger: "blur" }
  253. // ],
  254. // mobile:[
  255. // { required: true, message: "手机号不能为空", trigger: "blur" },
  256. // ],
  257. status: [
  258. { required: true, message: "状态不能为空", trigger: "blur" }
  259. ],
  260. relation: [
  261. { required: true, message: '请选择与本人关系', trigger: 'change' }
  262. ],
  263. liverUnusual: [
  264. { required: true, message: '请选择肝功能是否异常', trigger: 'change' }
  265. ],
  266. renalUnusual: [
  267. { required: true, message: '请选择肾功能是否异常', trigger: 'change' }
  268. ],
  269. historyAllergic: [
  270. { required: true, message: '请选择过敏史', trigger: 'change' }
  271. ],
  272. familyMedHistory: [
  273. { required: true, message: '请选择家族病史', trigger: 'change' }
  274. ],
  275. selfMedHistory: [
  276. { required: true, message: '请选择个人病史', trigger: 'change' }
  277. ]
  278. }
  279. };
  280. },
  281. created() {
  282. this.getDicts("sys_company_or").then(response => {
  283. this.orOptions = response.data;
  284. });
  285. this.getDicts("sys_patient_status").then(response => {
  286. this.pOptions = response.data;
  287. });
  288. this.getDicts("sys_patient_sex").then(response => {
  289. this.sexOptions = response.data;
  290. });
  291. },
  292. methods: {
  293. /**识别身份证的出生日期 */
  294. parseBirthdayFromIdCard(idCard) {
  295. const year = idCard.substr(6, 4);
  296. const month = idCard.substr(10, 2);
  297. const day = idCard.substr(12, 2);
  298. this.form.birthday = `${year}-${month}-${day}`;
  299. },
  300. /** 查询病人列表 */
  301. getList() {
  302. this.loading = true;
  303. listPatient(this.queryParams).then(response => {
  304. this.patientList = response.rows;
  305. this.total = response.total;
  306. this.loading = false;
  307. });
  308. },
  309. getPatList(id){
  310. this.loading = true;
  311. this.queryParams.userId=id;
  312. listPatient(this.queryParams).then(response => {
  313. this.patientList = response.rows;
  314. this.total = response.total;
  315. this.loading = false;
  316. });
  317. },
  318. // 取消按钮
  319. cancel() {
  320. this.open = false;
  321. this.reset();
  322. },
  323. // 表单重置
  324. reset() {
  325. this.form = {
  326. patientId: null,
  327. patientName: null,
  328. userId: null,
  329. idCard: null,
  330. birthday: null,
  331. nickName:null,
  332. sex: null,
  333. weight: null,
  334. mobile: null,
  335. isDel: null,
  336. status: null,
  337. createTime: null,
  338. updateTime: null
  339. };
  340. this.resetForm("form");
  341. },
  342. /** 搜索按钮操作 */
  343. handleQuery() {
  344. this.queryParams.pageNum = 1;
  345. this.getList();
  346. },
  347. /** 重置按钮操作 */
  348. resetQuery() {
  349. this.resetForm("queryForm");
  350. this.handleQuery();
  351. },
  352. // 多选框选中数据
  353. handleSelectionChange(selection) {
  354. this.ids = selection.map(item => item.patientId)
  355. this.single = selection.length!==1
  356. this.multiple = !selection.length
  357. },
  358. /** 新增按钮操作 */
  359. handleAdd() {
  360. this.reset();
  361. this.open = true;
  362. this.title = this.addPatientInfo||"添加病人";
  363. },
  364. /** 修改按钮操作 */
  365. handleUpdate(row) {
  366. this.reset();
  367. const patientId = row.patientId || this.ids
  368. getPatient(patientId).then(response => {
  369. this.form = response.data;
  370. this.open = true;
  371. this.title = "修改病人";
  372. this.form.status = String(this.form.status);
  373. this.form.sex = String(this.form.sex)
  374. this.form.isDefault = String(this.form.isDefault)
  375. if(this.form.historyAllergic=="无"){
  376. this.historyAllergic=[];
  377. }else{
  378. this.historyAllergic=(this.form.historyAllergic).split(",")
  379. this.form.historyAllergic="有"
  380. }
  381. if(this.form.familyMedHistory=="无"){
  382. this.familyMedHistory=[];
  383. }else{
  384. this.familyMedHistory=(this.form.familyMedHistory).split(",")
  385. this.form.familyMedHistory="有"
  386. }
  387. console.log(this.form.selfMedHistory)
  388. if(this.form.selfMedHistory=="无"){
  389. this.selfMedHistory=[];
  390. }else{
  391. this.selfMedHistory=(this.form.selfMedHistory).split(",")
  392. this.form.selfMedHistory="有"
  393. }
  394. });
  395. },
  396. /** 提交按钮 */
  397. submitForm() {
  398. this.$refs["form"].validate(valid => {
  399. if (valid) {
  400. if(this.form.historyAllergic=="有"){
  401. if(this.historyAllergic==""){
  402. return this.$message("过敏史不能为空");
  403. }
  404. }
  405. if(this.form.familyMedHistory=="有"){
  406. if(this.familyMedHistory==""){
  407. return this.$message("家族病史不能为空");
  408. }
  409. }
  410. if(this.form.selfMedHistory=="有"){
  411. if(this.selfMedHistory==""){
  412. return this.$message("个人病史不能为空");
  413. }
  414. }
  415. if(this.form.historyAllergic=="有"){
  416. this.form.historyAllergic=(this.historyAllergic).toString()
  417. }
  418. if(this.form.familyMedHistory=="有"){
  419. this.form.familyMedHistory=(this.familyMedHistory).toString()
  420. }
  421. if(this.form.selfMedHistory=="有"){
  422. this.form.selfMedHistory=(this.selfMedHistory).toString()
  423. }
  424. if (this.form.patientId != null) {
  425. updatePatient(this.form).then(response => {
  426. this.msgSuccess("修改成功");
  427. this.open = false;
  428. this.getList();
  429. });
  430. } else {
  431. this.form.userId=this.queryParams.userId
  432. addPatient(this.form).then(response => {
  433. this.msgSuccess("新增成功");
  434. this.open = false;
  435. this.getList();
  436. });
  437. }
  438. }
  439. });
  440. },
  441. /** 删除按钮操作 */
  442. handleDelete(row) {
  443. const patientIds = row.patientId || this.ids;
  444. this.$confirm('是否确认删除病人编号为"' + patientIds + '"的数据项?', "警告", {
  445. confirmButtonText: "确定",
  446. cancelButtonText: "取消",
  447. type: "warning"
  448. }).then(function() {
  449. return delPatient(patientIds);
  450. }).then(() => {
  451. this.getList();
  452. this.msgSuccess("删除成功");
  453. }).catch(() => {});
  454. },
  455. }
  456. };
  457. </script>