index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="doctor-index-content">
  3. <view class="tab">
  4. <view class="item" @click="changeTab(1)" :class="tabIndex===1?'active':''">
  5. <text>待诊断</text>
  6. </view>
  7. <view class="item" @click="changeTab(2)" :class="tabIndex===2?'active':''">
  8. <text>已诊断</text>
  9. </view>
  10. </view>
  11. <view class="search">
  12. <view class="inp">
  13. <text class="zhcx-iconfont zhcx-icon-sousuo"></text>
  14. <input type="text" v-model="keyword" placeholder="请输入关键字"/>
  15. </view>
  16. <view class="searchBt">
  17. <button type="primary" @click="search">搜索</button>
  18. </view>
  19. <view class="filterBt" @click="filterHandle">
  20. <text>筛选</text>
  21. <text class="zhcx-iconfont " :class="showMorefilter?'zhcx-icon-xiangshang':'zhcx-icon-xiangxia'"></text>
  22. </view>
  23. </view>
  24. <view class="more-filter" v-if="showMorefilter">
  25. <view class="illnessTypes">
  26. <picker @change="changeIllnessType" :value="illnessTypeIndex" :range="illnessTypes">
  27. <view class="uni-input">{{illnessTypeIndex>-1?illnessTypes[illnessTypeIndex]:"请选择病症类型"}}</view>
  28. </picker>
  29. </view>
  30. </view>
  31. <view class="tab-cont">
  32. <view class="item-container">
  33. <roll-load
  34. :total="total"
  35. :size="pageSize"
  36. @lower="lower"
  37. @upper="upper"
  38. ref="roll-load"
  39. :topBt="topBt"
  40. styles="height:calc(100vh - 200px)">
  41. <template v-slot:cont>
  42. <block></block>
  43. <view class="item" v-for="(item,index) in items"
  44. :key="index" @click="showdetail(item.id)" >
  45. <view class="avatar">
  46. <image src="../../../static/images/order/mine_location.png" mode="widthFix" class="pic"></image>
  47. </view>
  48. <view class="item-info">
  49. <view class="user">
  50. <text class="name">{{item.name}}</text>
  51. <view class="gender" :class="item.gender==='1'?'woman':'man'">
  52. <text>{{item.gender==='1'?'女':"男"}}</text>
  53. </view>
  54. <text class="age">{{item.age}}</text>
  55. </view>
  56. <view class="illnessType">
  57. <text>{{item.illnessType}}</text>
  58. </view>
  59. <view class="time">
  60. <text>就诊时间:</text>
  61. <text>{{item.time}}</text>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <template v-slot:toTop>
  67. <text>顶部</text>
  68. </template>
  69. </roll-load>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import {formatTime} from '@/libs';
  76. import {deepClone} from '@/libs/index.js';
  77. import RollLoad from '@/components/RollLoad/index.vue';
  78. import {diagnosisList,ReceivedOrder} from '@/api/doctor';
  79. import { getIlltype } from '@/api/user.js'
  80. export default{
  81. name:"doctor-index",
  82. components:{
  83. RollLoad
  84. },
  85. data() {
  86. return {
  87. showMorefilter:false,
  88. illnessTypeIndex:-1,
  89. illnessTypes:[],
  90. keyword: '',
  91. tabIndex:1,
  92. items:[],
  93. detailModal:false,
  94. pageSize:10,
  95. pageNumber:1,
  96. total:0,
  97. topBt:{
  98. show:true,
  99. style:'top:80%'
  100. }
  101. }
  102. },
  103. created() {
  104. let accountInfo=uni.getStorageSync('accountInfo');
  105. this.userType=accountInfo.userType;
  106. if(accountInfo.userType===1){
  107. this.init();
  108. }
  109. },
  110. methods:{
  111. init(){
  112. this.getList()
  113. this.setIllnessType();
  114. },
  115. changeTab(index){
  116. this.tabIndex=index;
  117. this.illnessTypeIndex=-1;
  118. this.getList()
  119. },
  120. search(){
  121. this.pageNumber=1;
  122. this.getList();
  123. },
  124. setIllnessType(){
  125. getIlltype().then((result) => {
  126. let illnessTypes=result.data;
  127. illnessTypes=illnessTypes.map((item)=>{
  128. return item.typename
  129. })
  130. illnessTypes.unshift('全部病症类型');
  131. this.illnessTypes = illnessTypes;
  132. })
  133. },
  134. filterHandle(){
  135. this.showMorefilter=!this.showMorefilter;
  136. },
  137. getList(){
  138. let status=(this.tabIndex)-1;
  139. let keyword=this.keyword;
  140. // let startTime=formatTime(this.time[0]);
  141. // let endTime=formatTime(this.time[1]);
  142. let page= this.pageNumber;
  143. let limit=this.pageSize;
  144. let illnessTypeIndex=this.illnessTypeIndex;
  145. let illnessType=this.illnessTypes[illnessTypeIndex];
  146. if(illnessTypeIndex<1){
  147. illnessType="";
  148. }
  149. this.$nextTick(()=>{
  150. this.$refs['roll-load'].init();
  151. })
  152. const maxAge = 60;
  153. const minAge = 20;
  154. var dictionaries={};
  155. diagnosisList({
  156. status,keyword,page,limit,illnessType
  157. }).then((res)=>{
  158. let age="";
  159. let items=res.data.list.map((item)=>{
  160. if(dictionaries.hasOwnProperty(item.patientName)){
  161. age=dictionaries[item.patientName]
  162. }else{
  163. age=dictionaries[item.patientName]=Math.floor(Math.random()*(maxAge-minAge+1)+minAge);
  164. }
  165. return{
  166. id:item.seekId,
  167. name:item.patientName,
  168. time:item.seekTime,
  169. gender:item.patientSex,
  170. illnessType:item.illnessType,
  171. age
  172. }
  173. })
  174. let total=res.data.totalCount;
  175. this.total=total;
  176. this.items=items;
  177. })
  178. },
  179. showdetail(id){
  180. let status=this.tabIndex;
  181. uni.navigateTo({
  182. url:`/views/detail/index?type=diagnose&user=doctor&id=${id}&status=${status}`,
  183. animationType: 'pop-in',
  184. animationDuration: 200
  185. })
  186. },
  187. getItem(){
  188. let status=(this.tabIndex)-1;
  189. let keyword=this.keyword;
  190. let page= this.pageNumber;
  191. let limit=this.pageSize;
  192. return new Promise((resolve,reject)=>{
  193. diagnosisList({
  194. status,keyword,page,limit
  195. }).then((res)=>{
  196. let total=res.data.totalCount;
  197. let items=res.data.list.map((item)=>{
  198. let site=[];
  199. return{
  200. id:item.seekId,
  201. name:item.patientName,
  202. time:item.seekTime,
  203. desc:item.diseaseDesc,
  204. tags:site,
  205. }
  206. })
  207. this.total=total;
  208. resolve(items)
  209. }).catch((err)=>{reject(err);})
  210. })
  211. },
  212. async lower(e){
  213. let items=deepClone(this.items);
  214. if(e.status){
  215. let data=await this.getItem();
  216. this.items=items.concat(data);
  217. }
  218. console.log('滚动到底部------:'+JSON.stringify(e));
  219. },
  220. upper(e){
  221. //console.log('滚动到顶部:-----'+JSON.stringify(e));
  222. },
  223. changeIllnessType({detail}){
  224. this.illnessTypeIndex=detail.value;
  225. this.search();
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="scss" scoped>
  231. @import url('./index.css')
  232. </style>