registerDoctor.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  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="#C39A58"
  27. :customStyle="{marginRight: '8px'}"
  28. key="1"
  29. label="男"
  30. name="1"
  31. >
  32. </u-radio>
  33. <u-radio
  34. activeColor="#C39A58"
  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="#2BC7B9"
  168. :customStyle="{marginRight: '8px'}"
  169. :key="1"
  170. label="同意"
  171. :name="1"
  172. >
  173. </u-checkbox>
  174. </u-checkbox-group>
  175. <text class="text" @click="openContent('doctorRegister')" >《医生注册协议》</text>
  176. <text class="text" @click="openContent('doctorFiling')" >《医生多机构备案协议》</text>
  177. </view>
  178. <u-picker ref="cityPicker" @cancel="cityShow = false" keyName="n" @confirm="citySelect" @change="cityChangeHandler" :show="cityShow" :columns="citys"></u-picker>
  179. <u-picker ref="deptPicker" @cancel="deptShow = false" keyName="deptName" @confirm="deptSelect" :show="deptShow" :columns="depts"></u-picker>
  180. <u-picker @cancel="hospitalShow = false" keyName="hospitalName" @confirm="hospitalSelect" :show="hospitalShow" :columns="hospitals"></u-picker>
  181. <u-picker ref="positionPicker" @cancel="positionShow = false" keyName="dictLabel" @confirm="positionSelect" :show="positionShow" :columns="positions"></u-picker>
  182. </view>
  183. <view class="btn-box">
  184. <view class="sub-btn" @click="submit()">提交</view>
  185. </view>
  186. </view>
  187. </view>
  188. </template>
  189. <script>
  190. import {getDictByKey,getHospitalList,getDepartmentList,sendSmsCode,uploadOSS,getCitys} from '@/api/common.js'
  191. import {registerDoctor} from '@/api/user.js'
  192. export default {
  193. data() {
  194. return {
  195. cityIndex1:0,
  196. cityIndex2:0,
  197. allCitys:[],
  198. citys:[[],[],[]],
  199. cityShow:false,
  200. depts:[[]],
  201. deptShow:false,
  202. hospitals:[[]],
  203. hospitalShow:false,
  204. positions:[[]],
  205. positionShow:false,
  206. fileList1:[],
  207. fileList2:[],
  208. fileList3:[],
  209. fileList4:[],
  210. checked:0,
  211. form:{
  212. sex:"1",
  213. },
  214. rules: {
  215. doctorName: [
  216. {
  217. required: true,
  218. message: '请输入医生姓名',
  219. }
  220. ],
  221. idCard: [
  222. {
  223. required: true,
  224. message: '请输入身份证号',
  225. // 可以单个或者同时写两个触发验证方式
  226. trigger: ['change','blur'],
  227. }
  228. ],
  229. deptId: [
  230. {
  231. required: true,
  232. message: '请选择部门'
  233. }
  234. ],
  235. hospitalId: [
  236. {
  237. required: true,
  238. message: '请选择医院'
  239. }
  240. ],
  241. position: [
  242. {
  243. required: true,
  244. message: '请选择职务',
  245. }
  246. ],
  247. cityIds: [
  248. {
  249. required: true,
  250. message: '请选择所在城市',
  251. }
  252. ],
  253. account: [
  254. {
  255. required: true,
  256. message: '请输入帐号',
  257. }
  258. ],
  259. password: [
  260. {
  261. required: true,
  262. message: '请输入密码',
  263. }
  264. ],
  265. mobile: [
  266. {
  267. required: true,
  268. message: '请输入手机号',
  269. // 可以单个或者同时写两个触发验证方式
  270. trigger: ['change','blur'],
  271. }
  272. ]
  273. }
  274. }
  275. },
  276. onLoad(options) {
  277. this.form.doctorType=options.type;
  278. this.getCitys()
  279. this.getHospitalList();
  280. this.getDepartmentList();
  281. this.getDictByKey("sys_doc_position");
  282. },
  283. onShow() {
  284. },
  285. onReady() {
  286. this.$refs.uForm.setRules(this.rules);
  287. },
  288. methods: {
  289. hospitalSelect(e){
  290. this.form.hospitalId=this.hospitals[0][e.indexs[0]].hospitalId;
  291. this.form.hospitalName=this.hospitals[0][e.indexs[0]].hospitalName;
  292. this.hospitalShow=false;
  293. },
  294. deptSelect(e){
  295. console.log(e)
  296. this.form.deptId=this.depts[0][e.indexs[0]].deptId;
  297. this.form.deptName=this.depts[0][e.indexs[0]].deptName;
  298. this.deptShow=false;
  299. },
  300. positionSelect(e){
  301. console.log(e)
  302. this.form.position=this.positions[0][e.indexs[0]].dictLabel;
  303. this.positionShow=false;
  304. },
  305. getDictByKey(key){
  306. var data={key:key}
  307. getDictByKey(data).then(
  308. res => {
  309. if(res.code==200){
  310. this.positions[0]=res.data;
  311. }
  312. },
  313. err => {
  314. }
  315. );
  316. },
  317. openContent(type){
  318. uni.navigateTo({
  319. url:"agreement?type="+type
  320. })
  321. },
  322. cityChangeHandler(e) {
  323. const {
  324. columnIndex,
  325. index,
  326. // 微信小程序无法将picker实例传出来,只能通过ref操作
  327. picker = this.$refs.cityPicker
  328. } = e
  329. if(columnIndex==0){
  330. this.cityIndex1=index
  331. console.log(this.cityIndex1)
  332. //获取第二列数据
  333. var citys1 = this.allCitys[this.cityIndex1].c;
  334. console.log(citys1)
  335. picker.setColumnValues(1,citys1)
  336. this.cityIndex2=0
  337. var citys2 = this.allCitys[this.cityIndex1].c[this.cityIndex2].c;
  338. picker.setColumnValues(2,citys2)
  339. }
  340. if(columnIndex==1){
  341. this.cityIndex2=index
  342. //获取第三列数据
  343. var citys = this.allCitys[this.cityIndex1].c[this.cityIndex2].c;
  344. console.log(citys)
  345. picker.setColumnValues(2,citys)
  346. }
  347. },
  348. citySelect(e){
  349. console.log(e)
  350. this.form.cityName=e.value[0].n+">"+e.value[1].n+">"+e.value[2].n
  351. this.form.cityIds=e.value[0].v+","+e.value[1].v+","+e.value[2].v;
  352. this.cityShow=false;
  353. },
  354. getCitys(){
  355. var that=this;
  356. var data={}
  357. getCitys(data).then(
  358. res => {
  359. if(res.code==200){
  360. that.allCitys=res.data;
  361. that.citys=[[],[],[]];
  362. that.citys[0]=that.allCitys;
  363. that.citys[1]=that.allCitys[0].c;
  364. that.citys[2]=that.allCitys[0].c[0].c;
  365. console.log(that.citys)
  366. }
  367. },
  368. err => {
  369. }
  370. );
  371. },
  372. getHospitalList(){
  373. var that=this;
  374. var data={}
  375. getHospitalList(data).then(
  376. res => {
  377. if(res.code==200){
  378. that.hospitals[0]=res.data;
  379. console.log(111)
  380. console.log(that.hospitals)
  381. }
  382. },
  383. err => {
  384. }
  385. );
  386. },
  387. getDepartmentList(){
  388. var that=this;
  389. var data={}
  390. getDepartmentList(data).then(
  391. res => {
  392. if(res.code==200){
  393. that.depts[0]=res.data;
  394. }
  395. },
  396. err => {
  397. }
  398. );
  399. },
  400. deletePic(event) {
  401. this[`fileList${event.name}`].splice(event.index, 1)
  402. },
  403. async afterRead(event) {
  404. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  405. let lists = [].concat(event.file)
  406. let fileListLen = this[`fileList${event.name}`].length
  407. lists.map((item) => {
  408. this[`fileList${event.name}`].push({
  409. ...item,
  410. status: 'uploading',
  411. message: '上传中'
  412. })
  413. })
  414. for (let i = 0; i < lists.length; i++) {
  415. const result = await this.uploadFilePromise(lists[i].url)
  416. let item = this[`fileList${event.name}`][fileListLen]
  417. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  418. status: 'success',
  419. message: '',
  420. url: result
  421. }))
  422. fileListLen++
  423. }
  424. },
  425. uploadFilePromise(url) {
  426. return new Promise((resolve, reject) => {
  427. let a = uni.uploadFile({
  428. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS',
  429. filePath: url,
  430. name: 'file',
  431. formData: {
  432. user: 'test'
  433. },
  434. success: (res) => {
  435. setTimeout(() => {
  436. console.log(JSON.parse(res.data).url)
  437. resolve(JSON.parse(res.data).url)
  438. }, 1000)
  439. }
  440. });
  441. })
  442. },
  443. register(){
  444. registerDoctor(this.form).then(
  445. res => {
  446. console.log(res)
  447. if(res.code==200){
  448. uni.showToast({
  449. icon:'none',
  450. title:res.msg,
  451. });
  452. setTimeout(function() {
  453. uni.navigateBack({
  454. delta: 1
  455. })
  456. }, 2000);
  457. }else{
  458. uni.showToast({
  459. icon:'none',
  460. title: res.msg,
  461. });
  462. }
  463. },
  464. rej => {
  465. console.log(rej)
  466. }
  467. );
  468. },
  469. submit(){
  470. var that=this;
  471. if(this.fileList1.length>0){
  472. this.form.avatar=this.fileList1[0].url
  473. }
  474. if(this.fileList2.length>0){
  475. var images=[]
  476. that.fileList2.forEach(function(item) {
  477. images.push(item.url)
  478. });
  479. if(images.length!=2){
  480. uni.showToast({
  481. icon:'none',
  482. title:"请上传身份证号",
  483. });
  484. return
  485. return;
  486. }
  487. this.form.idCardFrontUrl=images[0];
  488. this.form.idCardBackUrl=images[1];
  489. }
  490. if(this.fileList3.length>0){
  491. var images=[]
  492. that.fileList3.forEach(function(item) {
  493. images.push(item.url)
  494. });
  495. this.form.certificateImages=images.toString();
  496. }
  497. if(this.fileList4.length>0){
  498. var images=[]
  499. that.fileList4.forEach(function(item) {
  500. images.push(item.url)
  501. });
  502. this.form.practiseImages=images.toString();
  503. }
  504. if(this.checked!=1){
  505. uni.showToast({
  506. icon:'none',
  507. title:"请同意协议",
  508. });
  509. return
  510. }
  511. console.log(this.form)
  512. this.$refs.uForm.validate().then(res => {
  513. that.register()
  514. }).catch(errors => {
  515. console.log(errors)
  516. })
  517. },
  518. }
  519. }
  520. </script>
  521. <style scoped lang="scss">
  522. .content{
  523. display: flex;
  524. flex-direction: column;
  525. justify-content: flex-start;
  526. .inner{
  527. padding: 20upx 20rpx 120rpx;
  528. .bg{
  529. width: 100%;
  530. height: 300rpx;
  531. position: relative;
  532. display: flex;
  533. flex-direction: column;
  534. justify-content: center;
  535. align-items: flex-start;
  536. image{
  537. position: absolute;
  538. border-radius: 30rpx 30rpx 0rpx 0rpx;
  539. width: 100%;
  540. height: 100%;
  541. }
  542. .title{
  543. z-index: 999;
  544. padding: 0rpx 30rpx;
  545. font-size: 40upx; font-family: PingFang SC; font-weight: bold; color: #FFFFFF;
  546. }
  547. .desc{
  548. z-index: 999;
  549. padding: 0rpx 30rpx;
  550. margin-top: 20rpx;
  551. font-size: 28upx;
  552. opacity: 0.5;
  553. font-family: PingFang SC;
  554. color: #FFFFFF;
  555. }
  556. }
  557. .my-form{
  558. z-index: 1;
  559. background-color: #FFFFFF;
  560. padding: 0 30upx;
  561. input{
  562. text-align: right;
  563. }
  564. }
  565. }
  566. .agree{
  567. padding: 10rpx 20rpx;
  568. display: flex;
  569. align-items: center;
  570. justify-content: flex-start;
  571. .label{
  572. font-size: 24rpx;
  573. }
  574. .text{
  575. margin-left: 10rpx;
  576. color: royalblue;
  577. font-size: 24rpx;
  578. }
  579. }
  580. .btn-box{
  581. z-index: 9999;
  582. width: 100%;
  583. position: fixed;
  584. bottom: 0;
  585. height: 120upx;
  586. padding: 0 30upx;
  587. display: flex;
  588. align-items: center;
  589. justify-content: center;
  590. background: #FFFFFF;
  591. .sub-btn{
  592. width: 100%;
  593. height: 88upx;
  594. line-height: 88upx;
  595. text-align: center;
  596. font-size: 30upx;
  597. font-family: PingFang SC;
  598. font-weight: bold;
  599. color: #FFFFFF;
  600. background: #C39A58;
  601. border-radius: 44upx;
  602. }
  603. }
  604. }
  605. </style>