add_archives.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <view class="main">
  3. <form>
  4. <view class="cu-form-group margin-top">
  5. <view class="title">头像</view>
  6. <image class="cu-avatar radius bg-gray" @click="ChooseImage" :src='imgList[0]' mode='aspectFill'>
  7. </image>
  8. </view>
  9. <view class="cu-form-group">
  10. <view class="title">就诊人姓名:</view>
  11. <input v-model="name" placeholder-style="text-align:right" placeholder="请输入姓名"></input>
  12. </view>
  13. <view class="cu-form-group">
  14. <view class="title">就诊人性别:</view>
  15. <u-radio-group v-model="value" @change="radioGroupChange">
  16. <u-radio v-for="(item, index) in list" :key="index" :name="item.name" :disabled="item.disabled">
  17. {{item.name}}
  18. </u-radio>
  19. </u-radio-group>
  20. </view>
  21. <view class="cu-form-group">
  22. <view class="title">出身年月:</view>
  23. <picker mode="date" :value="date" @change="bindDateChange">
  24. <view class="picker">
  25. {{date}}
  26. </view>
  27. </picker>
  28. </view>
  29. <view class="cu-form-group" @click="show=!show">
  30. <view class="title">与就诊人关系:</view>
  31. <picker :value="guanxi" @change="confirm" :range="guanxilist" range-key="label">
  32. <view class="picker">
  33. {{guanxi}}
  34. </view>
  35. </picker>
  36. </view>
  37. <view class="cu-form-group margin-top">
  38. <view class="title">就诊信息(非必填)</view>
  39. </view>
  40. <view class="cu-form-group">
  41. <view class="title">就诊人身份证:</view>
  42. <input v-model="idcrad" placeholder-style="text-align:right" placeholder="请输入就诊人身份证号"></input>
  43. </view>
  44. <view class="padding-sm bg-white" style="color: #C0C0C0;">
  45. 注:就诊人信息用于平台审核和医疗业务使用,不会外传。请正却确填写就诊人信息,如需修改身份信息可电话联系客服修改(13330431369)
  46. </view>
  47. </form>
  48. <view class="cu-bar bg-white tabbar" style="position: fixed;bottom: 0;width: 100%;">
  49. <view class="submit" style="background-color: #0B73B9;color: white;" @click="addarchives">
  50. 提交
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. onLoad(options) {
  58. },
  59. onShow() {
  60. },
  61. data() {
  62. return {
  63. imgList: '',
  64. name: "",
  65. list: [{
  66. name: '男',
  67. disabled: false
  68. },
  69. {
  70. name: '女',
  71. disabled: false
  72. },
  73. ],
  74. value: '男',
  75. date: "请选择出生日期",
  76. show: false,
  77. guanxi: "请选择",
  78. guanxiindex: -1,
  79. guanxilist: [{
  80. value: '1',
  81. label: '父亲'
  82. },
  83. {
  84. value: '2',
  85. label: '母亲'
  86. },
  87. {
  88. value: '3',
  89. label: '祖父'
  90. },
  91. {
  92. value: '4',
  93. label: '祖母'
  94. },
  95. {
  96. value: '5',
  97. label: '外祖父'
  98. },
  99. {
  100. value: '6',
  101. label: '外祖母'
  102. },
  103. {
  104. value: '7',
  105. label: '叔侄'
  106. }
  107. ],
  108. idcrad: "",
  109. touxiang: ""
  110. }
  111. },
  112. methods: {
  113. ChooseImage() {
  114. uni.chooseImage({
  115. count: 1, //默认9
  116. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  117. sourceType: ['album', 'camera'], //从相册选择
  118. success: (res) => {
  119. this.imgList = res.tempFilePaths
  120. this.$request.upload("/api/v1/common/uploadFile", this.imgList[0]).then(data => {
  121. let re = JSON.parse(data)
  122. if (re.status == 0) {
  123. this.touxiang = re.data.url
  124. console.log(this.touxiang)
  125. }
  126. })
  127. }
  128. });
  129. },
  130. // 选中任一radio时,由radio-group触发
  131. radioGroupChange(e) {
  132. this.value = e
  133. },
  134. bindDateChange({
  135. detail
  136. }) {
  137. this.date = detail.value
  138. },
  139. confirm(e) {
  140. this.guanxiindex = e.detail.value
  141. this.guanxi = this.guanxilist[e.detail.value].label
  142. },
  143. addarchives: async function() {
  144. let num = 0
  145. if (this.value == "男") {
  146. num = 1
  147. } else {
  148. num = 2
  149. }
  150. if (this.imgList[0] !== undefined && this.name != "" && this.date != "请选择出生日期" && this.guanxiindex != -1) {
  151. let res = await this.$request.post("/api/v1/patient/createPatient", {
  152. name: this.name,
  153. sex: num,
  154. avatar: this.touxiang,
  155. birthday: this.date,
  156. relationship_type: this.guanxiindex,
  157. card_type: 1,
  158. card_number: this.idcrad
  159. })
  160. console.log(res)
  161. if (res.status == 0) {
  162. uni.showToast({
  163. title: "提交成功",
  164. icon: "none",
  165. duration: 1500
  166. })
  167. setTimeout(() => {
  168. uni.navigateBack({
  169. delta: 1
  170. })
  171. }, 1500)
  172. }
  173. } else {
  174. uni.showToast({
  175. title: "请填写完整",
  176. icon: "none"
  177. })
  178. }
  179. }
  180. }
  181. };
  182. </script>
  183. <style scoped lang="scss">
  184. .main {}
  185. </style>