userPatietDetails.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  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 { listPatient, getPatient, delPatient, addPatient, updatePatient, exportPatient } from "@/api/store/patient";
  172. export default {
  173. name: "Patient",
  174. data() {
  175. return {
  176. addPatientInfo: process.env.VUE_APP_ADD_PATIENT,
  177. orOptions:[],
  178. show:{
  179. title:"患者详情",
  180. open:false,
  181. },
  182. // 遮罩层
  183. userList:[],
  184. userName: {name:null},
  185. sexOptions: [],
  186. pOptions: [],
  187. loading: true,
  188. // 导出遮罩层
  189. exportLoading: false,
  190. // 选中数组
  191. ids: [],
  192. // 非单个禁用
  193. single: true,
  194. // 非多个禁用
  195. multiple: true,
  196. // 显示搜索条件
  197. showSearch: true,
  198. historyAllergic:[],
  199. familyMedHistory:[],
  200. selfMedHistory:[],
  201. historyAllergicOptions:['阿司匹林', '磺胺类', '头孢类', '青霉素类', '奶制品', '其他'],
  202. historyOptions:['糖尿病', '哮喘', '恶性肿瘤', '高血压', '其他'],
  203. isOptions:['有', '无'],
  204. isGoodOptions:['正常', '异常'],
  205. relationOptions: ['本人', '配偶', '父母', '子女', '朋友', '亲戚', '其他'],
  206. // 总条数
  207. total: 0,
  208. // 病人表格数据
  209. patientList: [],
  210. // 弹出层标题
  211. title: "",
  212. // 是否显示弹出层
  213. open: false,
  214. // 查询参数
  215. queryParams: {
  216. pageNum: 1,
  217. pageSize: 10,
  218. patientName: null,
  219. nickName:null,
  220. userId: null,
  221. idCard: null,
  222. birthday: null,
  223. sex: null,
  224. weight: null,
  225. mobile: null,
  226. isDel: null,
  227. status: null,
  228. },
  229. // 表单参数
  230. form: {},
  231. // 表单校验
  232. rules: {
  233. patientName: [
  234. { required: true, message: "名称不能为空", trigger: "blur" }
  235. ],
  236. // idCard: [
  237. // { required: true, message: "身份证号不能为空", trigger: "blur" }
  238. // ],
  239. sex: [
  240. { required: true, message: "性别不能为空", trigger: "blur" }
  241. ],
  242. // birthday: [
  243. // { required: true, message: "生日不能为空", trigger: "blur" }
  244. // ],
  245. status: [
  246. { required: true, message: "状态不能为空", trigger: "blur" }
  247. ],
  248. // mobile: [
  249. // { required: true, message: "手机号不能为空", trigger: "blur" },
  250. // ],
  251. relation: [
  252. { required: true, message: '请选择与本人关系', trigger: 'change' }
  253. ],
  254. liverUnusual: [
  255. { required: true, message: '请选择肝功能是否异常', trigger: 'change' }
  256. ],
  257. renalUnusual: [
  258. { required: true, message: '请选择肾功能是否异常', trigger: 'change' }
  259. ],
  260. historyAllergic: [
  261. { required: true, message: '请选择过敏史', trigger: 'change' }
  262. ],
  263. familyMedHistory: [
  264. { required: true, message: '请选择家族病史', trigger: 'change' }
  265. ],
  266. selfMedHistory: [
  267. { required: true, message: '请选择个人病史', trigger: 'change' }
  268. ]
  269. }
  270. };
  271. },
  272. created() {
  273. this.getDicts("sys_company_or").then(response => {
  274. this.orOptions = response.data;
  275. });
  276. this.getDicts("sys_patient_status").then(response => {
  277. this.pOptions = response.data;
  278. });
  279. this.getDicts("sys_patient_sex").then(response => {
  280. this.sexOptions = response.data;
  281. });
  282. },
  283. methods: {
  284. /** 查询病人列表 */
  285. getList() {
  286. this.loading = true;
  287. listPatient(this.queryParams).then(response => {
  288. this.patientList = response.rows;
  289. this.total = response.total;
  290. this.loading = false;
  291. });
  292. },
  293. getPatList(id){
  294. this.loading = true;
  295. this.queryParams.userId=id;
  296. listPatient(this.queryParams).then(response => {
  297. this.patientList = response.rows;
  298. this.total = response.total;
  299. this.loading = false;
  300. });
  301. },
  302. // 取消按钮
  303. cancel() {
  304. this.open = false;
  305. this.reset();
  306. },
  307. // 表单重置
  308. reset() {
  309. this.form = {
  310. patientId: null,
  311. patientName: null,
  312. userId: null,
  313. idCard: null,
  314. birthday: null,
  315. nickName:null,
  316. sex: null,
  317. weight: null,
  318. mobile: null,
  319. isDel: null,
  320. status: null,
  321. createTime: null,
  322. updateTime: null
  323. };
  324. this.resetForm("form");
  325. },
  326. /** 搜索按钮操作 */
  327. handleQuery() {
  328. this.queryParams.pageNum = 1;
  329. this.getList();
  330. },
  331. /** 重置按钮操作 */
  332. resetQuery() {
  333. this.resetForm("queryForm");
  334. this.handleQuery();
  335. },
  336. // 多选框选中数据
  337. handleSelectionChange(selection) {
  338. this.ids = selection.map(item => item.patientId)
  339. this.single = selection.length!==1
  340. this.multiple = !selection.length
  341. },
  342. /** 新增按钮操作 */
  343. handleAdd() {
  344. this.reset();
  345. this.open = true;
  346. this.title = this.addPatientInfo||"添加病人";
  347. },
  348. /** 修改按钮操作 */
  349. handleUpdate(row) {
  350. this.reset();
  351. const patientId = row.patientId || this.ids
  352. getPatient(patientId).then(response => {
  353. this.form = response.data;
  354. this.open = true;
  355. this.title = "修改病人";
  356. this.form.status = String(this.form.status);
  357. this.form.sex = String(this.form.sex)
  358. this.form.isDefault = String(this.form.isDefault)
  359. if(this.form.historyAllergic=="无"){
  360. this.historyAllergic=[];
  361. }else{
  362. this.historyAllergic=(this.form.historyAllergic).split(",")
  363. this.form.historyAllergic="有"
  364. }
  365. if(this.form.familyMedHistory=="无"){
  366. this.familyMedHistory=[];
  367. }else{
  368. this.familyMedHistory=(this.form.familyMedHistory).split(",")
  369. this.form.familyMedHistory="有"
  370. }
  371. console.log(this.form.selfMedHistory)
  372. if(this.form.selfMedHistory=="无"){
  373. this.selfMedHistory=[];
  374. }else{
  375. this.selfMedHistory=(this.form.selfMedHistory).split(",")
  376. this.form.selfMedHistory="有"
  377. }
  378. });
  379. },
  380. /** 提交按钮 */
  381. submitForm() {
  382. this.$refs["form"].validate(valid => {
  383. if (valid) {
  384. if(this.form.historyAllergic=="有"){
  385. if(this.historyAllergic==""){
  386. return this.$message("过敏史不能为空");
  387. }
  388. }
  389. if(this.form.familyMedHistory=="有"){
  390. if(this.familyMedHistory==""){
  391. return this.$message("家族病史不能为空");
  392. }
  393. }
  394. if(this.form.selfMedHistory=="有"){
  395. if(this.selfMedHistory==""){
  396. return this.$message("个人病史不能为空");
  397. }
  398. }
  399. if(this.form.historyAllergic=="有"){
  400. this.form.historyAllergic=(this.historyAllergic).toString()
  401. }
  402. if(this.form.familyMedHistory=="有"){
  403. this.form.familyMedHistory=(this.familyMedHistory).toString()
  404. }
  405. if(this.form.selfMedHistory=="有"){
  406. this.form.selfMedHistory=(this.selfMedHistory).toString()
  407. }
  408. if (this.form.patientId != null) {
  409. updatePatient(this.form).then(response => {
  410. this.msgSuccess("修改成功");
  411. this.open = false;
  412. this.getList(this.queryParams.userId);
  413. });
  414. } else {
  415. this.form.userId=this.queryParams.userId
  416. addPatient(this.form).then(response => {
  417. this.msgSuccess("新增成功");
  418. this.open = false;
  419. this.getList(this.queryParams.userId);
  420. });
  421. }
  422. }
  423. });
  424. },
  425. /** 删除按钮操作 */
  426. handleDelete(row) {
  427. const patientIds = row.patientId || this.ids;
  428. this.$confirm('是否确认删除病人编号为"' + patientIds + '"的数据项?', "警告", {
  429. confirmButtonText: "确定",
  430. cancelButtonText: "取消",
  431. type: "warning"
  432. }).then(function() {
  433. return delPatient(patientIds);
  434. }).then(() => {
  435. this.getList(this.queryParams.userId);
  436. this.msgSuccess("删除成功");
  437. }).catch(() => {});
  438. },
  439. }
  440. };
  441. </script>