index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view class="main">
  3. <view class="top">
  4. <view class="nameBox">
  5. <view class="name">{{param.patientName}}</view>
  6. <text class="icon arrow" style="margin-left: 10px;">&#xeb73;</text>
  7. <view class="change" @click="showChange = true">切换就诊人</view>
  8. </view>
  9. <view class="cardNum">{{param.patientId}}</view>
  10. <view style="display: flex;text-align: center;margin: 5px;padding: 13px;font-size: 13px;"
  11. @click="calendar = true">
  12. <input placeholder="点击选择时间" :disabled="true" v-model="startTime" type="select" />
  13. <view>至</view>
  14. <input placeholder="点击选择时间" :disabled="true" v-model="endTime" type="select" />
  15. </view>
  16. </view>
  17. <view class="tab">
  18. <u-tabs :list="tab" :current="current" keyName="label" @click="click"></u-tabs>
  19. </view>
  20. <view class="content">
  21. <view class="list">
  22. <view class="item" v-for="(item, index) in list" @click="go(`/pages/visit/detail?id=${item.id}&patientName=${param.patientName}&patientId=${param.patientId}`)">
  23. <view class="title omit">{{ item.department }}</view>
  24. <view class="time">{{ item.admissionTime }}</view>
  25. </view>
  26. </view>
  27. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  28. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  29. </view>
  30. <u-calendar :show="calendar" monthNum="120" mode="range" :maxDate="util.getDate()" minDate="2020-01-01"
  31. @confirm="confirm" @close="close()" :closeOnClickOverlay="true"></u-calendar>
  32. <u-popup :show="showChange" @close="closePopup" @open="openPopup" :round="10" :closeable="true">
  33. <view>
  34. <view class="userChangeTitle">请选择就诊人</view>
  35. <scroll-view scroll-y="true" class="scroll-Y" style="height: 300px;">
  36. <u-radio-group v-model="param.patientId" iconPlacement="left" placement="column">
  37. <u-radio v-for="(item,index) in userList" :name="item.patientId" @change="groupChange(item)"
  38. :customStyle="{ backgroundColor: '#F8F8F8', margin:'5px 20px',borderRadius: '10px',padding: '10px'}">
  39. <view class="userChangeItem" @click="groupChange(item)">
  40. <view class="userChangeItemName">{{ item.patientName }}</view>
  41. <view class="userChangeCartNo">{{ item.patientId }}</view>
  42. </view>
  43. </u-radio>
  44. </u-radio-group>
  45. </scroll-view>
  46. </view>
  47. </u-popup>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. userList: [],
  55. showChange: false,
  56. current: 0,
  57. time: null,
  58. tab: [{
  59. label: '就诊记录'
  60. }, ],
  61. startTime: null,
  62. endTime: null,
  63. list: [],
  64. param: {
  65. // pageNum: 1,
  66. // pageSize: 10,
  67. patientId:null,
  68. patientName:null,
  69. },
  70. loadMore: true,
  71. calendar: false,
  72. user:{},
  73. }
  74. },
  75. onLoad() {
  76. this.setDefTime()
  77. this.getUserList();
  78. this.getUserInfo()
  79. },
  80. methods: {
  81. getUserInfo() {
  82. this.http.request({
  83. url: '/app/user/info',
  84. success: (res) => {
  85. this.user = res.data.data;
  86. this.param.patientId = res.data.data.patientId
  87. this.param.patientName = res.data.data.patientName
  88. this.getData();
  89. }
  90. });
  91. },
  92. groupChange(n) {
  93. uni.showModal({
  94. title: '提示',
  95. content: '确定切换就诊人',
  96. success: (res) => {
  97. if (res.confirm) {
  98. this.http.request({
  99. url: '/app/user/bind/change/' + n.id,
  100. success: (res) => {
  101. this.param.patientName = n.patientName
  102. this.param.patientId = n.patientId
  103. this.closePopup()
  104. this.refresh()
  105. }
  106. });
  107. }
  108. }
  109. });
  110. },
  111. getUserList() {
  112. this.http.request({
  113. url: '/app/user/bind/list',
  114. success: (res) => {
  115. this.userList = res.data.data
  116. }
  117. });
  118. },
  119. openPopup() {
  120. },
  121. closePopup() {
  122. this.showChange = false
  123. },
  124. setDefTime() {
  125. const today = new Date();
  126. const todayYear = today.getFullYear()
  127. const todayMonth = (today.getMonth() + 1) < 10 ? "0" + (today.getMonth() + 1) : (today.getMonth() + 1)
  128. const todayDay = today.getDate() < 10 ? "0" + today.getDate() : today.getDate()
  129. this.param.endTime = todayYear + todayMonth + todayDay
  130. this.endTime = todayYear + '-' + todayMonth + '-' + todayDay
  131. let beforeTime = new Date(today.getTime() - 24 * 60 * 60 * 1000 * 30);
  132. //一个月前
  133. let beforeTimeYear = beforeTime.getFullYear();
  134. let beforeTimeMonth = beforeTime.getMonth() + 1;
  135. let beforeTimeDay = beforeTime.getDate();
  136. beforeTimeMonth = beforeTimeMonth < 10 ? "0" + beforeTimeMonth : beforeTimeMonth;
  137. beforeTimeDay = beforeTimeDay < 10 ? "0" + beforeTimeDay : beforeTimeDay;
  138. this.param.startTime = beforeTimeYear + beforeTimeMonth + beforeTimeDay
  139. this.startTime = beforeTimeYear + "-" + beforeTimeMonth + "-" + beforeTimeDay
  140. },
  141. confirm(e) {
  142. this.calendar = false;
  143. this.param.startTime = e[0].replace(/-/g, '');;
  144. this.param.endTime = e[e.length - 1].replace(/-/g, '');;
  145. this.startTime = e[0]
  146. this.endTime = e[e.length - 1]
  147. this.refresh();
  148. },
  149. close() {
  150. this.calendar = false;
  151. },
  152. getData() {
  153. console.log(this.param.patientId);
  154. this.http.request({
  155. url: '/app/visit/' + this.param.patientId,
  156. data:this.param,
  157. success: (res) => {
  158. this.list = res.data.data
  159. this.loadMore = false
  160. //暂时没有分页
  161. // this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  162. // this.list.push(...res.data.rows);
  163. }
  164. });
  165. },
  166. click(e) {
  167. this.current = e.index;
  168. this.param.type = e.dictValue;
  169. this.refresh();
  170. },
  171. selectTime(e) {
  172. console.log(e);
  173. },
  174. go(url) {
  175. uni.navigateTo({
  176. url: url
  177. });
  178. },
  179. //刷新数据
  180. refresh() {
  181. this.loadMore = true;
  182. this.param.pageNum = 1;
  183. this.list = [];
  184. this.getData();
  185. }
  186. }
  187. }
  188. </script>
  189. <style lang="scss">
  190. .top {
  191. padding: 15px;
  192. background-color: white;
  193. border-radius: 8px;
  194. .nameBox {
  195. display: flex;
  196. align-items: center;
  197. .name {
  198. font-weight: bold;
  199. font-size: 16px;
  200. }
  201. .change {
  202. color: royalblue;
  203. margin-left: 20px;
  204. }
  205. }
  206. .cardNum {
  207. padding-top: 10px;
  208. font-size: 14px;
  209. }
  210. }
  211. .content {
  212. padding: 15px;
  213. background-color: white;
  214. border-radius: 8px;
  215. .list {
  216. .item {
  217. overflow: hidden;
  218. padding: 13px 0;
  219. border-bottom: 1px solid $line;
  220. margin-bottom: 10px;
  221. .title {
  222. font-size: 18px;
  223. font-weight: bold;
  224. }
  225. .time {
  226. font-size: 14px;
  227. padding-top: 15px;
  228. color: $font-c;
  229. }
  230. }
  231. }
  232. }
  233. .userChangeTitle {
  234. display: flex;
  235. justify-content: center;
  236. align-items: center;
  237. height: 48px;
  238. font-weight: bold;
  239. }
  240. .userChangeItem {
  241. width: 100%;
  242. .userChangeItemName {
  243. padding: 5px 10px;
  244. }
  245. .userChangeCartNo {
  246. padding: 5px 10px;
  247. }
  248. }
  249. </style>