patient.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <view class="content">
  3. <view class="content_box">
  4. <view class="row b-b">
  5. <text class="tit">姓名</text>
  6. <input class="input" type="text" v-model="name" placeholder="请输入姓名" placeholder-class="placeholder" />
  7. </view>
  8. <view class="row b-b" @tap="handleTap1('picker2')">
  9. <text class="tit">性别</text>
  10. <input class="input" type="text" disabled="disabled" v-model="gender" placeholder="请选择性别" placeholder-class="placeholder" />
  11. </view>
  12. <lb-picker ref="picker2" mode="selector" :list="genderList" @change="handleChange1" @confirm="handleConfirm1" @cancel="handleCancel"></lb-picker>
  13. <view class="row b-b">
  14. <text class="tit">联系方式</text>
  15. <input class="input" type="text" v-model="mobile" placeholder="请输入联系方式" placeholder-class="placeholder" />
  16. </view>
  17. <view class="row b-b" @tap="showPicker('region')">
  18. <text class="tit">省市区</text>
  19. <input class="input" disabled="disabled" v-model="addr" />
  20. </view>
  21. <view class="row b-b" @tap="Toshow">
  22. <text class="tit">医院名称</text>
  23. <input class="input" type="text" disabled="disabled" v-model="hospital" placeholder="请选择医院名称" placeholder-class="placeholder" />
  24. </view>
  25. <zhilin-picker
  26. v-model="show"
  27. :title="title"
  28. :data="list"
  29. :initSelected="initSelected"
  30. :showSearch="true"
  31. @change="onChange"
  32. @searchInput="onSearchInput"
  33. @confirm="onConfirm1"
  34. />
  35. </view>
  36. <view class="add-btn" @click="confirm">修改资料</view>
  37. <w-picker mode="region" :value="defaultRegion" default-type="value" @confirm="onConfirm($event, 'region')" @cancel="handleCancel" ref="region"></w-picker>
  38. </view>
  39. </template>
  40. <script>
  41. import { mapState, mapMutations } from 'vuex';
  42. import uniList from '@/components/uni-list/uni-list.vue';
  43. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  44. import wPicker from '@/components/w-picker/w-picker.vue';
  45. import LbPicker from '@/components/lb-picker/index.vue';
  46. import { upload, getHospitalList, setPatient } from '@/api/index.js';
  47. import zhilinPicker from '@/components/zhilin-picker/zhilin-picker.vue';
  48. import { getUserInfo } from '@/api/login.js';
  49. export default {
  50. components: {
  51. uniList,
  52. uniListItem,
  53. wPicker,
  54. LbPicker,
  55. zhilinPicker
  56. },
  57. data() {
  58. return {
  59. result: {
  60. result: ''
  61. },
  62. defaultRegion: [],
  63. defaultRegion1: [],
  64. options: [],
  65. ext_info: [], //病人信息
  66. region: '',
  67. checked: '',
  68. name: '', //姓名
  69. gender: '', //性别
  70. gender_id: '', //性别id
  71. genderList: [
  72. {
  73. id: 1,
  74. name: '男'
  75. },
  76. {
  77. id: 2,
  78. name: '女'
  79. },
  80. {
  81. id: 0,
  82. name: '其他'
  83. }
  84. ],
  85. mobile: '', //联系方式
  86. addr: '', //省市区
  87. code: '', //省市区行政编码
  88. province: '',
  89. province_id: '',
  90. city: '',
  91. city_id: '',
  92. district: '',
  93. district_id: '',
  94. list: [], //医院列表
  95. show: false,
  96. initSelected: [],
  97. title: '选择医院',
  98. hospital: '', //医院
  99. hospital_id: '', //医院id
  100. searchVal: ''
  101. };
  102. },
  103. onShow() {
  104. let obj = this;
  105. obj.ext_info = obj.userInfo.ext_info;
  106. console.log(obj.ext_info);
  107. obj.province = obj.ext_info.province;
  108. obj.city = obj.ext_info.city;
  109. obj.district = obj.ext_info.district;
  110. obj.province_id = obj.ext_info.province_id;
  111. obj.city_id = obj.ext_info.city_id;
  112. obj.district_id = obj.ext_info.district_id;
  113. obj.addr = obj.province + obj.city + obj.district;
  114. obj.name = obj.ext_info.name;
  115. obj.gender_id = obj.ext_info.gender;
  116. if (obj.ext_info.gender == 1) {
  117. obj.gender = '男';
  118. }
  119. if (obj.ext_info.gender == 2) {
  120. obj.gender = '女';
  121. }
  122. if (obj.ext_info.gender == 0) {
  123. obj.gender = '其他';
  124. }
  125. obj.mobile = obj.ext_info.mobile;
  126. obj.hospital = obj.ext_info.hospital_name;
  127. obj.hospital_id = obj.ext_info.hospital;
  128. obj.ListDate();
  129. },
  130. computed: {
  131. ...mapState(['userInfo'])
  132. },
  133. watch: {
  134. searchVal() {
  135. console.log(222);
  136. this.ListDate();
  137. }
  138. },
  139. methods: {
  140. ...mapMutations(['setUserInfo']),
  141. //选择身份后更新用户信息
  142. //提交
  143. confirm() {
  144. let obj = this;
  145. setPatient({
  146. name: obj.name,
  147. mobile: obj.mobile,
  148. province: obj.province,
  149. province_id: obj.province_id,
  150. city: obj.city,
  151. city_id: obj.city_id,
  152. district: obj.district,
  153. district_id: obj.district_id,
  154. hospital: obj.hospital_id,
  155. gender: obj.gender_id
  156. })
  157. .then(function(e) {
  158. //注册病人完成后更新用户信息
  159. obj.$api.msg(e.msg);
  160. obj.GetUser();
  161. setTimeout(function() {
  162. uni.switchTab({
  163. url: '/pages/user/user'
  164. });
  165. }, 500);
  166. })
  167. .catch(e => {
  168. console.log(e);
  169. });
  170. },
  171. GetUser() {
  172. let obj = this;
  173. getUserInfo({})
  174. .then(function(e) {
  175. obj.setUserInfo(e.data);
  176. })
  177. .catch(function(e) {
  178. console.log(e);
  179. });
  180. },
  181. showPicker(type) {
  182. this.$refs[type].show();
  183. },
  184. onConfirm(res, type) {
  185. let obj = this;
  186. obj.result = res;
  187. console.log(res, 'res');
  188. obj.addr = res.result;
  189. if (res.name) {
  190. obj.province = res.name[0];
  191. obj.city = res.name[1];
  192. obj.district = res.name[2];
  193. } else {
  194. obj.province = '北京市';
  195. obj.city = '北京市';
  196. obj.district = '东城区';
  197. }
  198. obj.province_id = res.value[0];
  199. obj.city_id = res.value[1];
  200. obj.district_id = res.value[2];
  201. obj.hospital = ''; //重置医院
  202. obj.ListDate();
  203. },
  204. //医院
  205. Toshow() {
  206. this.show = true;
  207. },
  208. onChange(val) {
  209. let obj = this;
  210. console.log(val, 'onChange');
  211. let arr = val.split(',');
  212. obj.hospital = arr[1];
  213. obj.hospital_id = arr[0];
  214. obj.city = arr[2];
  215. obj.city_id = arr[3];
  216. obj.district = arr[4];
  217. obj.district_id = arr[5];
  218. obj.province = arr[6];
  219. obj.province_id = arr[7];
  220. obj.addr = obj.province + obj.city + obj.district;
  221. console.log(obj.hospital, obj.hospital_id);
  222. console.log(obj.city, obj.city_id);
  223. console.log(obj.district, obj.district_id);
  224. console.log(obj.province, obj.province_id);
  225. },
  226. onConfirm1(val) {},
  227. onSearchInput(val) {
  228. console.log('val223', val);
  229. this.searchVal = val;
  230. },
  231. //选中机构
  232. ListDate() {
  233. let obj = this;
  234. let data = '';
  235. console.log(33, obj.searchVal);
  236. if (!obj.searchVal) {
  237. data = {
  238. keyword: '',
  239. province_id: obj.province_id,
  240. city_id: obj.city_id,
  241. district_id: obj.district_id,
  242. sort: 'id desc',
  243. page: 1,
  244. limit: 1500
  245. };
  246. } else {
  247. data = {
  248. keyword: obj.searchVal,
  249. sort: 'id desc',
  250. page: 1,
  251. limit: 1500
  252. };
  253. }
  254. getHospitalList(data)
  255. .then(e => {
  256. obj.list = e.data.list;
  257. })
  258. .catch(e => {
  259. console.log(e);
  260. });
  261. },
  262. handleCancel() {},
  263. //性别选择
  264. handleTap1(name) {
  265. this.$refs[name].show();
  266. },
  267. //性别选择
  268. handleChange1(item) {},
  269. //性别选择
  270. handleConfirm1(item) {
  271. let obj = this;
  272. obj.gender = item.item.name;
  273. obj.gender_id = item.item.id;
  274. }
  275. }
  276. };
  277. </script>
  278. <style lang="scss">
  279. page {
  280. background: $page-color-base;
  281. height: 100%;
  282. .content {
  283. height: 100%;
  284. padding-top: 25rpx;
  285. }
  286. }
  287. .content_box {
  288. background-color: #ffffff;
  289. width: 92%;
  290. border-radius: 15rpx;
  291. margin: 0rpx auto;
  292. .examine_list {
  293. width: 100%;
  294. border-bottom: 2rpx solid #f0f0f0;
  295. .textarea-box {
  296. width: 95%;
  297. margin: 25rpx auto;
  298. .textarea {
  299. width: 100%;
  300. font-size: 28rpx;
  301. min-height: 150rpx;
  302. }
  303. }
  304. }
  305. }
  306. .row {
  307. display: flex;
  308. align-items: center;
  309. // position: relative;
  310. padding: 0 30rpx;
  311. height: 110rpx;
  312. background: #fff;
  313. border-bottom: 1rpx solid #f8f6f6;
  314. .tit {
  315. flex-shrink: 0;
  316. width: 180rpx;
  317. font-size: 30rpx;
  318. color: $font-color-dark;
  319. }
  320. .input {
  321. flex: 1;
  322. font-size: 30rpx;
  323. color: $font-color-dark;
  324. }
  325. .iconlocation {
  326. font-size: 36rpx;
  327. color: $font-color-light;
  328. }
  329. }
  330. .examine_name {
  331. color: #171717;
  332. font-size: 28rpx;
  333. padding: 25rpx 25rpx;
  334. }
  335. .examine_img {
  336. width: 100%;
  337. text-align: center;
  338. padding-bottom: 25rpx;
  339. }
  340. .examine_img image {
  341. width: 200rpx;
  342. height: 200rpx;
  343. }
  344. .default-row {
  345. margin-top: 16rpx;
  346. .tit {
  347. flex: 1;
  348. }
  349. switch {
  350. transform: translateX(16rpx) scale(0.9);
  351. }
  352. }
  353. .add-btn {
  354. position: fixed;
  355. bottom: 0rpx;
  356. width: 100%;
  357. height: 100rpx;
  358. font-size: $font-lg;
  359. color: #fff;
  360. background-color: #6786fb;
  361. line-height: 100rpx;
  362. text-align: center;
  363. }
  364. .img_box {
  365. padding: 35rpx 35rpx;
  366. width: 250rpx;
  367. height: 250rpx;
  368. }
  369. .img_box image {
  370. width: 100%;
  371. height: 100%;
  372. }
  373. .alert-box {
  374. background-color: #ffffff;
  375. }
  376. .b-b:after {
  377. position: relative !important;
  378. }
  379. .check_box {
  380. padding: 25rpx 25rpx;
  381. font-size: 20rpx;
  382. padding-bottom: 150rpx;
  383. text {
  384. color: #6786fb;
  385. }
  386. }
  387. </style>