choosePrescription.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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. let url=''
  109. // 跳转到下一个页面
  110. if(pageData.fyfslx=='2' || pageData.fyfslx=='3'){
  111. url='/pages/ypczk/zkTask/djTask?cfbh='+pageData.cfbh+'&fyfslx='+pageData.fyfslx+'&ptwybh='+pageData.cfbh+'&state=add'
  112. }else if(pageData.fyfslx=='4' || pageData.fyfslx=='5'){
  113. url='/pages/ypczk/zkTask/dpTask?cfbh='+pageData.cfbh+'&fyfslx='+pageData.fyfslx+'&ptwybh='+pageData.cfbh+'&state=add'
  114. }
  115. uni.navigateTo({
  116. url:url,
  117. })
  118. }
  119. // 弹出框取消事件
  120. const dialogClose=()=>{
  121. chooseDialog._value.close()
  122. }
  123. // 重置
  124. const reset=()=>{
  125. pageData.cfbh=''
  126. pageData.hzxm=''
  127. pageData.djdsh=''
  128. }
  129. // 搜索
  130. const search=()=>{
  131. formData.cfbm=pageData.cfbh
  132. formData.hzxm=pageData.hzxm
  133. formData.djdsh=pageData.djdsh
  134. formData.pageNum=1
  135. pageData.cfInfo=[]
  136. getCfData()
  137. }
  138. // 选择处方
  139. const chooseCf=(e)=>{
  140. // 点击处方,弹出对话框
  141. chooseDialog._value.open()
  142. pageData.popupMessage.showMessage="处方编号:"+e.cfbm+"\n"+"患者姓名:"+e.hzxm+"\n"+"是否确认选择该处方?"
  143. pageData.cfbh=e.cfbm
  144. pageData.fyfslx=e.cflx[0]
  145. pageData.ptwybh=e.ptwybh
  146. }
  147. // 获取处方信息
  148. const getCfData=()=>{
  149. let fyfslxList=[]
  150. if(pageData.cfStatus=='dj'){
  151. fyfslxList=[2,3]
  152. }else{
  153. fyfslxList=[4,5]
  154. }
  155. formData.cflx=fyfslxList
  156. // pageData.cfInfo=[]
  157. http.get("app-api/cf/findList",formData).then(res=>{
  158. pageData.cfInfo=pageData.cfInfo.concat(res.data)
  159. if (formData.pageSize > res.data.length) {
  160. loadingData.reload = false
  161. loadingData.status = 'noMore'
  162. uni.stopPullDownRefresh();
  163. } else {
  164. loadingData.status = 'more'
  165. loadingData.reload = true
  166. }
  167. })
  168. setTimeout(()=>{
  169. uni.stopPullDownRefresh();
  170. },1000)
  171. }
  172. // 上拉加载
  173. onReachBottom(()=>{
  174. if (loadingData.reload) {
  175. formData.pageNum++;
  176. loadingData.status = 'loading'
  177. getCfData();
  178. }
  179. })
  180. // 下拉刷新
  181. onPullDownRefresh(()=>{
  182. formData.pageNum = 1;
  183. loadingData.reload = true
  184. pageData.cfInfo = []
  185. getCfData();
  186. })
  187. onShow(()=>{
  188. pageData.cfbh=""
  189. getCfData()
  190. })
  191. onLoad((type)=>{
  192. if(type.taskStatus!=null){
  193. pageData.cfStatus=type.taskStatus
  194. }
  195. })
  196. </script>
  197. <style lang="scss" scoped>
  198. @import './index.scss'
  199. </style>