add_archives.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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" 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" :end="time" @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" 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" v-if="info==''" 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 class="cu-bar bg-white tabbar" v-else style="position: fixed;bottom: 0;width: 100%;">
  54. <view class="submit" style="background-color: #0B73B9;color: white;" @click="editarchives">
  55. 修改
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. onLoad(options) {
  63. let date = new Date();
  64. let nian = date.getFullYear()
  65. let yue = date.getMonth() + 1
  66. let ri = date.getDate() >= 10 ? date.getDate() : '0' + date.getDate()
  67. this.time = nian + "-" + yue + "-" + ri
  68. if (options.info) {
  69. this.info = JSON.parse(options.info)
  70. }
  71. if (this.info != "") {
  72. uni.setNavigationBarTitle({
  73. title: "修改档案"
  74. })
  75. this.name = this.info.name
  76. this.imgList = [this.info.avatar]
  77. this.date = this.info.birthday
  78. this.value = this.list[this.info.sex - 1].name
  79. this.guanxi = this.guanxilist[this.info.relationship_type].label
  80. this.idcrad = this.info.card_number
  81. }
  82. },
  83. onShow() {
  84. },
  85. data() {
  86. return {
  87. imgList: '',
  88. name: "",
  89. list: [{
  90. name: '男',
  91. disabled: false
  92. },
  93. {
  94. name: '女',
  95. disabled: false
  96. },
  97. ],
  98. value: '男',
  99. date: "请选择出生日期",
  100. show: false,
  101. guanxi: "请选择",
  102. guanxiindex: -1,
  103. guanxilist: [{
  104. value: '1',
  105. label: '父亲'
  106. },
  107. {
  108. value: '2',
  109. label: '母亲'
  110. },
  111. {
  112. value: '3',
  113. label: '祖父'
  114. },
  115. {
  116. value: '4',
  117. label: '祖母'
  118. },
  119. {
  120. value: '5',
  121. label: '外祖父'
  122. },
  123. {
  124. value: '6',
  125. label: '外祖母'
  126. },
  127. {
  128. value: '7',
  129. label: '叔侄'
  130. },
  131. {
  132. value: '8',
  133. label: '其他'
  134. }
  135. ],
  136. idcrad: "",
  137. touxiang: "",
  138. time: "",
  139. info: ""
  140. }
  141. },
  142. methods: {
  143. ChooseImage() {
  144. uni.chooseImage({
  145. count: 1, //默认9
  146. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  147. sourceType: ['album', 'camera'], //从相册选择
  148. success: (res) => {
  149. this.imgList = res.tempFilePaths
  150. this.$request.upload("/api/v1/common/uploadFile", this.imgList[0]).then(data => {
  151. let re = JSON.parse(data)
  152. if (re.status == 0) {
  153. this.touxiang = re.data.url
  154. console.log(this.touxiang)
  155. }
  156. })
  157. }
  158. });
  159. },
  160. // 选中任一radio时,由radio-group触发
  161. radioGroupChange(e) {
  162. this.value = e
  163. },
  164. bindDateChange({
  165. detail
  166. }) {
  167. this.date = detail.value
  168. },
  169. confirm(e) {
  170. this.guanxiindex = e.detail.value
  171. this.guanxi = this.guanxilist[e.detail.value].label
  172. },
  173. addarchives: async function() {
  174. let num = 0
  175. if (this.value == "男") {
  176. num = 1
  177. } else {
  178. num = 2
  179. }
  180. if (this.imgList[0] == undefined) {
  181. uni.showToast({
  182. title: "请上传头像",
  183. icon: "none"
  184. })
  185. return false
  186. }
  187. if (this.name == "") {
  188. uni.showToast({
  189. title: "请填写名称",
  190. icon: "none"
  191. })
  192. return false
  193. }
  194. if (this.date == "请选择出生日期") {
  195. uni.showToast({
  196. title: "请填写日期",
  197. icon: "none"
  198. })
  199. return false
  200. }
  201. if (this.guanxiindex == -1) {
  202. uni.showToast({
  203. title: "请选择被保人关系",
  204. icon: "none"
  205. })
  206. return false
  207. }
  208. let res = await this.$request.post("/api/v1/patient/createPatient", {
  209. name: this.name,
  210. sex: num,
  211. avatar: this.touxiang,
  212. birthday: this.date,
  213. relationship_type: this.guanxiindex,
  214. card_type: 1,
  215. card_number: this.idcrad
  216. })
  217. if (res.status == 0) {
  218. uni.showToast({
  219. title: "提交成功",
  220. icon: "none",
  221. duration: 1500
  222. })
  223. setTimeout(() => {
  224. uni.navigateBack({
  225. delta: 1
  226. })
  227. }, 1500)
  228. }
  229. },
  230. editarchives: async function() {
  231. let num = 0
  232. if (this.value == "男") {
  233. num = 1
  234. } else {
  235. num = 2
  236. }
  237. if (this.imgList[0] == undefined) {
  238. uni.showToast({
  239. title: "请上传头像",
  240. icon: "none"
  241. })
  242. return false
  243. }
  244. if (this.name == "") {
  245. uni.showToast({
  246. title: "请填写名称",
  247. icon: "none"
  248. })
  249. return false
  250. }
  251. if (this.date == "请选择出生日期") {
  252. uni.showToast({
  253. title: "请填写日期",
  254. icon: "none"
  255. })
  256. return false
  257. }
  258. if (this.guanxiindex == -1) {
  259. uni.showToast({
  260. title: "请选择被保人关系",
  261. icon: "none"
  262. })
  263. return false
  264. }
  265. let res = await this.$request.post("/api/v1/patient/updatePatient", {
  266. id: this.info.id,
  267. name: this.name,
  268. sex: num,
  269. avatar: this.touxiang,
  270. birthday: this.date,
  271. relationship_type: this.guanxiindex,
  272. card_type: 1,
  273. card_number: this.idcrad
  274. })
  275. if (res.status == 0) {
  276. uni.showToast({
  277. title: "修改成功",
  278. icon: "none",
  279. duration: 1500
  280. })
  281. setTimeout(() => {
  282. uni.navigateBack({
  283. delta: 1
  284. })
  285. }, 1500)
  286. }
  287. }
  288. }
  289. };
  290. </script>
  291. <style scoped lang="scss">
  292. .main {}
  293. </style>