registerDoctor.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. <template>
  2. <view class="content">
  3. <view class="content">
  4. <view class="inner">
  5. <view class="bg">
  6. <image src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/74645f3b57bc45b08b35e2449fdf90c7.jpg"></image>
  7. <view v-if="form.doctorType==1" class="title">医生注册</view>
  8. <view v-if="form.doctorType==1" class="desc">请填写医生资料</view>
  9. <view v-if="form.doctorType==2" class="title">药师注册</view>
  10. <view v-if="form.doctorType==2" class="desc">请填写药师资料</view>
  11. </view>
  12. <view class="my-form" >
  13. <u-form :rules="rules" :model="form" ref="uForm" labelPosition="left">
  14. <u-form-item labelWidth="180rpx" borderBottom label="真实姓名" prop="doctorName">
  15. <u-input border="none" placeholder="请输入真实姓名" v-model="form.doctorName" />
  16. </u-form-item>
  17. <u-form-item labelWidth="180rpx" borderBottom label="身份证号" prop="idCard">
  18. <u-input border="none" placeholder="请输入身份证号" v-model="form.idCard" />
  19. </u-form-item>
  20. <u-form-item labelWidth="180rpx" borderBottom label="性别" prop="sex">
  21. <u-radio-group
  22. placement="row"
  23. v-model="form.sex"
  24. >
  25. <u-radio
  26. activeColor="#FF5C03"
  27. :customStyle="{marginRight: '8px'}"
  28. key="1"
  29. label="男"
  30. name="1"
  31. >
  32. </u-radio>
  33. <u-radio
  34. activeColor="#FF5C03"
  35. key="2"
  36. label="女"
  37. name="2"
  38. >
  39. </u-radio>
  40. </u-radio-group>
  41. </u-form-item>
  42. <u-form-item labelWidth="180rpx" prop="cityId" @click="cityShow=true" borderBottom label="所在城市">
  43. <u-input
  44. v-model="form.cityName"
  45. disabled
  46. disabledColor="#ffffff"
  47. placeholder="请选择所在城市"
  48. border="none"
  49. ></u-input>
  50. <template #right>
  51. <u-icon
  52. name="arrow-right"
  53. ></u-icon>
  54. </template>
  55. </u-form-item>
  56. <u-form-item labelWidth="180rpx" prop="hospitalId" @click="hospitalShow=true" borderBottom label="就职医院">
  57. <u-input
  58. v-model="form.hospitalName"
  59. disabled
  60. disabledColor="#ffffff"
  61. placeholder="请选择医院"
  62. border="none"
  63. ></u-input>
  64. <template #right>
  65. <u-icon
  66. name="arrow-right"
  67. ></u-icon>
  68. </template>
  69. </u-form-item>
  70. <u-form-item labelWidth="180rpx" prop="deptId" @click="deptShow=true" borderBottom label="所属科室">
  71. <u-input
  72. v-model="form.deptName"
  73. disabled
  74. disabledColor="#ffffff"
  75. placeholder="请选择科室"
  76. border="none"
  77. ></u-input>
  78. <template #right>
  79. <u-icon
  80. name="arrow-right"
  81. ></u-icon>
  82. </template>
  83. </u-form-item>
  84. <u-form-item labelWidth="180rpx" prop="position" @click="positionShow=true" borderBottom label="职称">
  85. <u-input
  86. v-model="form.position"
  87. disabled
  88. disabledColor="#ffffff"
  89. placeholder="请选择职称"
  90. border="none"
  91. ></u-input>
  92. <template #right>
  93. <u-icon
  94. name="arrow-right"
  95. ></u-icon>
  96. </template>
  97. </u-form-item>
  98. <u-form-item labelWidth="180rpx" borderBottom label="擅长领域" prop="speciality">
  99. <u--textarea v-model="form.speciality" placeholder="请输入擅长领域" count ></u--textarea>
  100. </u-form-item>
  101. <u-form-item labelWidth="180rpx" borderBottom label="个人简介" prop="introduction">
  102. <u--textarea v-model="form.introduction" placeholder="请输入个人简介" count ></u--textarea>
  103. </u-form-item>
  104. <u-form-item labelWidth="180rpx" borderBottom label="医生照片" prop="avatar">
  105. <u-upload
  106. :fileList="fileList1"
  107. @afterRead="afterRead"
  108. @delete="deletePic"
  109. name="1"
  110. multiple
  111. :maxCount="1"
  112. >
  113. </u-upload>
  114. </u-form-item>
  115. <u-form-item labelWidth="180rpx" borderBottom label="身份证照片(正反面)" prop="idCardFrontUrl">
  116. <u-upload
  117. :fileList="fileList2"
  118. @afterRead="afterRead"
  119. @delete="deletePic"
  120. name="2"
  121. multiple
  122. :maxCount="2"
  123. >
  124. </u-upload>
  125. </u-form-item>
  126. <u-form-item labelWidth="180rpx" borderBottom label="资质证编号" prop="certificateCode">
  127. <u-input border="none" placeholder="请输入资质证编号" v-model="form.certificateCode" />
  128. </u-form-item>
  129. <u-form-item labelWidth="180rpx" borderBottom label="资质证书" prop="certificateImages">
  130. <u-upload
  131. :fileList="fileList3"
  132. @afterRead="afterRead"
  133. @delete="deletePic"
  134. name="3"
  135. :maxCount="3"
  136. ></u-upload>
  137. </u-form-item>
  138. <u-form-item labelWidth="180rpx" borderBottom label="执业证编号" prop="practiseCode">
  139. <u-input border="none" placeholder="请输入执业证编号" v-model="form.practiseCode" />
  140. </u-form-item>
  141. <u-form-item labelWidth="180rpx" borderBottom label="执业证书" prop="certificateImages">
  142. <u-upload
  143. :fileList="fileList4"
  144. @afterRead="afterRead"
  145. @delete="deletePic"
  146. name="4"
  147. :maxCount="3"
  148. ></u-upload>
  149. </u-form-item>
  150. <u-form-item labelWidth="180rpx" borderBottom label="联系电话" prop="mobile">
  151. <u-input border="none" placeholder="请输入联系电话" v-model="form.mobile" />
  152. </u-form-item>
  153. <u-form-item labelWidth="180rpx" borderBottom label="登录帐号" prop="account">
  154. <u-input border="none" placeholder="请输入登录帐号" v-model="form.account" />
  155. </u-form-item>
  156. <u-form-item labelWidth="180rpx" label="登录密码" prop="password">
  157. <u-input border="none" type="password" placeholder="请输入登录密码" v-model="form.password" />
  158. </u-form-item>
  159. </u-form>
  160. </view>
  161. <view class="agree">
  162. <u-checkbox-group
  163. v-model="checked"
  164. placement="column"
  165. >
  166. <u-checkbox
  167. activeColor="#FF5C03"
  168. :customStyle="{marginRight: '8px'}"
  169. :key="1"
  170. label="同意"
  171. :name="1"
  172. >
  173. </u-checkbox>
  174. </u-checkbox-group>
  175. <text class="text" v-if="form.doctorType==1" @click="openContent('doctorRegister')" >《医生注册协议》</text>
  176. <text class="text" v-if="form.doctorType==1" @click="openContent('doctorFiling')" >《医生多机构备案协议》</text>
  177. <text class="text" v-if="form.doctorType==2" @click="openContent('pharmacistNoticePolicy')" >《药师入驻协议》</text>
  178. </view>
  179. <u-picker ref="cityPicker" @cancel="cityShow = false" keyName="n" @confirm="citySelect" @change="cityChangeHandler" :show="cityShow" :columns="citys"></u-picker>
  180. <u-picker ref="deptPicker" @cancel="deptShow = false" keyName="deptName" @confirm="deptSelect" :show="deptShow" :columns="depts"></u-picker>
  181. <u-picker @cancel="hospitalShow = false" keyName="hospitalName" @confirm="hospitalSelect" :show="hospitalShow" :columns="hospitals"></u-picker>
  182. <u-picker ref="positionPicker" @cancel="positionShow = false" keyName="dictLabel" @confirm="positionSelect" :show="positionShow" :columns="positions"></u-picker>
  183. </view>
  184. <view class="btn-box">
  185. <view class="sub-btn" @click="submit()">提交</view>
  186. </view>
  187. </view>
  188. </view>
  189. </template>
  190. <script>
  191. import {getDictByKey,getHospitalList,getDepartmentList,sendSmsCode,uploadOSS,getCitys} from '@/api/common.js'
  192. import {registerDoctor} from '@/api/user.js'
  193. export default {
  194. data() {
  195. return {
  196. cityIndex1:0,
  197. cityIndex2:0,
  198. allCitys:[],
  199. citys:[[],[],[]],
  200. cityShow:false,
  201. depts:[[]],
  202. deptShow:false,
  203. hospitals:[[]],
  204. hospitalShow:false,
  205. positions:[[]],
  206. positionShow:false,
  207. fileList1:[],
  208. fileList2:[],
  209. fileList3:[],
  210. fileList4:[],
  211. checked:0,
  212. form:{
  213. sex:"1",
  214. },
  215. rules: {
  216. doctorName: [
  217. {
  218. required: true,
  219. message: '请输入医生姓名',
  220. }
  221. ],
  222. idCard: [
  223. {
  224. required: true,
  225. message: '请输入身份证号',
  226. // 可以单个或者同时写两个触发验证方式
  227. trigger: ['change','blur'],
  228. }
  229. ],
  230. deptId: [
  231. {
  232. required: true,
  233. message: '请选择部门'
  234. }
  235. ],
  236. hospitalId: [
  237. {
  238. required: true,
  239. message: '请选择医院'
  240. }
  241. ],
  242. position: [
  243. {
  244. required: true,
  245. message: '请选择职务',
  246. }
  247. ],
  248. cityIds: [
  249. {
  250. required: true,
  251. message: '请选择所在城市',
  252. }
  253. ],
  254. account: [
  255. {
  256. required: true,
  257. message: '请输入帐号',
  258. }
  259. ],
  260. password: [
  261. {
  262. required: true,
  263. message: '请输入密码',
  264. }
  265. ],
  266. mobile: [
  267. {
  268. required: true,
  269. message: '请输入手机号',
  270. // 可以单个或者同时写两个触发验证方式
  271. trigger: ['change','blur'],
  272. }
  273. ]
  274. }
  275. }
  276. },
  277. onLoad(options) {
  278. this.form.doctorType=options.type;
  279. uni.setNavigationBarTitle({
  280. title: options.type==2?'药师注册':'医生注册'
  281. });
  282. this.getCitys()
  283. this.getHospitalList();
  284. this.getDepartmentList();
  285. this.getDictByKey("sys_doc_position");
  286. },
  287. onShow() {
  288. },
  289. onReady() {
  290. this.$refs.uForm.setRules(this.rules);
  291. },
  292. methods: {
  293. hospitalSelect(e){
  294. this.form.hospitalId=this.hospitals[0][e.indexs[0]].hospitalId;
  295. this.form.hospitalName=this.hospitals[0][e.indexs[0]].hospitalName;
  296. this.hospitalShow=false;
  297. },
  298. deptSelect(e){
  299. console.log(e)
  300. this.form.deptId=this.depts[0][e.indexs[0]].deptId;
  301. this.form.deptName=this.depts[0][e.indexs[0]].deptName;
  302. this.deptShow=false;
  303. },
  304. positionSelect(e){
  305. console.log(e)
  306. this.form.position=this.positions[0][e.indexs[0]].dictLabel;
  307. this.positionShow=false;
  308. },
  309. getDictByKey(key){
  310. var data={key:key}
  311. getDictByKey(data).then(
  312. res => {
  313. if(res.code==200){
  314. this.positions[0]=res.data;
  315. }
  316. },
  317. err => {
  318. }
  319. );
  320. },
  321. openContent(type){
  322. uni.navigateTo({
  323. url:"agreement?type="+type
  324. })
  325. },
  326. cityChangeHandler(e) {
  327. const {
  328. columnIndex,
  329. index,
  330. // 微信小程序无法将picker实例传出来,只能通过ref操作
  331. picker = this.$refs.cityPicker
  332. } = e
  333. if(columnIndex==0){
  334. this.cityIndex1=index
  335. console.log(this.cityIndex1)
  336. //获取第二列数据
  337. var citys1 = this.allCitys[this.cityIndex1].c;
  338. console.log(citys1)
  339. picker.setColumnValues(1,citys1)
  340. this.cityIndex2=0
  341. var citys2 = this.allCitys[this.cityIndex1].c[this.cityIndex2].c;
  342. picker.setColumnValues(2,citys2)
  343. }
  344. if(columnIndex==1){
  345. this.cityIndex2=index
  346. //获取第三列数据
  347. var citys = this.allCitys[this.cityIndex1].c[this.cityIndex2].c;
  348. console.log(citys)
  349. picker.setColumnValues(2,citys)
  350. }
  351. },
  352. citySelect(e){
  353. console.log(e)
  354. this.form.cityName=e.value[0].n+">"+e.value[1].n+">"+e.value[2].n
  355. this.form.cityIds=e.value[0].v+","+e.value[1].v+","+e.value[2].v;
  356. this.cityShow=false;
  357. },
  358. getCitys(){
  359. var that=this;
  360. var data={}
  361. getCitys(data).then(
  362. res => {
  363. if(res.code==200){
  364. that.allCitys=res.data;
  365. that.citys=[[],[],[]];
  366. that.citys[0]=that.allCitys;
  367. that.citys[1]=that.allCitys[0].c;
  368. that.citys[2]=that.allCitys[0].c[0].c;
  369. console.log(that.citys)
  370. }
  371. },
  372. err => {
  373. }
  374. );
  375. },
  376. getHospitalList(){
  377. var that=this;
  378. var data={}
  379. getHospitalList(data).then(
  380. res => {
  381. if(res.code==200){
  382. that.hospitals[0]=res.data;
  383. console.log(111)
  384. console.log(that.hospitals)
  385. }
  386. },
  387. err => {
  388. }
  389. );
  390. },
  391. getDepartmentList(){
  392. var that=this;
  393. var data={}
  394. getDepartmentList(data).then(
  395. res => {
  396. if(res.code==200){
  397. that.depts[0]=res.data;
  398. }
  399. },
  400. err => {
  401. }
  402. );
  403. },
  404. deletePic(event) {
  405. this[`fileList${event.name}`].splice(event.index, 1)
  406. },
  407. async afterRead(event) {
  408. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  409. let lists = [].concat(event.file)
  410. let fileListLen = this[`fileList${event.name}`].length
  411. lists.map((item) => {
  412. this[`fileList${event.name}`].push({
  413. ...item,
  414. status: 'uploading',
  415. message: '上传中'
  416. })
  417. })
  418. for (let i = 0; i < lists.length; i++) {
  419. const result = await this.uploadFilePromise(lists[i].url)
  420. let item = this[`fileList${event.name}`][fileListLen]
  421. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  422. status: 'success',
  423. message: '',
  424. url: result
  425. }))
  426. fileListLen++
  427. }
  428. },
  429. uploadFilePromise(url) {
  430. return new Promise((resolve, reject) => {
  431. let a = uni.uploadFile({
  432. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS',
  433. filePath: url,
  434. name: 'file',
  435. formData: {
  436. user: 'test'
  437. },
  438. success: (res) => {
  439. setTimeout(() => {
  440. console.log(JSON.parse(res.data).url)
  441. resolve(JSON.parse(res.data).url)
  442. }, 1000)
  443. }
  444. });
  445. })
  446. },
  447. register(){
  448. registerDoctor(this.form).then(
  449. res => {
  450. console.log(res)
  451. if(res.code==200){
  452. uni.showToast({
  453. icon:'none',
  454. title:res.msg,
  455. });
  456. setTimeout(function() {
  457. uni.navigateBack({
  458. delta: 1
  459. })
  460. }, 2000);
  461. }else{
  462. uni.showToast({
  463. icon:'none',
  464. title: res.msg,
  465. });
  466. }
  467. },
  468. rej => {
  469. console.log(rej)
  470. }
  471. );
  472. },
  473. submit(){
  474. var that=this;
  475. if(this.fileList1.length>0){
  476. this.form.avatar=this.fileList1[0].url
  477. }
  478. if(this.fileList2.length>0){
  479. var images=[]
  480. that.fileList2.forEach(function(item) {
  481. images.push(item.url)
  482. });
  483. if(images.length!=2){
  484. uni.showToast({
  485. icon:'none',
  486. title:"请上传身份证号",
  487. });
  488. return
  489. return;
  490. }
  491. this.form.idCardFrontUrl=images[0];
  492. this.form.idCardBackUrl=images[1];
  493. }
  494. if(this.fileList3.length>0){
  495. var images=[]
  496. that.fileList3.forEach(function(item) {
  497. images.push(item.url)
  498. });
  499. this.form.certificateImages=images.toString();
  500. }
  501. if(this.fileList4.length>0){
  502. var images=[]
  503. that.fileList4.forEach(function(item) {
  504. images.push(item.url)
  505. });
  506. this.form.practiseImages=images.toString();
  507. }
  508. if(this.checked!=1){
  509. uni.showToast({
  510. icon:'none',
  511. title:"请同意协议",
  512. });
  513. return
  514. }
  515. console.log(this.form)
  516. this.$refs.uForm.validate().then(res => {
  517. that.register()
  518. }).catch(errors => {
  519. console.log(errors)
  520. })
  521. },
  522. }
  523. }
  524. </script>
  525. <style scoped lang="scss">
  526. .content{
  527. display: flex;
  528. flex-direction: column;
  529. justify-content: flex-start;
  530. .inner{
  531. padding: 20upx 20rpx 120rpx;
  532. .bg{
  533. width: 100%;
  534. height: 300rpx;
  535. position: relative;
  536. display: flex;
  537. flex-direction: column;
  538. justify-content: center;
  539. align-items: flex-start;
  540. image{
  541. position: absolute;
  542. border-radius: 30rpx 30rpx 0rpx 0rpx;
  543. width: 100%;
  544. height: 100%;
  545. }
  546. .title{
  547. z-index: 999;
  548. padding: 0rpx 30rpx;
  549. font-size: 40upx; font-family: PingFang SC; font-weight: bold; color: #FFFFFF;
  550. }
  551. .desc{
  552. z-index: 999;
  553. padding: 0rpx 30rpx;
  554. margin-top: 20rpx;
  555. font-size: 28upx;
  556. opacity: 0.5;
  557. font-family: PingFang SC;
  558. color: #FFFFFF;
  559. }
  560. }
  561. .my-form{
  562. z-index: 1;
  563. background-color: #FFFFFF;
  564. padding: 0 30upx;
  565. input{
  566. text-align: right;
  567. }
  568. }
  569. }
  570. .agree{
  571. padding: 10rpx 20rpx;
  572. display: flex;
  573. align-items: center;
  574. justify-content: flex-start;
  575. .label{
  576. font-size: 24rpx;
  577. }
  578. .text{
  579. margin-left: 10rpx;
  580. color: royalblue;
  581. font-size: 24rpx;
  582. }
  583. }
  584. .btn-box{
  585. z-index: 9999;
  586. width: 100%;
  587. position: fixed;
  588. bottom: 0;
  589. height: 120upx;
  590. padding: 0 30upx;
  591. display: flex;
  592. align-items: center;
  593. justify-content: center;
  594. background: #FFFFFF;
  595. .sub-btn{
  596. width: 100%;
  597. height: 88upx;
  598. line-height: 88upx;
  599. text-align: center;
  600. font-size: 30upx;
  601. font-family: PingFang SC;
  602. font-weight: bold;
  603. color: #FFFFFF;
  604. background: #FF5C03;
  605. border-radius: 44upx;
  606. }
  607. }
  608. }
  609. </style>