choosePrescription.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view class="choosePrescription">
  3. <!-- 搜索框 -->
  4. <view class="searchPrescription">
  5. <uni-forms class="search_forms">
  6. <uni-forms-item label="处方编号">
  7. <uni-easyinput v-model="pageData.cfbh" placeholder="请输入处方编号" />
  8. </uni-forms-item>
  9. <uni-forms-item label="患者姓名">
  10. <uni-easyinput v-model="pageData.hzxm" placeholder="请输入患者姓名" />
  11. </uni-forms-item>
  12. </uni-forms>
  13. <view class="search_button_group">
  14. <button class="reset_button" @click="reset">重置</button>
  15. <button class="search_button" @click="search">搜索</button>
  16. </view>
  17. </view>
  18. <!-- 处方列表 -->
  19. <uni-card v-for="(item,index) in pageData.cfInfo" class="cfInfo" @click="chooseCf(item)">
  20. <view class="cfInfo_title">
  21. <view class="cfInfo_text_name">处方编号</view>
  22. <view class="cfInfo_text">{{item.cfbm}}</view>
  23. </view>
  24. <view class="cfInfo_title">
  25. <view class="cfInfo_text_name">患者姓名</view>
  26. <view class="cfInfo_text">{{item.hzxm}}</view>
  27. </view>
  28. <view class="cfInfo_title">
  29. <view class="cfInfo_text_name">医疗机构</view>
  30. <view class="cfInfo_text">{{item.yljgmc}}</view>
  31. </view>
  32. <view class="cfInfo_title">
  33. <view class="cfInfo_text_name">开方日期</view>
  34. <view class="cfInfo_text">{{item.kfrq}}</view>
  35. </view>
  36. <view class="cfInfo_title">
  37. <view class="cfInfo_text_name">贴数</view>
  38. <view class="cfInfo_text">{{item.ts}}</view>
  39. </view>
  40. <view class="cfInfo_title">
  41. <view class="cfInfo_text_name">处方内容</view>
  42. <view class="cfInfo_text">{{item.cfnr}}</view>
  43. </view>
  44. </uni-card>
  45. <!-- 对话框 -->
  46. <uni-popup ref="chooseDialog" type="dialog">
  47. <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" title="选择处方" :content="pageData.popupMessage.showMessage" @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
  48. </uni-popup>
  49. <view v-if="pageData.cfInfo.length!=0">
  50. <uni-load-more :status="loadingData.status" :contentText="loadingData.contentText"></uni-load-more>
  51. </view>
  52. </view>
  53. </template>
  54. <script setup>
  55. import { reactive,ref } from "vue";
  56. import {onLoad,onShow,onUnload,onPullDownRefresh,onReachBottom} from "@dcloudio/uni-app";
  57. import http from '@/utils/request';
  58. const pageData=reactive({
  59. // 处方编号
  60. cfbh:'',
  61. // 平台唯一编号
  62. ptwybh:'',
  63. // 患者姓名
  64. hzxm:'',
  65. // 处方信息列表
  66. cfInfo:[],
  67. // 处方状态
  68. cfStatus:'',
  69. // 发药方式类型
  70. fyfslx:'',
  71. chooseDialog:'',
  72. // 弹出框内容
  73. popupMessage:{
  74. showMessage:''
  75. }
  76. })
  77. const formData=reactive({
  78. cfbm:'',
  79. hzxm:'',
  80. cflx:[],
  81. pageNum:1,
  82. pageSize:10
  83. })
  84. const loadingData = reactive({
  85. // 加载true,到底false
  86. reload: false,
  87. status: 'more',
  88. contentText: {
  89. contentdown: '上拉加载更多',
  90. contentrefresh: '加载中',
  91. contentnomore: '已经全部加载完毕'
  92. }
  93. })
  94. // 定义弹出框
  95. const chooseDialog = ref()
  96. // 弹出框确定事件
  97. const dialogConfirm=()=>{
  98. let url=''
  99. // 跳转到下一个页面
  100. if(pageData.fyfslx=='2' || pageData.fyfslx=='3'){
  101. url='/pages/ypczk/zkTask/djTask?cfbh='+pageData.cfbh+'&fyfslx='+pageData.fyfslx+'&ptwybh='+pageData.cfbh+'&state=add'
  102. }else if(pageData.fyfslx=='4' || pageData.fyfslx=='5'){
  103. url='/pages/ypczk/zkTask/dpTask?cfbh='+pageData.cfbh+'&fyfslx='+pageData.fyfslx+'&ptwybh='+pageData.cfbh+'&state=add'
  104. }
  105. uni.navigateTo({
  106. url:url,
  107. })
  108. }
  109. // 弹出框取消事件
  110. const dialogClose=()=>{
  111. chooseDialog._value.close()
  112. }
  113. // 重置
  114. const reset=()=>{
  115. pageData.cfbh=''
  116. pageData.hzxm=''
  117. }
  118. // 搜索
  119. const search=()=>{
  120. formData.cfbm=pageData.cfbh
  121. formData.hzxm=pageData.hzxm
  122. getCfData()
  123. }
  124. // 选择处方
  125. const chooseCf=(e)=>{
  126. // 点击处方,弹出对话框
  127. chooseDialog._value.open()
  128. pageData.popupMessage.showMessage="处方编号:"+e.cfbm+"\n"+"患者姓名:"+e.hzxm+"\n"+"是否确认选择该处方?"
  129. pageData.cfbh=e.cfbm
  130. pageData.fyfslx=e.cflx[0]
  131. pageData.ptwybh=e.ptwybh
  132. }
  133. // 获取处方信息
  134. const getCfData=()=>{
  135. let fyfslxList=[]
  136. if(pageData.cfStatus=='dj'){
  137. fyfslxList=[2,3]
  138. }else{
  139. fyfslxList=[4,5]
  140. }
  141. formData.cflx=fyfslxList
  142. pageData.cfInfo=[]
  143. http.get("app-api/cf/findList",formData).then(res=>{
  144. console.log(res)
  145. pageData.cfInfo=pageData.cfInfo.concat(res.data)
  146. if (formData.pageSize > res.data.length) {
  147. loadingData.reload = false
  148. loadingData.status = 'noMore'
  149. uni.stopPullDownRefresh();
  150. } else {
  151. loadingData.status = 'more'
  152. loadingData.reload = true
  153. }
  154. })
  155. setTimeout(()=>{
  156. uni.stopPullDownRefresh();
  157. },1000)
  158. }
  159. // 上拉加载
  160. onReachBottom(()=>{
  161. if (loadingData.reload) {
  162. formData.pageNum++;
  163. loadingData.status = 'loading'
  164. getCfData();
  165. }
  166. })
  167. // 下拉刷新
  168. onPullDownRefresh(()=>{
  169. formData.pageNum = 1;
  170. loadingData.reload = true
  171. pageData.cfInfo = []
  172. getCfData();
  173. })
  174. onShow(()=>{
  175. pageData.cfbh=""
  176. getCfData()
  177. })
  178. onLoad((type)=>{
  179. if(type.taskStatus!=null){
  180. pageData.cfStatus=type.taskStatus
  181. }
  182. })
  183. </script>
  184. <style lang="scss" scoped>
  185. @import './index.scss'
  186. </style>