index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <template>
  2. <view class="content">
  3. <view class="recommend-item organization" v-if="grade==='2'">
  4. <view class="organization-item" v-for="(hospital,hospitalIndex) in hospitals" :key="hospitalIndex">
  5. <view class="banner">
  6. <image class="banner-img" :src="hospitalBanner" mode="widthFix"></image>
  7. </view>
  8. <view class="hospital">
  9. <text class="name">{{hospital.name}}</text>
  10. <text class="grade">{{hospital.hospitallevel}}</text>
  11. </view>
  12. <view class="address">
  13. <text>{{hospital.position.detailed}}</text>
  14. </view>
  15. <view class="doctor-list">
  16. <view class="doctor-item" v-for="(item,index) in hospital.treatmentdoctor" :key="index">
  17. <view class="user">
  18. <image :src="item.headportrait" mode="widthFix" class="avatar" @error='onErrorImg(item)'></image>
  19. <view class="info">
  20. <view class="name">
  21. <text>{{item.doctorname}}</text>
  22. </view>
  23. <view class="tags">
  24. <text>{{item.technicaltitle}}</text>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- <view class="consult" @click="consult(item)">
  29. <text>+咨询</text>
  30. </view> -->
  31. <view class="hospital">
  32. <text class="name">{{hospital.name}}</text>
  33. <text class="grade">{{hospital.hospitallevel}}</text>
  34. </view>
  35. <view class="specialty">
  36. <text class="specialty-head">专业特长</text>
  37. <text class="specialty-message">{{item.begoodat}}</text>
  38. </view>
  39. <view class="more" @click="showdetails(item,hospital)">查看简介</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- 推荐医生&药店 -->
  45. <view class="recommend-item others" v-else>
  46. <view class="tab">
  47. <view class="item" v-for="tab in tabs" :key="tab.id" :class="tabIndex===tab.id?'active':''" @click="changeTab(tab.id)">
  48. <text class="word">{{tab.name}}</text>
  49. </view>
  50. </view>
  51. <view class="tab-cont">
  52. <view class="doctor-list" v-if="tabIndex===1">
  53. <view class="doctor-item" v-for="(item,index) in others.doctors" :key="index">
  54. <view class="user">
  55. <image :src="item.headportrait" mode="widthFix" class="avatar" @error='onErrorImg(item)'></image>
  56. <view class="info">
  57. <view class="name">
  58. <text>{{item.doctorname}}</text>
  59. </view>
  60. <view class="tags" >
  61. <text>{{item.technicaltitle}}</text>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- <view class="consult" @click="consult(item)">
  66. <text>+咨询</text>
  67. </view> -->
  68. <view class="consult" @click="disableConsult(item)" :class="aiConsultList.indexOf(item.id)>-1?'':'disable'">
  69. <text>{{aiConsultList.indexOf(item.id)>-1?'咨询':'不咨询'}}</text>
  70. </view>
  71. <view class="hospital">
  72. <text class="name">{{item.hospitalName}}</text>
  73. <text class="grade">{{item.hospitalGrade}}</text>
  74. </view>
  75. <view class="specialty">
  76. <text class="specialty-head">专业特长</text>
  77. <text class="specialty-message">{{item.begoodat}}</text>
  78. </view>
  79. <view class="more" @click="showdetails(item,'ai')">查看简介</view>
  80. </view>
  81. <view class="consult-container">
  82. <view class="consult-submit" @click="consult">立即咨询</view>
  83. </view>
  84. </view>
  85. <view class="drugstore-list" v-else>
  86. <view class="drugstore-list-wrap">
  87. <view class="head" v-if="others.medicine.length>0">
  88. <view class="title">
  89. <view class="dot"></view>
  90. <text>推荐药物</text>
  91. </view>
  92. <view class="medicine">
  93. <view class="tag-item" v-for="(item,index) in others.medicine" :key="index">{{item}}</view>
  94. </view>
  95. </view>
  96. <view class="drugstore-cont">
  97. <view class="drugstore-item" v-for="(item,index) in others.drugstore" :key="index" @click="linkTo(item)">
  98. <view class="drugstore-pic">
  99. <image class="icon-drugstore" src="../../../static/images/recommend/drugstore.jpg" mode="widthFix"></image>
  100. </view>
  101. <view class="drugstore-info">
  102. <view class="name">
  103. <text>{{item.name}}</text>
  104. </view>
  105. <view class="address">
  106. <image class="icon-address" src="../../../static/images/order/location.png" mode="widthFix"></image>
  107. <text>{{item.position.detailed}}</text>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </template>
  118. <script>
  119. import defaultavatar from "@/static/images/avatar.png";
  120. import {patientInfo,consultationDoctor,recommend} from '@/api/patient';
  121. import {deepClone} from '@/libs'
  122. export default{
  123. data:()=>{
  124. return{
  125. defaultavatar,
  126. /*2-推荐机构;1-推荐药店;3-患者检索后ai推荐*/
  127. grade:0,
  128. tabs:[
  129. // {id:1,name:'推荐医生'},
  130. {id:2,name:'推荐药店'}
  131. ],
  132. hospitalBanner:require('@/static/images/recommend/banner.png'),
  133. tabIndex:2,
  134. others:{
  135. doctors:[],
  136. drugstore:[],
  137. medicine:[]
  138. },
  139. hospitals:[
  140. {
  141. name:"",
  142. hospitallevel:"",
  143. position:{detailed:""},
  144. treatmentdoctor:[]
  145. }
  146. ],
  147. aiConsultList:[]
  148. }
  149. },
  150. onLoad(option) {
  151. console.log(option)
  152. if(option.type==="3"){
  153. this.init(option)
  154. }else{
  155. this.initRecommendInfo(option);//用户根据病症等级进行推荐
  156. }
  157. },
  158. methods:{
  159. init(){//ai提交资料后显示的推荐信息
  160. let aidiagnoseInfo=uni.getStorageSync("aidiagnoseInfo");
  161. let diagnosticdoctor=aidiagnoseInfo.diagnosticdoctor;
  162. let aiConsultList=[];
  163. diagnosticdoctor=diagnosticdoctor.map((item)=>{
  164. aiConsultList.push(item.id)
  165. return{
  166. id:item.id,
  167. headportrait:item.headportrait,
  168. doctorname:item.doctorname,
  169. technicaltitle:item.technicaltitle,
  170. hospitalName:item.hospitalname,
  171. hospitalGrade:item.hospitallevel,
  172. begoodat:item.begoodat
  173. }
  174. })
  175. this.tabIndex=1;
  176. this.tabs=[
  177. {id:1,name:'推荐医生'},
  178. ],
  179. this.aiConsultList=aiConsultList;
  180. this.$set(this.others,'doctors',diagnosticdoctor);
  181. },
  182. changeTab(index){
  183. this.tabIndex=index;
  184. },
  185. async initRecommendInfo({id,grade}){
  186. this.grade=grade;
  187. let diseaseGrade=grade;
  188. if(!id)return;
  189. let {
  190. aiDiagnosisSite,
  191. aiDiagnosisDesc,
  192. doctorDiagnosisInfo,
  193. diseaseImgDesc,
  194. diseaseDesc,
  195. aiPatientSeekDesc
  196. }=await this.initPatientInfo(id)
  197. .catch((res)=>{
  198. uni.showToast({
  199. title:"获取咨询详情失败",
  200. icon:"none"
  201. })
  202. });
  203. let position=await this.getPositon().catch((res)=>{
  204. uni.showToast({
  205. title:"获取位置信息失败",
  206. icon:"none"
  207. })
  208. });
  209. let therapeuticDrugs=aiPatientSeekDesc.therapeuticDrugs;
  210. let recommendCallBack=await this.initRecommend({
  211. position,diseaseDesc,diseaseImgDesc,
  212. aiDiagnosisSite,aiPatientSeekDesc,therapeuticDrugs,
  213. aiDiagnosisDesc,doctorDiagnosisInfo,diseaseGrade
  214. }).catch((res)=>{
  215. uni.showToast({
  216. title:"获取推荐信息失败",
  217. icon:"none"
  218. })
  219. });
  220. if(diseaseGrade==='1'){//药店
  221. let drugstore=recommendCallBack.data.pharmacys;
  222. let therapeuticDrugs=recommendCallBack.data.therapeuticDrugs;
  223. therapeuticDrugs=therapeuticDrugs.split('、');
  224. this.$set(this.others,'drugstore',drugstore);
  225. this.$set(this.others,'medicine',therapeuticDrugs);
  226. }else{
  227. this.hospitals=recommendCallBack.data.hospitals
  228. }
  229. },
  230. initPatientInfo(id){
  231. return new Promise((resolve,reject)=>{
  232. patientInfo(id).then((res)=>{
  233. resolve(res.data)
  234. }).catch((err)=>{
  235. reject(err);
  236. })
  237. })
  238. },
  239. getPositon(){
  240. return new Promise((resolve,reject)=>{
  241. uni.getLocation({
  242. type: 'wgs84',
  243. success: function (res) {
  244. resolve(res)
  245. },
  246. fail(err) {
  247. reject(err);
  248. }
  249. });
  250. })
  251. },
  252. initRecommend({
  253. position,diseaseDesc,diseaseImgDesc,
  254. aiDiagnosisSite,
  255. aiDiagnosisDesc,therapeuticDrugs,
  256. doctorDiagnosisInfo,diseaseGrade
  257. }){
  258. return new Promise((resolve,reject)=>{
  259. recommend({
  260. chiefcomplaint:diseaseDesc,
  261. imageppath:diseaseImgDesc,
  262. site:aiDiagnosisSite,
  263. position,
  264. aidiagnosticresults:aiDiagnosisDesc,
  265. doctordiagnosticresults:doctorDiagnosisInfo,
  266. diseaseGrade,
  267. therapeuticDrugs
  268. }).then((res)=>{
  269. resolve(res)
  270. }).catch((err)=>{
  271. reject(err);
  272. })
  273. })
  274. },
  275. linkTo(item){
  276. uni.setStorageSync('drugstore',item);
  277. uni.navigateTo({
  278. url:'/views/patientItems/order/index'
  279. })
  280. },
  281. onErrorImg(item) {
  282. this.$set(item,'headportrait',this.defaultavatar)
  283. },
  284. showdetails(doctorItem,hospital){
  285. if(hospital!=='ai'){
  286. doctorItem.hospitalName=hospital.name;
  287. doctorItem.hospitalGrade=hospital.hospitallevel;
  288. }
  289. let item=JSON.stringify(doctorItem)
  290. uni.setStorageSync('doctor',doctorItem);
  291. uni.navigateTo({
  292. url:"/views/patientItems/doctorInfo/index"
  293. })
  294. },
  295. disableConsult(item){
  296. let aiConsultList=deepClone(this.aiConsultList);
  297. if(aiConsultList.indexOf(item.id)>-1){
  298. aiConsultList=aiConsultList.filter((doctor)=>{
  299. return doctor!==item.id;
  300. })
  301. }else{
  302. aiConsultList.push(item.id)
  303. }
  304. this.aiConsultList=aiConsultList;
  305. },
  306. consult(){
  307. var patientName=uni.getStorageSync('userInfo').patientName;
  308. let seekId=uni.getStorageSync('aidiagnoseInfo').seekId;
  309. let doctorIds=deepClone(this.aiConsultList);
  310. if(doctorIds.length>0){
  311. doctorIds=doctorIds.join(',');
  312. consultationDoctor({
  313. patientName,
  314. seekId,
  315. doctorIds
  316. }).then(()=>{
  317. uni.showToast({
  318. title:'咨询成功',
  319. complete(){
  320. uni.reLaunch({
  321. url:'/pages/home/index?type=consult'
  322. })
  323. }
  324. })
  325. })
  326. }else{
  327. uni.showToast({
  328. icon:"none",
  329. title:"请选择一个医生进行咨询"
  330. })
  331. }
  332. },
  333. }
  334. }
  335. </script>
  336. <style lang="scss" scoped>
  337. .content{
  338. padding-bottom: 80upx;
  339. .recommend-item{
  340. &.organization{
  341. padding:24upx;
  342. .banner{
  343. .banner-img{
  344. display: block;
  345. width:100%;
  346. height: 350upx;
  347. }
  348. }
  349. .hospital{
  350. padding-left: 8upx;
  351. padding-top: 20upx;
  352. .name{
  353. font-size:36upx;
  354. color: #333333;
  355. }
  356. .grade{
  357. font-size: 24upx;
  358. color: #3384FF;
  359. padding-left: 33upx;
  360. }
  361. }
  362. .address{
  363. padding-left: 8upx;
  364. padding-top: 12upx;
  365. font-size: 28upx;
  366. color: #999999;
  367. display: -webkit-box;
  368. -webkit-box-orient: vertical;
  369. -webkit-line-clamp: 2;
  370. overflow: hidden;
  371. }
  372. }
  373. &.others{
  374. padding: 0 24upx;
  375. .tab{
  376. text-align: center;
  377. .item{
  378. height: 73upx;
  379. display: inline-block;
  380. line-height: 73upx;
  381. padding:0 50upx;
  382. font-size: 28upx;
  383. color: #666;
  384. &.active{
  385. color: #1890FF;
  386. .word{
  387. display: inline-block;
  388. height: 100%;
  389. position: relative;
  390. &::after{
  391. display: block;
  392. content: "";
  393. width: 100%;
  394. height: 8upx;
  395. background-color: #3384FF;
  396. position: absolute;
  397. bottom: 0;
  398. left: 50%;
  399. transform: translateX(-50%);
  400. }
  401. }
  402. }
  403. }
  404. }
  405. .tab-cont{
  406. .drugstore-list{
  407. .drugstore-list-wrap{
  408. .head {
  409. padding-left: 24upx;
  410. .title{
  411. font-size: 30upx;
  412. color: #0A0A0A;
  413. .dot{
  414. display: inline-block;
  415. width: 32upx;
  416. height: 32upx;
  417. border-radius: 50%;
  418. position: relative;
  419. background:rgba(51, 132, 255,0.2);
  420. top: 6upx;
  421. margin-right: 6upx;
  422. &::after{
  423. display: block;
  424. content: "";
  425. width: 14upx;
  426. height: 14upx;
  427. border-radius: 50%;
  428. position: absolute;
  429. left: 50%;
  430. top: 50%;
  431. transform: translate(-50%,-50%);
  432. background-color: #3384FF;
  433. }
  434. }
  435. }
  436. .medicine{
  437. .tag-item{
  438. display: inline-block;
  439. height: 56upx;
  440. line-height: 56upx;
  441. padding: 0 28upx;
  442. background-color: #FFF6DD;
  443. border: 1px solid #FA6400;
  444. color: #FA6400;
  445. margin-right: 40upx;
  446. border-radius: 8upx;
  447. margin-top: 18upx;
  448. }
  449. }
  450. }
  451. .drugstore-cont{
  452. margin-top: 20upx;
  453. .drugstore-item{
  454. display: flex;
  455. justify-content: flex-start;
  456. align-items: center;
  457. padding: 16upx 24upx;
  458. .drugstore-pic {
  459. width: 112upx;
  460. height: 112upx;
  461. .icon-drugstore{
  462. display: inline-block;
  463. width: 112upx;
  464. height: 112upx;
  465. border-radius: 10upx;
  466. }
  467. }
  468. .drugstore-info{
  469. padding-left: 32upx;
  470. .name{
  471. font-size: 28upx;
  472. color: #333333;
  473. padding-bottom: 5upx;
  474. }
  475. .address{
  476. min-height: 40upx;
  477. line-height: 40upx;
  478. display: flex;
  479. justify-content: flex-start;
  480. align-items: center;
  481. font-size: 28upx;
  482. color: #666666;
  483. display: -webkit-box;
  484. -webkit-box-orient: vertical;
  485. -webkit-line-clamp: 3;
  486. overflow: hidden;
  487. .icon-address{
  488. display: inline-block;
  489. width: 23upx;
  490. margin-right: 10upx;
  491. }
  492. }
  493. }
  494. }
  495. }
  496. }
  497. }
  498. }
  499. }
  500. }
  501. .doctor-item{
  502. &{
  503. padding: 24upx;
  504. margin-top: 24upx;
  505. position: relative;
  506. }
  507. .consult{
  508. display: inline-block;
  509. background: #3384FF;
  510. border-radius: 20upx;
  511. padding:12upx 14upx;
  512. font-size: 24upx;
  513. color: #FFF;
  514. position: absolute;
  515. right: 25upx;
  516. top: 24upx;
  517. letter-spacing: 2upx;
  518. line-height: 24upx;
  519. &.disable{
  520. background-color: #666;
  521. color: #fff;
  522. }
  523. }
  524. .user{
  525. &{
  526. display: flex;
  527. justify-content: flex-start;
  528. align-items: center;
  529. }
  530. .avatar{
  531. display: block;
  532. width: 72upx;
  533. height: 72upx;
  534. border-radius: 50%;
  535. background-color: #ccc;
  536. }
  537. .info{
  538. padding-left: 16upx;
  539. .name{
  540. font-size: 24upx;
  541. color: #333333;
  542. }
  543. .tags{
  544. font-size: 22upx;
  545. color: #666666
  546. }
  547. }
  548. }
  549. .hospital{
  550. padding-top: 18upx;
  551. .name{
  552. font-size: 22upx;
  553. color: #666666;
  554. }
  555. .grade{
  556. font-size: 18upx;
  557. color: #3384FF;
  558. padding-left: 10upx;
  559. }
  560. }
  561. .specialty{
  562. line-height: 34upx;
  563. padding-top: 21upx;
  564. display: -webkit-box;
  565. -webkit-box-orient: vertical;
  566. -webkit-line-clamp: 2;
  567. overflow: hidden;
  568. .specialty-head{
  569. color:#3384FF;
  570. position: relative;
  571. &::after{
  572. width: 40%;
  573. height: 6upx;
  574. display: block;
  575. content: "";
  576. position: absolute;
  577. left: 50%;
  578. transform: translateX(-50%);
  579. bottom: -5upx;
  580. background-color:#FA6400;
  581. z-index: 999;
  582. }
  583. }
  584. .specialty-message{
  585. font-size: 22upx;
  586. color: #999;
  587. padding-left: 7upx;
  588. }
  589. }
  590. .more{
  591. display: inline-block;
  592. text-align: right;
  593. font-size: 22upx;
  594. color: #3384FF;
  595. float: right;
  596. padding: 10upx 0 10upx 100upx;
  597. }
  598. }
  599. }
  600. .consult-submit{
  601. width: 260upx;
  602. height: 80upx;
  603. text-align: center;
  604. line-height: 80upx;
  605. background-color: #3384FF;
  606. color: #fff;
  607. border-radius: 10upx;
  608. font-size: 32upx;
  609. margin-top: 20upx;
  610. }
  611. </style>