order2.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <!-- <el-form-item label="公司名称" prop="companyId" >-->
  5. <!-- <el-select v-model="queryParams.companyId" placeholder="请选择所属公司" filterable size="small">-->
  6. <!-- <el-option v-for="(option, index) in companyList" :key="index" :value="option.dictValue" :label="option.dictLabel"></el-option>-->
  7. <!-- </el-select>-->
  8. <!-- </el-form-item>-->
  9. <el-form-item label="处方类型" prop="prescribeType">
  10. <el-select v-model="queryParams.prescribeType" placeholder="处方类型" clearable size="small">
  11. <el-option
  12. v-for="dict in prescribeType"
  13. :key="dict.dictValue"
  14. :label="dict.dictLabel"
  15. :value="dict.dictValue"
  16. />
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item label="患者名称" prop="patientName">
  20. <el-input
  21. v-model="queryParams.patientName"
  22. placeholder="请输入患者名称"
  23. clearable
  24. size="small"
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item>
  28. <el-form-item label="医生姓名" prop="doctorName">
  29. <el-input
  30. v-model="queryParams.doctorName"
  31. placeholder="请输入医生姓名"
  32. clearable
  33. size="small"
  34. @keyup.enter.native="handleQuery"
  35. />
  36. </el-form-item>
  37. <el-form-item label="药品订单编号" prop="orderCode">
  38. <el-input
  39. v-model="queryParams.orderCode"
  40. placeholder="请输入药品订单单号"
  41. clearable
  42. size="small"
  43. @keyup.enter.native="handleQuery"
  44. />
  45. </el-form-item>
  46. <el-form-item label="处方单编号" prop="prescribeCode">
  47. <el-input
  48. v-model="queryParams.prescribeCode"
  49. placeholder="请输入处方单编号"
  50. clearable
  51. size="small"
  52. @keyup.enter.native="handleQuery"
  53. />
  54. </el-form-item>
  55. <el-form-item label="患者电话" prop="patientTel">
  56. <el-input
  57. v-model="queryParams.patientTel"
  58. placeholder="请输入患者电话"
  59. clearable
  60. size="small"
  61. @keyup.enter.native="handleQuery"
  62. />
  63. </el-form-item>
  64. <el-form-item label="药品订单状态" prop="orderStatus">
  65. <el-select v-model="queryParams.orderStatus" placeholder="药品订单状态" clearable size="small">
  66. <el-option
  67. v-for="dict in orderStatusOptions"
  68. :key="dict.dictValue"
  69. :label="dict.dictLabel"
  70. :value="dict.dictValue"
  71. />
  72. </el-select>
  73. </el-form-item>
  74. <el-form-item label="创建时间" prop="createTime">
  75. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  76. </el-form-item>
  77. <el-form-item label="审核时间" prop="auditTime">
  78. <el-date-picker v-model="auditTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  79. </el-form-item>
  80. <!-- 开方耗时区间筛选 -->
  81. <el-form-item label="开方耗时" prop="operateTimeRange">
  82. <el-input-number
  83. v-model="operateTime.minVal"
  84. :min="0"
  85. size="small"
  86. placeholder="最小值"
  87. style="width: 100px"
  88. />
  89. <el-select v-model="operateTime.minUnit" size="small" style="width: 70px; margin: 0 8px">
  90. <el-option label="秒" value="sec" />
  91. <el-option label="分" value="min" />
  92. </el-select>
  93. ~
  94. <el-input-number
  95. v-model="operateTime.maxVal"
  96. :min="0"
  97. size="small"
  98. placeholder="最大值"
  99. style="width: 100px; margin-left: 8px"
  100. />
  101. <el-select v-model="operateTime.maxUnit" size="small" style="width: 70px; margin: 0 8px">
  102. <el-option label="秒" value="sec" />
  103. <el-option label="分" value="min" />
  104. </el-select>
  105. </el-form-item>
  106. <el-form-item>
  107. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  108. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  109. </el-form-item>
  110. </el-form>
  111. <el-row :gutter="10" class="mb8">
  112. <el-col :span="1.5">
  113. <el-button
  114. type="warning"
  115. plain
  116. icon="el-icon-download"
  117. size="mini"
  118. :loading="exportLoading"
  119. @click="handleExport"
  120. v-hasPermi="['his:prescribe:export']"
  121. >导出</el-button>
  122. </el-col>
  123. <el-col :span="1.5">
  124. <el-button
  125. type="warning"
  126. plain
  127. icon="el-icon-download"
  128. size="small"
  129. :loading="exportLoading"
  130. @click="handleExportMessageFeedback"
  131. v-hasPermi="['his:prescribe:messageFeedbackExport']"
  132. >医疗信息反馈单</el-button>
  133. </el-col>
  134. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  135. </el-row>
  136. <el-tabs type="card" v-model="actName" @tab-click="handleClickX">
  137. <el-tab-pane label="全部订单" name="10"></el-tab-pane>
  138. <el-tab-pane v-for="(item,index) in prescribeStatusOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  139. </el-tabs>
  140. <el-table heiget="600" v-loading="loading" border :data="prescribeList" @selection-change="handleSelectionChange">
  141. <el-table-column type="selection" width="55" align="center" />
  142. <el-table-column label="处方单编号" align="center" prop="prescribeCode" width="180px" />
  143. <el-table-column label="药品订单编号" align="center" prop="orderCode" width="180px" />
  144. <el-table-column label="处方类型" align="center" prop="prescribeType" >
  145. <template slot-scope="scope">
  146. <dict-tag :options="prescribeType" :value="scope.row.prescribeType"/>
  147. </template>
  148. </el-table-column>
  149. <el-table-column label="患者年龄" align="center" prop="patientAge" />
  150. <el-table-column label="患者姓名" align="center" prop="patientName" />
  151. <el-table-column label="诊断" align="center" prop="diagnose" />
  152. <el-table-column label="医生名称" align="center" prop="doctorName" />
  153. <el-table-column label="药师名称" align="center" prop="doctorDrugName" />
  154. <el-table-column label="状态" align="center" prop="status" >
  155. <template slot-scope="scope">
  156. <dict-tag :options="prescribeStatusOptions" :value="scope.row.status"/>
  157. </template>
  158. </el-table-column>
  159. <el-table-column label="药品订单状态" align="center" prop="orderStatus" >
  160. <template slot-scope="scope">
  161. <dict-tag :options="orderStatusOptions" :value="scope.row.orderStatus"/>
  162. </template>
  163. </el-table-column>
  164. <el-table-column label="审核时间" align="center" prop="auditTime" width="180" />
  165. <el-table-column
  166. prop="operate_second"
  167. label="操作时长"
  168. min-width="140"
  169. >
  170. <template slot-scope="{ row }">
  171. {{ formatSeconds(row.operateSecond) }}
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
  175. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="100px">
  176. <template slot-scope="scope">
  177. <el-button
  178. size="mini"
  179. type="text"
  180. @click="handledetails(scope.row)"
  181. >查看
  182. </el-button>
  183. </template>
  184. </el-table-column>
  185. </el-table>
  186. <pagination
  187. v-show="total>0"
  188. :total="total"
  189. :page.sync="queryParams.pageNum"
  190. :limit.sync="queryParams.pageSize"
  191. @pagination="getList"
  192. />
  193. <el-drawer
  194. :with-header="false"
  195. size="75%"
  196. :title="show.title" :visible.sync="show.open">
  197. <prescribeDetails ref="Details" />
  198. </el-drawer>
  199. </div>
  200. </template>
  201. <script>
  202. import { listPrescribe, getPrescribe, delPrescribe, addPrescribe, updatePrescribe, exportPrescribe,exportMessageFeedback } from "@/api/his/prescribe";
  203. import prescribeDetails from '../../components/his/prescribeDetails.vue';
  204. import {allList}from "@/api/company/company";
  205. import { getTask } from "@/api/common";
  206. import {list as getAppMallOptions} from '@/api/course/coursePlaySourceConfig';
  207. export default {
  208. name: "Prescribe",
  209. components: { prescribeDetails },
  210. data() {
  211. return {
  212. operateTime: {
  213. minVal: null,
  214. minUnit: 'sec', // 默认单位:秒
  215. maxVal: null,
  216. maxUnit: 'sec'
  217. },
  218. dateRange: null,
  219. companyList:[],
  220. createTime:null,
  221. pjtUrl: process.env.VUE_APP_BASE_API+"/",
  222. show:{
  223. title:"订单详情",
  224. open:false,
  225. },
  226. // 遮罩层
  227. loading: true,
  228. // 导出遮罩层
  229. exportLoading: false,
  230. // 选中数组
  231. ids: [],
  232. auditTime:null,
  233. // 非单个禁用
  234. single: true,
  235. // 非多个禁用
  236. multiple: true,
  237. // 显示搜索条件
  238. showSearch: true,
  239. // 总条数
  240. total: 0,
  241. // 处方表格数据
  242. prescribeList: [],
  243. orderStatusOptions:[],
  244. // 弹出层标题
  245. title: "",
  246. // 是否显示弹出层
  247. open: false,
  248. // 查询参数
  249. queryParams: {
  250. pageNum: 1,
  251. pageSize: 10,
  252. prescribeType: null,
  253. inquiryOrderId: null,
  254. storeOrderId: null,
  255. userId: null,
  256. patientId: null,
  257. prescribeCode: null,
  258. patientDescs: null,
  259. nowIllness: null,
  260. historyIllness: null,
  261. patientAge: null,
  262. patientName: null,
  263. weight: null,
  264. sTime:null,
  265. eTime:null,
  266. isHistoryAllergic: null,
  267. historyAllergic: null,
  268. liverUnusual: null,
  269. renalUnusual: null,
  270. isLactation: null,
  271. patientTel: null,
  272. patientGender: null,
  273. recordPic: null,
  274. prescribeImgUrl: null,
  275. auditReason: null,
  276. diagnose: null,
  277. doctorId: null,
  278. status: null,
  279. auditTime: null,
  280. auditSTime:null,
  281. auditETime:null,
  282. doctorName:null,
  283. orderStatus:null,
  284. appId:null,
  285. minOperateSeconds: null,
  286. maxOperateSeconds: null,
  287. },
  288. actName:"10",
  289. // 表单参数
  290. form: {},
  291. // 表单校验
  292. rules: {
  293. },
  294. prescribeStatusOptions:[],
  295. prescribeType:[],
  296. orOptions:[],
  297. sexOptions:[],
  298. appMallOptions:[],
  299. };
  300. },
  301. created() {
  302. this.getAllCompany();
  303. this.getDicts("sys_prescribe_status").then(response => {
  304. this.prescribeStatusOptions = response.data;
  305. });
  306. this.getDicts("sys_prescribe_type").then(response => {
  307. this.prescribeType = response.data;
  308. });
  309. this.getDicts("sys_sex").then(response => {
  310. this.sexOptions = response.data;
  311. });
  312. this.getDicts("sys_company_or").then(response => {
  313. this.orOptions = response.data;
  314. });
  315. this.getDicts("sys_order_status").then(response => {
  316. this.orderStatusOptions = response.data;
  317. });
  318. this.getAppMallOptions();
  319. this.getList();
  320. },
  321. methods: {
  322. getAppMallOptions() {
  323. getAppMallOptions({pageNum:1,pageSize:100,isMall:1}).then(response => {
  324. this.appMallOptions = response.rows;
  325. })
  326. },
  327. getAllCompany() {
  328. allList().then(response => {
  329. this.companyList = response.rows;
  330. });
  331. },
  332. handleClickX(tab, event) {
  333. if(tab.name=="10"){
  334. this.queryParams.status=null;
  335. }else{
  336. this.queryParams.status=tab.name;
  337. }
  338. this.handleQuery();
  339. },
  340. handledetails(row){
  341. this.show.open=true;
  342. setTimeout(() => {
  343. this.$refs.Details.getDetails(row.prescribeId);
  344. }, 1);
  345. },
  346. /** 查询处方列表 */
  347. getList() {
  348. this.loading = true;
  349. // 构造请求参数(避免直接修改 queryParams)
  350. const params = { ...this.queryParams };
  351. // 处理开方时间
  352. if (this.dateRange?.length === 2) {
  353. params.startOperateTime = this.dateRange[0];
  354. params.endOperateTime = this.dateRange[1];
  355. } else {
  356. delete params.startOperateTime;
  357. delete params.endOperateTime;
  358. }
  359. listPrescribe(params).then(response => {
  360. this.prescribeList = response.rows;
  361. this.total = response.total;
  362. this.loading = false;
  363. });
  364. },
  365. // 取消按钮
  366. cancel() {
  367. this.open = false;
  368. this.reset();
  369. },
  370. change(){
  371. if(this.createTime!=null){
  372. this.queryParams.sTime=this.createTime[0];
  373. this.queryParams.eTime=this.createTime[1];
  374. }else{
  375. this.queryParams.sTime=null;
  376. this.queryParams.eTime=null;
  377. }
  378. if(this.auditTime!=null){
  379. this.queryParams.auditSTime=this.auditTime[0];
  380. this.queryParams.auditETime=this.auditTime[1];
  381. }else{
  382. this.queryParams.auditSTime=null;
  383. this.queryParams.auditETime=null;
  384. }
  385. },
  386. // 表单重置
  387. reset() {
  388. this.form = {
  389. prescribeId: null,
  390. prescribeType: null,
  391. inquiryOrderId: null,
  392. storeOrderId: null,
  393. userId: null,
  394. patientId: null,
  395. prescribeCode: null,
  396. patientDescs: null,
  397. nowIllness: null,
  398. historyIllness: null,
  399. patientAge: null,
  400. patientName: null,
  401. weight: null,
  402. isHistoryAllergic: null,
  403. historyAllergic: null,
  404. liverUnusual: null,
  405. renalUnusual: null,
  406. isLactation: null,
  407. patientTel: null,
  408. patientGender: null,
  409. recordPic: null,
  410. prescribeImgUrl: null,
  411. auditReason: null,
  412. diagnose: null,
  413. doctorId: null,
  414. createTime: null,
  415. status: 0,
  416. auditTime: null
  417. };
  418. this.resetForm("form");
  419. },
  420. /** 搜索按钮操作 */
  421. handleQuery() {
  422. this.queryParams.pageNum = 1;
  423. const toSeconds = (val, unit) => {
  424. if (val == null || val === '') return null;
  425. return unit === 'min' ? val * 60 : val;
  426. };
  427. const minSec = toSeconds(this.operateTime.minVal, this.operateTime.minUnit);
  428. const maxSec = toSeconds(this.operateTime.maxVal, this.operateTime.maxUnit);
  429. //核心校验:如果两个值都存在,max 不能小于 min
  430. if (minSec != null && maxSec != null && minSec > maxSec) {
  431. this.$message.warning('开方耗时:最大值不能小于最小值!');
  432. return; // 阻止查询
  433. }
  434. this.queryParams.minOperateSeconds = toSeconds(this.operateTime.minVal, this.operateTime.minUnit);
  435. this.queryParams.maxOperateSeconds = toSeconds(this.operateTime.maxVal, this.operateTime.maxUnit);
  436. this.getList();
  437. },
  438. /** 重置按钮操作 */
  439. resetQuery() {
  440. this.resetForm("queryForm");
  441. this.createTime=null;
  442. this.queryParams.sTime=null;
  443. this.queryParams.eTime=null;
  444. this.auditTime=null;
  445. this.dateRange = null;
  446. this.queryParams.auditSTime=null;
  447. this.queryParams.auditETime=null;
  448. this.operateTime = {
  449. minVal: null,
  450. minUnit: 'sec',
  451. maxVal: null,
  452. maxUnit: 'sec'
  453. };
  454. this.handleQuery();
  455. },
  456. // 多选框选中数据
  457. handleSelectionChange(selection) {
  458. this.ids = selection.map(item => item.prescribeId)
  459. this.single = selection.length!==1
  460. this.multiple = !selection.length
  461. },
  462. /** 新增按钮操作 */
  463. handleAdd() {
  464. this.reset();
  465. this.open = true;
  466. this.title = "添加处方";
  467. },
  468. /** 修改按钮操作 */
  469. handleUpdate(row) {
  470. this.reset();
  471. const prescribeId = row.prescribeId || this.ids
  472. getPrescribe(prescribeId).then(response => {
  473. this.form = response.data;
  474. this.open = true;
  475. this.title = "修改处方";
  476. });
  477. },
  478. /** 提交按钮 */
  479. submitForm() {
  480. this.$refs["form"].validate(valid => {
  481. if (valid) {
  482. if (this.form.prescribeId != null) {
  483. updatePrescribe(this.form).then(response => {
  484. this.msgSuccess("修改成功");
  485. this.open = false;
  486. this.getList();
  487. });
  488. } else {
  489. addPrescribe(this.form).then(response => {
  490. this.msgSuccess("新增成功");
  491. this.open = false;
  492. this.getList();
  493. });
  494. }
  495. }
  496. });
  497. },
  498. /** 删除按钮操作 */
  499. handleDelete(row) {
  500. const prescribeIds = row.prescribeId || this.ids;
  501. this.$confirm('是否确认删除处方编号为"' + prescribeIds + '"的数据项?', "警告", {
  502. confirmButtonText: "确定",
  503. cancelButtonText: "取消",
  504. type: "warning"
  505. }).then(function() {
  506. return delPrescribe(prescribeIds);
  507. }).then(() => {
  508. this.getList();
  509. this.msgSuccess("删除成功");
  510. }).catch(() => {});
  511. },
  512. /** 导出按钮操作 */
  513. handleExport() {
  514. var that=this;
  515. const queryParams = this.queryParams;
  516. this.$confirm('是否确认导出所有处方数据项?', "警告", {
  517. confirmButtonText: "确定",
  518. cancelButtonText: "取消",
  519. type: "warning"
  520. }).then(() => {
  521. this.exportLoading = true;
  522. return exportPrescribe(queryParams);
  523. }).then(response => {
  524. if(response.code==200){
  525. that.msgSuccess(response.msg);
  526. that.taskId=response.data;
  527. that.time=setInterval(function(){
  528. //查订单
  529. getTask(that.taskId).then(res => {
  530. if(res.data.status==1){
  531. that.exportLoading = false;
  532. clearTimeout(that.time)
  533. that.time=null;
  534. that.download(res.data.fileUrl);
  535. }
  536. });
  537. },10000);
  538. }
  539. }).catch(() => {});
  540. },
  541. /** 导出按钮操作 */
  542. handleExportMessageFeedback() {
  543. var that=this;
  544. const queryParams = this.queryParams;
  545. this.$confirm('是否确认导出所有医疗信息反馈单数据项?', "警告", {
  546. confirmButtonText: "确定",
  547. cancelButtonText: "取消",
  548. type: "warning"
  549. }).then(() => {
  550. this.exportLoading = true;
  551. return exportMessageFeedback(queryParams);
  552. }).then(response => {
  553. if(response.code==200){
  554. that.msgSuccess(response.msg);
  555. that.taskId=response.data;
  556. that.time=setInterval(function(){
  557. //查订单
  558. getTask(that.taskId).then(res => {
  559. if(res.data.status==1){
  560. that.exportLoading = false;
  561. clearTimeout(that.time)
  562. that.time=null;
  563. that.download(res.data.fileUrl);
  564. }
  565. });
  566. },10000);
  567. }
  568. }).catch(() => {});
  569. },
  570. // 表格排序变化(点击表头排序)
  571. handleSortChange({ prop, order }) {
  572. if (order === 'ascending') {
  573. this.queryParams.sortField = prop;
  574. this.queryParams.sortOrder = 'asc';
  575. } else if (order === 'descending') {
  576. this.queryParams.sortField = prop;
  577. this.queryParams.sortOrder = 'desc';
  578. } else {
  579. // 取消排序
  580. delete this.queryParams.sortField;
  581. delete this.queryParams.sortOrder;
  582. }
  583. this.handleQuery(); // 重新查询
  584. },
  585. // 秒数转“X分Y秒”
  586. formatSeconds(seconds) {
  587. if (seconds == null || seconds === '') return '0秒'
  588. const sec = Math.floor(Number(seconds))
  589. const min = Math.floor(sec / 60)
  590. const remainingSec = sec % 60
  591. if (min > 0) {
  592. return `${min}分${remainingSec}秒`
  593. }
  594. return `${remainingSec}秒`
  595. }
  596. }
  597. };
  598. </script>