index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view class="content">
  3. <view class="search">
  4. <view class="inp">
  5. <text class="zhcx-iconfont zhcx-icon-sousuo"></text>
  6. <input type="text" v-model="keyword" placeholder="请输入关键字"/>
  7. </view>
  8. <view class="searchBt">
  9. <button type="primary" @click="search">搜索</button>
  10. </view>
  11. <view class="filterBt" @click="filterHandle">
  12. <text>筛选</text>
  13. <text class="zhcx-iconfont " :class="showMorefilter?'zhcx-icon-xiangshang':'zhcx-icon-xiangxia'"></text>
  14. </view>
  15. </view>
  16. <view class="more-filter" v-if="showMorefilter">
  17. <view class="illnessTypes">
  18. <picker @change="changeIllnessType" :value="illnessTypeIndex" :range="illnessTypes">
  19. <view class="uni-input">{{illnessTypeIndex>-1?illnessTypes[illnessTypeIndex]:"请选择病症类型"}}</view>
  20. </picker>
  21. </view>
  22. </view>
  23. <view class="tab-cont">
  24. <view class="item-container" :class="showMorefilter?'showMorefilter':''">
  25. <view class="item" v-for="item in items" :key="item.id" @click="showdetail(item.id)">
  26. <view class="avatar">
  27. <image src="../../../static/images/doctor.jpg" mode="widthFix" class="pic"></image>
  28. </view>
  29. <view class="item-info">
  30. <view class="user">
  31. <text class="name">{{item.name}}</text>
  32. <view class="gender" :class="item.gender==='1'?'woman':'man'">
  33. <text>{{item.gender==='1'?'女':"男"}}</text>
  34. </view>
  35. <text class="age">{{item.age}}</text>
  36. </view>
  37. <view class="illnessType">
  38. <text>{{item.illnessType}}</text>
  39. </view>
  40. <view class="time">
  41. <text>就诊时间:</text>
  42. <text>{{item.time}}</text>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import {treatmentList,removeTreatmentPatient} from '@/api/doctor';
  52. import { getIlltype } from '@/api/user.js'
  53. export default{
  54. name:"doctor-index",
  55. data() {
  56. return {
  57. showMorefilter:false,
  58. illnessTypeIndex:-1,
  59. illnessTypes:[],
  60. keyword: '',
  61. items:[],
  62. pageNumber:1,
  63. pageSize:9999
  64. }
  65. },
  66. created() {
  67. let accountInfo=uni.getStorageSync('accountInfo');
  68. this.userType=accountInfo.userType;
  69. if(accountInfo.userType===1){
  70. this.init();
  71. }
  72. },
  73. methods:{
  74. init(){
  75. this.getList()
  76. this.setIllnessType()
  77. },
  78. setIllnessType(){
  79. getIlltype().then((result) => {
  80. let illnessTypes=result.data;
  81. illnessTypes=illnessTypes.map((item)=>{
  82. return item.typename
  83. })
  84. illnessTypes.unshift('全部病症类型');
  85. this.illnessTypes = illnessTypes;
  86. })
  87. },
  88. filterHandle(){
  89. this.showMorefilter=!this.showMorefilter;
  90. },
  91. getList(){
  92. let accountInfo=uni.getStorageSync('accountInfo');
  93. let patientId=accountInfo.id;
  94. let keyword=this.keyword;
  95. let illnessTypeIndex=this.illnessTypeIndex;
  96. let illnessType=this.illnessTypes[illnessTypeIndex];
  97. if(illnessTypeIndex<1){
  98. illnessType="";
  99. }
  100. // let startTime=formatTime(this.time[0]);
  101. // let endTime=formatTime(this.time[1]);
  102. let page= this.pageNumber;
  103. let limit=this.pageSize;
  104. const maxAge = 60;
  105. const minAge = 20;
  106. var dictionaries={};
  107. treatmentList({
  108. keyword,page,limit,patientId,illnessType
  109. }).then((res)=>{
  110. let list=res.data.list;
  111. let age="";
  112. let items=list.map((item)=>{
  113. if(dictionaries.hasOwnProperty(item.patientName)){
  114. age=dictionaries[item.patientName]
  115. }else{
  116. age=dictionaries[item.patientName]=Math.floor(Math.random()*(maxAge-minAge+1)+minAge);
  117. }
  118. return{
  119. id:item.treatmentId,
  120. name:item.doctorName,
  121. time:item.seekTime,
  122. gender:item.doctorSex,
  123. illnessType:item.illnessType,
  124. age
  125. }
  126. });
  127. //this.total=res.data.totalCount;
  128. this.items=items;
  129. })
  130. },
  131. search(){
  132. this.pageNumber=1;
  133. this.getList();
  134. },
  135. showdetail(id){
  136. uni.navigateTo({
  137. url:`/views/detail/index?type=therapy&user=doctor&id=${id}`
  138. // #ifdef MP-WEIXIN
  139. ,animationType: 'pop-out',
  140. animationDuration: 200
  141. // #endif
  142. })
  143. },
  144. createTherapy(){
  145. uni.navigateTo({
  146. url:"/views/doctorItems/createPatient/index"
  147. })
  148. },
  149. removeSubmit(id=null){
  150. removeTreatmentPatient(id).then((res)=>{
  151. console.log(res)
  152. })
  153. },
  154. changeIllnessType({detail}){
  155. this.illnessTypeIndex=detail.value;
  156. this.search();
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="scss" scoped>
  162. .content{
  163. .search{
  164. height: 100upx;
  165. display: flex;
  166. justify-content: space-between;
  167. align-items: center;
  168. padding: 0 20upx;
  169. .inp{
  170. width: 350upx;
  171. height: 60upx;
  172. display: flex;
  173. justify-content:flex-start;
  174. align-items: center;
  175. input{
  176. height: 100%;
  177. margin-left: 14upx;
  178. display: inline-block;
  179. font-size: 24upx;
  180. color: #999999;
  181. &::-webkit-input-placeholder {
  182. font-size: 24upx;
  183. color: #999999;
  184. }
  185. }
  186. }
  187. .searchBt{
  188. button{
  189. width: 130upx;
  190. height: 60upx;
  191. line-height: 60upx;
  192. background-color: #3384FF;
  193. text-align: center;
  194. color: #fff;
  195. font-size: 24upx;
  196. }
  197. }
  198. }
  199. .more-filter{
  200. padding: 20upx;
  201. border-top: 1px solid #eaeaea;
  202. .filterBt{
  203. padding-left: 20upx;
  204. .zhcx-iconfont{
  205. font-size: 16upx;
  206. padding-left: 10upx;
  207. }
  208. }
  209. .uni-input{
  210. border: 1px solid #ccc;
  211. display: inline-block;
  212. padding: 10upx 20upx;
  213. }
  214. }
  215. .tab-cont{
  216. &{
  217. padding-bottom: 30upx;
  218. background-color: #fff;
  219. }
  220. .item-container{
  221. border-top: 1px solid #eaeaea;
  222. .item{
  223. position: relative;
  224. padding: 20upx;
  225. background-color: #fff;
  226. // margin-bottom: 10upx;
  227. border-bottom: 1upx solid #eaeaea;
  228. .avatar{
  229. overflow: hidden;
  230. position: absolute;
  231. left: 20upx;
  232. top: 20upx;
  233. &,.pic{
  234. width: 86upx;
  235. height: 86upx;
  236. border-radius: 50%;
  237. }
  238. }
  239. .item-info{
  240. margin-left: 120upx;
  241. line-height: 1;
  242. .user{
  243. display: flex;
  244. justify-content: flex-start;
  245. align-items: center;
  246. .name{
  247. color: #333;
  248. font-size: 30upx;
  249. width: 300upx;
  250. white-space: nowrap;
  251. overflow: hidden;
  252. text-overflow: ellipsis;
  253. }
  254. .gender{
  255. position: relative;
  256. padding:0 30upx;
  257. &::after{
  258. width: 16upx;
  259. height: 16upx;
  260. border-radius: 50%;
  261. position: absolute;
  262. left: 10upx;
  263. top: 50%;
  264. transform: translateY(-50%);
  265. background-color: #1890FF;
  266. display: block;
  267. content: "";
  268. }
  269. &.woman::after{
  270. background-color: red;
  271. }
  272. }
  273. }
  274. .illnessType{
  275. padding-top:24upx;
  276. color: #424242;
  277. font-size: 28upx;
  278. }
  279. .time{
  280. color: #999;
  281. font-size: 28upx;
  282. padding-top: 24upx;
  283. }
  284. }
  285. }
  286. }
  287. }
  288. .createBt{
  289. width:110upx;
  290. height: 110upx;
  291. border-radius: 50%;
  292. background-color: #1890FF;
  293. color: #fff;
  294. display: flex;
  295. justify-content: center;
  296. align-items: center;
  297. flex-direction: column;
  298. position: fixed;
  299. right: 20upx;
  300. bottom: 150upx;
  301. box-shadow: 0 0 2px #65c4ff;
  302. z-index: 99;
  303. &.h5{
  304. bottom: 160upx;
  305. }
  306. .icon{
  307. width: 45upx;
  308. height: 45upx;
  309. position: relative;
  310. &::after{
  311. width: 45upx;
  312. height: 4upx;
  313. display: block;
  314. content: "";
  315. position: absolute;
  316. left: 50%;
  317. top: 50%;
  318. transform: translate(-50%,-50%);
  319. background-color: #fff;
  320. }
  321. &::before{
  322. width: 4upx;
  323. height: 45upx;
  324. display: block;
  325. content: "";
  326. position: absolute;
  327. left: 50%;
  328. top: 50%;
  329. transform: translate(-50%,-50%);
  330. background-color: #fff;
  331. }
  332. }
  333. .word{
  334. font-size: 24upx;
  335. padding-top: 4upx;
  336. }
  337. }
  338. }
  339. </style>