inquiryForm2_2.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. <template>
  2. <view class="content">
  3. <view class="main">
  4. <u-alert fontSize="16" description = "尊敬的用户,您好!
  5. 为了您的健康,请认真填写以下内容,以便药师为您更好的分析,提供更有针对性的解决方案!"></u-alert>
  6. <view class="chose-patient">
  7. <view class="title-box" @click="addPatient()" v-if="patient==null">
  8. <text class="title">选择就诊人</text>
  9. <view class="right" >
  10. <text class="value">请点击添加</text>
  11. <image src="/static/images/arrow_gray.png" mode=""></image>
  12. </view>
  13. </view>
  14. <view class="patient" @click="addPatient()" v-if="patient!=null">
  15. <view class="left">
  16. <view class="name">{{patient.patientName}}</view>
  17. <view class="info">
  18. <text class="text" v-if="patient.sex==1">男</text>
  19. <text class="text" v-if="patient.sex==2">女</text>
  20. <text class="text">{{$getAge(patient.birthday)}}岁</text>
  21. <text class="text">{{$parseIdCard(patient.idCard)}}</text>
  22. </view>
  23. </view>
  24. <view class="right" >
  25. <image src="/static/images/arrow_gray.png" mode=""></image>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="cont">
  30. <u-form :rules="rules" :model="form" ref="uForm" labelPosition="left">
  31. <view class="title-box">
  32. <view class="line"></view>
  33. <view class="title">请描述您的病情</view>
  34. </view>
  35. <view class="form">
  36. <u-form-item :required="true" labelWidth="200rpx" borderBottom label="描述您的病情" prop="title">
  37. <u--textarea maxlength="500" v-model="form.title" placeholder="请输入内容" count ></u--textarea>
  38. </u-form-item>
  39. <u-form-item :required="true" labelWidth="200rpx" borderBottom label="正在服用药品" prop="drugs">
  40. <u--textarea maxlength="500" v-model="form.drugs" placeholder="请输入内容" count ></u--textarea>
  41. </u-form-item>
  42. <u-form-item :required="true" labelWidth="200rpx" borderBottom label="本次患病多久了" prop="duration">
  43. <u-radio-group
  44. v-model="form.duration"
  45. iconPlacement="left">
  46. <u-radio :customStyle="{marginRight: '5px'}"
  47. v-for="(item, index) in durations"
  48. :key="index"
  49. :label="item.name"
  50. :name="item.name" activeColor="#C39A58"
  51. ></u-radio>
  52. </u-radio-group>
  53. </u-form-item>
  54. <u-form-item :required="true" labelWidth="200rpx" borderBottom label="此次病情是否去医院就诊过" prop="isVisit">
  55. <u-radio-group
  56. v-model="form.isVisit"
  57. iconPlacement="left">
  58. <u-radio :customStyle="{marginRight: '5px'}"
  59. v-for="(item, index) in isVisits"
  60. :key="index"
  61. :label="item.name"
  62. :name="item.name" activeColor="#C39A58"
  63. ></u-radio>
  64. </u-radio-group>
  65. </u-form-item>
  66. <u-form-item :required="true" labelWidth="200rpx" borderBottom label="上传检测报告或患处照片" >
  67. <view class="form-item">
  68. <view class="icon"></view>
  69. <u-upload
  70. :fileList="fileList1"
  71. @afterRead="afterRead"
  72. @delete="deletePic"
  73. name="1"
  74. multiple
  75. :maxCount="4"
  76. >
  77. </u-upload>
  78. </view>
  79. </u-form-item>
  80. <u-form-item :required="true" labelWidth="200rpx" borderBottom label="上传舌苔照片" >
  81. <view class="form-item">
  82. <image @click="showImg(1)" class="icon" src="/static/images/question.png"></image>
  83. <u-upload
  84. :fileList="fileList2"
  85. @afterRead="afterRead"
  86. @delete="deletePic"
  87. name="2"
  88. multiple
  89. :maxCount="4"
  90. >
  91. </u-upload>
  92. </view>
  93. </u-form-item>
  94. <u-form-item :required="true" labelWidth="200rpx" label="上传面部照片" >
  95. <view class="form-item">
  96. <image @click="showImg(2)" class="icon" src="/static/images/question.png"></image>
  97. <u-upload
  98. :fileList="fileList3"
  99. @afterRead="afterRead"
  100. @delete="deletePic"
  101. name="3"
  102. multiple
  103. :maxCount="4"
  104. >
  105. </u-upload>
  106. </view>
  107. </u-form-item>
  108. </view>
  109. <view class="title-box">
  110. <view class="line"></view>
  111. <view class="title">您的头面部健康状况自我检查</view>
  112. </view>
  113. <view class="form">
  114. <view class="option-box">
  115. <view class="option-item" v-for="(item,index) in temps" >
  116. <view v-if="item.tempType==1" class="title">{{index+1}} {{item.title}}</view>
  117. <view class="options">
  118. <u-checkbox-group
  119. v-if="item.tempType==1"
  120. v-model="item.checks"
  121. placement="column"
  122. >
  123. <u-checkbox
  124. size="28"
  125. shape="circle"
  126. activeColor="#C39A58"
  127. v-for="(option, subIndex) in item.options"
  128. :key="option.name"
  129. :label="option.name"
  130. :name="option.name"
  131. >
  132. </u-checkbox>
  133. </u-checkbox-group>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <view class="title-box">
  139. <view class="line"></view>
  140. <view class="title">您的四肢肩颈健康状况自我检查</view>
  141. </view>
  142. <view class="form">
  143. <view class="option-box">
  144. <view class="option-item" v-for="(item,index) in temps" >
  145. <view v-if="item.tempType==2" class="title">{{index+1}} {{item.title}}</view>
  146. <view class="options">
  147. <u-checkbox-group
  148. v-if="item.tempType==2"
  149. v-model="item.checks"
  150. placement="column"
  151. >
  152. <u-checkbox
  153. size="28"
  154. shape="circle"
  155. activeColor="#C39A58"
  156. v-for="(option, subIndex) in item.options"
  157. :key="option.name"
  158. :label="option.name"
  159. :name="option.name"
  160. >
  161. </u-checkbox>
  162. </u-checkbox-group>
  163. </view>
  164. </view>
  165. </view>
  166. </view>
  167. <view class="title-box">
  168. <view class="line"></view>
  169. <view class="title">您的胸腹部健康状况自我检查</view>
  170. </view>
  171. <view class="form">
  172. <view class="option-box">
  173. <view class="option-item" v-for="(item,index) in temps" >
  174. <view v-if="item.tempType==3" class="title">{{index+1}} {{item.title}}</view>
  175. <view class="options">
  176. <u-checkbox-group
  177. v-if="item.tempType==3"
  178. v-model="item.checks"
  179. placement="column"
  180. >
  181. <u-checkbox
  182. size="28"
  183. shape="circle"
  184. activeColor="#C39A58"
  185. v-for="(option, subIndex) in item.options"
  186. :key="option.name"
  187. :label="option.name"
  188. :name="option.name"
  189. >
  190. </u-checkbox>
  191. </u-checkbox-group>
  192. </view>
  193. </view>
  194. </view>
  195. </view>
  196. <view class="title-box">
  197. <view class="line"></view>
  198. <view class="title">其他身体状况自我检查</view>
  199. </view>
  200. <view class="form">
  201. <view class="option-box">
  202. <view class="option-item" v-for="(item,index) in temps" >
  203. <view v-if="item.tempType==4" class="title">{{index+1}} {{item.title}}</view>
  204. <view class="options">
  205. <u-checkbox-group
  206. v-if="item.tempType==4"
  207. v-model="item.checks"
  208. placement="column"
  209. >
  210. <u-checkbox
  211. size="28"
  212. shape="circle"
  213. activeColor="#C39A58"
  214. v-for="(option, subIndex) in item.options"
  215. :key="option.name"
  216. :label="option.name"
  217. :name="option.name"
  218. >
  219. </u-checkbox>
  220. </u-checkbox-group>
  221. </view>
  222. </view>
  223. </view>
  224. </view>
  225. </u-form>
  226. </view>
  227. </view>
  228. <view class="btn-box">
  229. <view class="btn" @click="submitOrder()">提交订单</view>
  230. </view>
  231. </view>
  232. </template>
  233. <script>
  234. import {bindCompanyUser} from '@/api/companyUser.js'
  235. import {create,confirm,getInquiryTemp} from '@/api/inquiryOrder.js'
  236. export default {
  237. data() {
  238. return {
  239. companyId:null,
  240. companyUserId:null,
  241. temps:[],
  242. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  243. orderKey:null,
  244. patient:null,
  245. durations: [
  246. {
  247. name: '一周内',
  248. disabled: false
  249. },
  250. {
  251. name: '一个月内',
  252. disabled: false
  253. },
  254. {
  255. name: '半年内',
  256. disabled: false
  257. }, {
  258. name: '半年以上',
  259. disabled: false
  260. }
  261. ],
  262. isVisits: [
  263. {
  264. name: '未就诊',
  265. disabled: false
  266. },
  267. {
  268. name: '就诊过',
  269. disabled: false
  270. }
  271. ],
  272. form:{
  273. title:"",
  274. drug:"",
  275. isVisit:"就诊过",
  276. duration:"一周内",
  277. },
  278. rules: {
  279. title: [
  280. {
  281. required: true,
  282. message: '请输入您的病情',
  283. // 可以单个或者同时写两个触发验证方式
  284. trigger: ['change','blur'],
  285. }
  286. ],
  287. drugs: [
  288. {
  289. required: true,
  290. message: '请输入正在服用药品',
  291. // 可以单个或者同时写两个触发验证方式
  292. trigger: ['change','blur'],
  293. }
  294. ],
  295. durations: [
  296. {
  297. required: true,
  298. message: '请选择本次患病多久',
  299. // 可以单个或者同时写两个触发验证方式
  300. trigger: ['change','blur'],
  301. }
  302. ],
  303. isVisit: [
  304. {
  305. required: true,
  306. message: '请选择是否去医院就诊过',
  307. // 可以单个或者同时写两个触发验证方式
  308. trigger: ['change','blur'],
  309. }
  310. ],
  311. },
  312. inquiryType:null,
  313. inquirySubType:null,
  314. orderType:null,
  315. doctorId:null,
  316. fileList1: [],
  317. fileList2: [],
  318. fileList3: [],
  319. isShare:null
  320. }
  321. },
  322. onLoad(options) {
  323. if(!this.$isEmpty(options.isShare)){
  324. this.isShare=options.isShare
  325. }
  326. else{
  327. //uni.hideShareMenu()
  328. }
  329. console.log(options)
  330. if(!this.$isEmpty(options.companyId)){
  331. this.companyId=options.companyId == 'undefined' || options.companyId == 'null' ? null: options.companyId
  332. }
  333. if(!this.$isEmpty(options.companyUserId)){
  334. this.companyUserId=options.companyUserId == 'undefined' || options.companyUserId == 'null'? null: options.companyUserId
  335. }
  336. console.log(this.companyId)
  337. console.log(this.companyUserId)
  338. this.inquiryType=options.inquiryType;
  339. this.inquirySubType=options.inquirySubType;
  340. this.orderType=options.orderType;
  341. this.doctorId=options.doctorId;
  342. console.log(this.inquiryType)
  343. console.log(this.orderType)
  344. console.log(this.doctorId)
  345. this.getInquiryTemp();
  346. },
  347. onShow() {
  348. if(this.$isLogin()){
  349. if(!this.$isEmpty(this.companyUserId)){
  350. let data = {companyUserId:this.companyUserId};
  351. bindCompanyUser(data).then(
  352. res => {
  353. if(res.code==200){
  354. }
  355. },
  356. rej => {}
  357. );
  358. }
  359. }
  360. var that=this;
  361. uni.$on('refreshOrderPatient', (res) => {
  362. that.patient=res
  363. })
  364. this.confirm();
  365. },
  366. onReady() {
  367. this.$refs.uForm.setRules(this.rules);
  368. },
  369. onShareAppMessage(res) {
  370. //禁止二次转发--
  371. uni.showShareMenu({
  372. withShareTicket: true
  373. });
  374. wx.updateShareMenu({
  375. isPrivateMessage: true,
  376. withShareTicket: false,
  377. success(res) {
  378. console.log('updateShareMenu: ', res);
  379. },
  380. fail() {}
  381. }); //禁止二次转发--end
  382. return {
  383. title: "御君方互联网医院--健康会诊",
  384. path: "/pages/store/inquiryForm2_2?inquiryType=2&orderType=2&inquirySubType="+this.inquirySubType+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId
  385. }
  386. },
  387. methods: {
  388. leftClick() {
  389. console.log('leftClick');
  390. uni.showModal({
  391. title: '提示',
  392. content: '确认关闭吗',
  393. success: function (res) {
  394. if (res.confirm) {
  395. uni.navigateBack()
  396. } else if (res.cancel) {
  397. }
  398. }
  399. });
  400. },
  401. showImg(type){
  402. if(type==1){
  403. var imgs=[
  404. "https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/0640bd4b80ba4491842b9d20d7238616.png"
  405. ];
  406. uni.previewImage({
  407. current: 0,
  408. urls: imgs
  409. });
  410. }
  411. else if(type==2){
  412. var imgs=[
  413. "https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/2c9f24e5c3fc458f8bcb30a4fb0619be.png"
  414. ];
  415. uni.previewImage({
  416. current: 0,
  417. urls: imgs
  418. });
  419. }
  420. },
  421. getInquiryTemp(){
  422. let data = {};
  423. getInquiryTemp(data).then(
  424. res => {
  425. if(res.code==200){
  426. this.temps=res.data;
  427. this.temps.forEach(function(element) {
  428. element.options=JSON.parse(element.itemJson)
  429. });
  430. // this.temps1=temps.filter((item) => {
  431. // return item.tempType==1;
  432. // });
  433. // this.temps2=temps.filter((item) => {
  434. // return item.tempType==2;
  435. // });
  436. // this.temps3=temps.filter((item) => {
  437. // return item.tempType==3;
  438. // });
  439. // this.temps4=temps.filter((item) => {
  440. // return item.tempType==4;
  441. // });
  442. console.log(this.temps1)
  443. }
  444. },
  445. rej => {}
  446. );
  447. },
  448. submitOrder(){
  449. if(this.patient==null){
  450. uni.showToast({
  451. icon:'none',
  452. title: '请选择就诊人',
  453. });
  454. return;
  455. }
  456. if(this.orderKey==null){
  457. this.confirm();
  458. }
  459. var reportImages=[];
  460. this.fileList1.forEach(function(element) {
  461. reportImages.push(element.url)
  462. });
  463. var tongueImages=[];
  464. this.fileList2.forEach(function(element) {
  465. tongueImages.push(element.url)
  466. });
  467. var faceImages=[];
  468. this.fileList3.forEach(function(element) {
  469. faceImages.push(element.url)
  470. });
  471. var forms=[];
  472. this.temps.forEach(function(element) {
  473. var item={
  474. title:element.title,
  475. option:element.checks,
  476. }
  477. forms.push(item)
  478. });
  479. var that=this;
  480. this.$refs.uForm.validate().then(res => {
  481. var data={
  482. companyId:that.companyId,
  483. companyUserId:that.companyUserId,
  484. orderKey:this.orderKey,
  485. patientId:this.patient.patientId,
  486. title:this.form.title,
  487. drugs:this.form.drugs,
  488. isVisit:this.form.isVisit,
  489. duration:this.form.duration,
  490. inquiryType:this.inquiryType,
  491. inquirySubType:this.inquirySubType,
  492. orderType:this.orderType,
  493. doctorId:this.doctorId,
  494. reportImages:reportImages.toString(),
  495. tongueImages:tongueImages.toString(),
  496. faceImages:faceImages.toString(),
  497. formJson:JSON.stringify(forms)
  498. }
  499. //#ifdef APP-PLUS
  500. data.source=2;
  501. //#endif
  502. //#ifdef H5
  503. data.source=3;
  504. //#endif
  505. uni.showLoading({
  506. title: '正在处理中...'
  507. });
  508. create(data).then(
  509. res => {
  510. uni.hideLoading()
  511. if(res.code==200){
  512. setTimeout(function(){
  513. uni.redirectTo({
  514. url: './inquiryPay?orderId='+res.order.orderId
  515. })
  516. },200);
  517. return;
  518. }
  519. else{
  520. uni.showToast({
  521. icon:'none',
  522. title: res.msg,
  523. });
  524. }
  525. },
  526. rej => {}
  527. );
  528. }).catch(errors => {
  529. })
  530. },
  531. confirm(){
  532. let data = {};
  533. confirm(data).then(
  534. res => {
  535. if(res.code==200){
  536. this.orderKey=res.orderKey
  537. }
  538. },
  539. rej => {}
  540. );
  541. },
  542. addPatient(){
  543. uni.navigateTo({
  544. url: '/pages/user/patient'
  545. })
  546. },
  547. deletePic(event) {
  548. this[`fileList${event.name}`].splice(event.index, 1)
  549. },
  550. async afterRead(event) {
  551. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  552. let lists = [].concat(event.file)
  553. let fileListLen = this[`fileList${event.name}`].length
  554. lists.map((item) => {
  555. this[`fileList${event.name}`].push({
  556. ...item,
  557. status: 'uploading',
  558. message: '上传中'
  559. })
  560. })
  561. for (let i = 0; i < lists.length; i++) {
  562. const result = await this.uploadFilePromise(lists[i].url)
  563. let item = this[`fileList${event.name}`][fileListLen]
  564. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  565. status: 'success',
  566. message: '',
  567. url: result
  568. }))
  569. fileListLen++
  570. }
  571. },
  572. uploadFilePromise(url) {
  573. return new Promise((resolve, reject) => {
  574. let a = uni.uploadFile({
  575. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', // 仅为示例,非真实的接口地址
  576. filePath: url,
  577. name: 'file',
  578. formData: {
  579. user: 'test'
  580. },
  581. success: (res) => {
  582. setTimeout(() => {
  583. console.log(JSON.parse(res.data).url)
  584. resolve(JSON.parse(res.data).url)
  585. }, 1000)
  586. }
  587. });
  588. })
  589. }
  590. }
  591. }
  592. </script>
  593. <style lang="scss">
  594. page{
  595. background: #f1f6fc;
  596. }
  597. </style>
  598. <style scoped lang="scss">
  599. .content{
  600. position: relative;
  601. .main{
  602. .cont{
  603. padding: 0rpx 0rpx 160rpx;
  604. .title-box{
  605. margin: 15rpx;
  606. display: flex;
  607. flex-direction: row;
  608. align-items: center;
  609. justify-content: flex-start;
  610. .title{
  611. font-size: 32upx;
  612. font-family: PingFang SC;
  613. font-weight: bold;
  614. color: #111111;
  615. }
  616. .line{
  617. margin-right: 15rpx;
  618. height: 30rpx;
  619. width: 6rpx;
  620. background-color: #FF5C03;
  621. }
  622. }
  623. .form{
  624. border-radius: 15rpx;
  625. margin: 0rpx 15rpx;
  626. padding: 0rpx 30rpx;
  627. background-color: #fff;
  628. .option-box{
  629. padding: 15rpx;
  630. .option-item{
  631. .title{
  632. font-size: 32upx;
  633. font-family: PingFang SC;
  634. font-weight: bold;
  635. color: #111111;
  636. }
  637. .options{
  638. }
  639. }
  640. }
  641. }
  642. }
  643. .chose-patient{
  644. margin: 15rpx;
  645. padding: 30rpx 40rpx;
  646. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  647. background-color: #fff;
  648. border-radius: 15rpx;
  649. .title-box{
  650. display: flex;
  651. align-items: center;
  652. justify-content: space-between;
  653. .title{
  654. font-size: 32upx;
  655. font-family: PingFang SC;
  656. font-weight: bold;
  657. color: #111111;
  658. }
  659. .right{
  660. height: 100%;
  661. display: flex;
  662. align-items: center;
  663. justify-content: center;
  664. .value{
  665. font-size: 28upx;
  666. font-family: PingFang SC;
  667. color: #999;
  668. margin-right: 10rpx;
  669. }
  670. image{
  671. width: 15upx;
  672. height: 30upx;
  673. }
  674. }
  675. }
  676. .patient{
  677. display: flex;
  678. align-items: center;
  679. justify-content: space-between;
  680. height: 110upx;
  681. .left{
  682. .name{
  683. font-size: 30upx;
  684. line-height: 1;
  685. font-family: PingFang SC;
  686. font-weight: bold;
  687. color: #111111;
  688. }
  689. .info{
  690. margin-top: 30rpx;
  691. display: flex;
  692. align-items: center;
  693. .text{
  694. font-size: 26upx;
  695. font-family: PingFang SC;
  696. line-height: 1;
  697. font-weight: 500;
  698. color: #999;
  699. margin-right: 19upx;
  700. }
  701. }
  702. }
  703. .right{
  704. display: flex;
  705. align-items: center;
  706. image{
  707. width: 15upx;
  708. height: 30upx;
  709. }
  710. }
  711. }
  712. }
  713. }
  714. .btn-box{
  715. height: 140upx;
  716. z-index: 9999;
  717. width: 100%;
  718. padding: 0rpx 30upx;
  719. position: fixed;
  720. bottom: 0;
  721. left: 0;
  722. box-sizing: border-box;
  723. background-color: #ffffff;
  724. display: flex;
  725. align-items: center;
  726. justify-content: center;
  727. .btn{
  728. width: 100%;
  729. height: 88upx;
  730. line-height: 88upx;
  731. text-align: center;
  732. font-size: 34upx;
  733. font-family: PingFang SC;
  734. font-weight: 400;
  735. color: #FFFFFF;
  736. background: #FF5C03;
  737. border-radius: 10upx;
  738. }
  739. }
  740. }
  741. .form-item{
  742. display: flex;
  743. align-items: center;
  744. justify-content: flex-start;
  745. .icon{
  746. min-width: 30rpx;
  747. margin-right: 15rpx;
  748. width: 30rpx;
  749. height:30rpx;
  750. }
  751. }
  752. </style>