choosePrescription.vue 5.5 KB

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