index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
  4. <el-form-item label="患者名称" prop="name">
  5. <el-input v-model="queryParams.name" placeholder="请输入患者名称" clearable size="small"
  6. @keyup.enter.native="handleQuery" />
  7. </el-form-item>
  8. <el-form-item label="手机号" prop="mobile">
  9. <el-input v-model="queryParams.mobile" placeholder="请输入手机号" clearable size="small"
  10. @keyup.enter.native="handleQuery" />
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  14. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  15. </el-form-item>
  16. </el-form>
  17. <!--
  18. <el-row :gutter="10" class="mb8">
  19. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  20. </el-row> -->
  21. <el-table v-loading="loading" :data="listData" row-key="id">
  22. <el-table-column prop="name" label="患者名称" :show-overflow-tooltip="true"></el-table-column>
  23. <el-table-column prop="age" label="年龄"></el-table-column>
  24. <el-table-column prop="education" label="学历">
  25. <template slot-scope="scope">
  26. <dict-tag :options="dict.type.education_type" :value="scope.row.education" />
  27. </template>
  28. </el-table-column>
  29. <el-table-column prop="mobile" label="手机号"></el-table-column>
  30. <el-table-column prop="doctorName" label="负责医生"></el-table-column>
  31. <el-table-column prop="testFlag" label="测评状态">
  32. <template slot-scope="scope">
  33. <span v-if="scope.row.testFlag=='0'">否</span>
  34. <span v-if="scope.row.testFlag=='1'">是</span>
  35. <span v-if="scope.row.testFlag=='2'">测评中</span>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="packageName" label="套餐名称"></el-table-column>
  39. <!-- <el-table-column prop="gameDifficulty" label="游戏难度">
  40. <template slot-scope="scope">
  41. <dict-tag :options="dict.type.game_difficulty" :value="scope.row.gameDifficulty" />
  42. </template>
  43. </el-table-column> -->
  44. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  45. <template slot-scope="scope">
  46. <!-- <el-button size="mini" type="text" @click="handelCePing(scope.row)">专业测评</el-button> -->
  47. <el-button size="mini" type="text" @click="handelLook(scope.row)">查看</el-button>
  48. <el-button size="mini" type="text" @click="handelEdit(scope.row)">修改</el-button>
  49. <el-button size="mini" type="text" style="color: red;" @click="handelDel(scope.row.id)">删除</el-button>
  50. <el-button size="mini" type="text" @click="handelCePingInfo(scope.row)">测评报告</el-button>
  51. <el-button size="mini" type="text" @click="handelTrain(scope.row)">训练数据</el-button>
  52. <el-button size="mini" type="text" @click="resetPassWord(scope.row)">重置密码</el-button>
  53. <!-- <router-link :to="'/train/list/index/' + scope.row.id" style="color: #1890ff; font-size: 12px;margin: 0 10px;">训练数据</router-link> -->
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. <lookDetail ref="look" />
  58. <trainDetatil ref="train" />
  59. <cePingInfo ref="cepingInfo" @refresh="handleQuery" />
  60. <!-- 分页 -->
  61. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :page-sizes="[10, 20, 30,50,100]" :limit.sync="queryParams.limit" />
  62. <el-dialog title="重置患者密码" :visible="resetShow" width="700px" append-to-body destroy-on-close>
  63. <el-form ref="resetForm" :model="resetForm" :rules="rulesPass" label-width="110px">
  64. <el-form-item label="新密码" prop="newPwd">
  65. <el-input v-model="resetForm.newPwd" placeholder="请输入新密码" type="password" show-password />
  66. </el-form-item>
  67. <el-form-item>
  68. <el-button type="primary" size="mini" @click="submit">修改</el-button>
  69. <el-button type="danger" size="mini" @click="resetShow = false">关闭</el-button> 
  70. </el-form-item>
  71. </el-form>
  72. </el-dialog>
  73. </div>
  74. </template>
  75. <script>
  76. import { listData, delpatient, patientDetail, learnSelectAll, queryMonthRecord, reviewTaskSave,resetPasswordSys } from '@/api/patient/index'
  77. import { debounce } from 'lodash-es'
  78. import lookDetail from './lookDetail.vue';
  79. import trainDetatil from './trainDetatil.vue';
  80. import cePingInfo from './cePingInfo.vue';
  81. import {symmetryEncrypt} from '@/utils/secret'
  82. export default {
  83. name: "patient_list",
  84. dicts: ['education_type'],
  85. components: { lookDetail, trainDetatil, cePingInfo },
  86. data() {
  87. return {
  88. // 遮罩层
  89. loading: true,
  90. // 显示搜索条件
  91. showSearch: true,
  92. // 表格树数据
  93. listData: [],
  94. // 弹出层标题
  95. title: "",
  96. // 是否显示弹出层
  97. open: false,
  98. // 总条数
  99. total: 0,
  100. // 查询参数
  101. queryParams: {
  102. page: 1,
  103. limit: 10,
  104. status: 0
  105. },
  106. resetShow: false,
  107. resetForm:{
  108. id: "",
  109. pwd: "",
  110. newPwd: ""
  111. },
  112. rulesPass: {
  113. newPwd: [
  114. { required: true, message: "新密码不能为空", trigger: "blur" },
  115. {
  116. pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,11}$/,
  117. message:
  118. "密码长度必须8-11位数且包含大小写字母,数字",
  119. trigger: "blur"
  120. }
  121. ]
  122. }
  123. };
  124. },
  125. created() {
  126. this.getList();
  127. },
  128. watch: {
  129. 'queryParams.page': {
  130. handler(newVal, oldVal) {
  131. if (newVal != oldVal) {
  132. this.getList()
  133. }
  134. },
  135. deep: true,
  136. immediate: true
  137. },
  138. 'queryParams.limit': {
  139. handler(newVal, oldVal) {
  140. if (newVal != oldVal) {
  141. this.getList()
  142. }
  143. },
  144. deep: true,
  145. immediate: true
  146. }
  147. },
  148. methods: {
  149. submit() {
  150. this.$refs["resetForm"].validate(valid => {
  151. if(valid) {
  152. this.resetForm.pwd = symmetryEncrypt(this.resetForm.newPwd)
  153. this.resetForm.newPwd = ""
  154. resetPasswordSys(this.resetForm).then(resp => {
  155. if(resp.data == true) {
  156. this.$modal.msgSuccess("修改成功");
  157. this.resetShow = false
  158. }
  159. })
  160. }
  161. })
  162. },
  163. resetPassWord(row) {
  164. this.resetShow = true
  165. this.resetForm = {
  166. id: row.id,
  167. newPwd: ""
  168. }
  169. },
  170. /** 查询机构列表 */
  171. getList() {
  172. this.loading = true;
  173. listData(this.queryParams).then(response => {
  174. this.listData = response.data.records
  175. this.total = response.data.total;
  176. this.loading = false;
  177. });
  178. },
  179. // 表单重置
  180. reset() {
  181. this.form = {
  182. };
  183. },
  184. /** 搜索按钮操作 */
  185. handleQuery() {
  186. this.getList();
  187. },
  188. /** 重置按钮操作 */
  189. resetQuery() {
  190. this.resetForm("queryForm");
  191. this.handleQuery();
  192. },
  193. /** 删除按钮 */
  194. handelDel(id) {
  195. this.$confirm('此操作将永久删除, 是否继续?', '提示', {
  196. confirmButtonText: '确定',
  197. cancelButtonText: '取消',
  198. type: 'warning'
  199. }).then(() => {
  200. delpatient(id).then(res => {
  201. this.$modal.msgSuccess(`删除成功`);
  202. this.getList()
  203. })
  204. }).catch(() => {
  205. });
  206. },
  207. // 修改
  208. handelEdit(row) {
  209. let item = JSON.stringify(row)
  210. this.$router.push({ name: 'add', params: { item, isEdit: '1',next:'1'} });
  211. // this.$router.push({ path: '/patient/add', params: { item } });
  212. },
  213. // 专业测评
  214. handelCePing: debounce(function (row) {
  215. let that = this
  216. reviewTaskSave({ userId: row.id }).then(res => {
  217. that.$modal.msgSuccess('测评推送成功')
  218. that.handleQuery()
  219. })
  220. }, 500),
  221. // 查看
  222. handelLook(row) {
  223. let item = JSON.parse(JSON.stringify(row))
  224. patientDetail(row.id).then(res => {
  225. res.data.medicalCurrentTypes = res.data.medicalCurrentTypes.split ? res.data.medicalCurrentTypes.split(',') : undefined
  226. res.data.medicalHisTypes = res.data.medicalHisTypes ? res.data.medicalHisTypes.split(',') : undefined
  227. res.data.geneticDiseases = res.data.geneticDiseases ? res.data.geneticDiseases.split(',') : undefined
  228. res.data.tags = res.data.tags ? res.data.tags.split(',') : undefined
  229. res.data.diagnoseResult = res.data.diagnoseResult ? res.data.diagnoseResult.split(',') : undefined
  230. learnSelectAll().then(res1 => {
  231. res1.data.map((item) => {
  232. if (item.id == res.data.packageId) {
  233. res.data.packageName = item.packageName
  234. }
  235. })
  236. this.$refs.look.open(res.data)
  237. })
  238. })
  239. },
  240. handelTrain(item) {
  241. let date = new Date();
  242. let year = date.getFullYear();
  243. let month = date.getMonth() + 1;
  244. let day = date.getDate();
  245. month = (month > 9) ? month : ('0' + month);
  246. day = (day < 10) ? ('0' + day) : day;
  247. let today = year + '-' + month + '-' + day;
  248. const oktrain = []
  249. const notrain = []
  250. queryMonthRecord({ time: year + '-' + month, id: item.id }).then(res => {
  251. // for (const key in res.data[0]) {
  252. // if(res.data[0][key]=='1'){
  253. // oktrain.push(key)
  254. // }else if( res.data[0][key]== '2'){
  255. // notrain.push(key)
  256. // }
  257. // }
  258. res.data.map((item) => {
  259. if (item.status == '1') {
  260. oktrain.push(item.time)
  261. } else if (item.status == '2') {
  262. notrain.push(item.time)
  263. }
  264. })
  265. this.$refs.train.open({ oktrain, notrain, id: item.id, today })
  266. })
  267. },
  268. // 测评报告
  269. handelCePingInfo(row) {
  270. let item = JSON.parse(JSON.stringify(row))
  271. this.$refs.cepingInfo.open(item)
  272. }
  273. }
  274. };
  275. </script>