add_archives.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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. <input v-model="jianhuname" placeholder-style="text-align:right" style="text-align: right;" placeholder="请输入监护人姓名"></input>
  16. </view>
  17. <view class="cu-form-group">
  18. <view class="title">联系电话:</view>
  19. <input type="number" v-model="phone" placeholder-style="text-align:right" style="text-align: right;" placeholder="请输入联系电话"></input>
  20. </view>
  21. <view class="cu-form-group">
  22. <view class="title">出生医院:</view>
  23. <input v-model="birthhospital" placeholder-style="text-align:right" style="text-align: right;" placeholder="请输入出生医院"></input>
  24. </view>
  25. <view class="cu-form-group">
  26. <view class="title">家庭住址:</view>
  27. <input v-model="address" placeholder-style="text-align:right" style="text-align: right;" placeholder="请输入家庭住址"></input>
  28. </view>
  29. <view class="cu-form-group">
  30. <view class="title">就诊人性别:</view>
  31. <u-radio-group v-model="value" @change="radioGroupChange">
  32. <u-radio v-for="(item, index) in list" :key="index" :name="item.name" :disabled="item.disabled">
  33. {{item.name}}
  34. </u-radio>
  35. </u-radio-group>
  36. </view>
  37. <view class="cu-form-group">
  38. <view class="title">出身年月:</view>
  39. <picker mode="date" :value="date" :end="time" @change="bindDateChange">
  40. <view class="picker">
  41. {{date}}
  42. </view>
  43. </picker>
  44. </view>
  45. <view class="cu-form-group" @click="show=!show">
  46. <view class="title">与就诊人关系:</view>
  47. <picker :value="guanxi" @change="confirm" :range="guanxilist" range-key="label">
  48. <view class="picker">
  49. {{guanxi}}
  50. </view>
  51. </picker>
  52. </view>
  53. <view class="cu-form-group margin-top">
  54. <view class="title">就诊信息(非必填)</view>
  55. </view>
  56. <view class="cu-form-group">
  57. <view class="title">就诊人身份证:</view>
  58. <input v-model="idcrad" placeholder-style="text-align:right" style="text-align: right;" placeholder="请输入就诊人身份证号"></input>
  59. </view>
  60. <view class="cu-form-group">
  61. <view class="title">电子邮箱:</view>
  62. <input v-model="email" placeholder-style="text-align:right" style="text-align: right;" placeholder="请输入电子邮箱"></input>
  63. </view>
  64. <view class="cu-form-group">
  65. <view class="title">社保卡号:</view>
  66. <input v-model="social" placeholder-style="text-align:right" style="text-align: right;" placeholder="请输入社保卡号"></input>
  67. </view>
  68. <view class="padding-sm bg-white" style="color: #C0C0C0;">
  69. 注:就诊人信息用于平台审核和医疗业务使用,不会外传。请正却确填写就诊人信息,如需修改身份信息可电话联系客服修改(13330431369)
  70. </view>
  71. </form>
  72. <view class="cu-bar bg-white tabbar" v-if="info==''" style="position: fixed;bottom: 0;width: 100%;z-index: 22;">
  73. <view class="submit" style="background-color: #0B73B9;color: white;" @click="addarchives">
  74. 提交
  75. </view>
  76. </view>
  77. <view class="cu-bar bg-white tabbar" v-else style="position: fixed;bottom: 0;width: 100%; z-index: 22;">
  78. <view class="submit" style="background-color: #0B73B9;color: white;" @click="editarchives">
  79. 修改
  80. </view>
  81. </view>
  82. <view class="cu-tabbar-height"></view>
  83. <view class="cu-tabbar-height"></view>
  84. </view>
  85. </template>
  86. <script>
  87. export default {
  88. onLoad(options) {
  89. let date = new Date();
  90. let nian = date.getFullYear()
  91. let yue = date.getMonth() + 1
  92. let ri = date.getDate() >= 10 ? date.getDate() : '0' + date.getDate()
  93. this.time = nian + "-" + yue + "-" + ri
  94. if (options.info) {
  95. this.info = JSON.parse(options.info)
  96. }
  97. if (this.info != "") {
  98. uni.setNavigationBarTitle({
  99. title: "修改档案"
  100. })
  101. this.name = this.info.name
  102. this.imgList = [this.info.avatar]
  103. this.touxiang = this.info.avatar
  104. this.date = this.info.birthday
  105. this.value = this.list[this.info.sex - 1].name
  106. this.guanxi = this.guanxilist[this.info.relationship_type].label
  107. this.guanxiindex = this.info.relationship_type
  108. this.idcrad = this.info.card_number
  109. this.jianhuname = this.info.guardian_name
  110. this.phone = this.info.phone
  111. this.email = this.info.email
  112. this.birthhospital = this.info.born_hospital
  113. this.address = this.info.address
  114. this.social = this.info.social_card_number
  115. }
  116. },
  117. onShow() {
  118. },
  119. data() {
  120. return {
  121. address: "",
  122. birthhospital: "",
  123. email: "",
  124. phone: "",
  125. jianhuname: "",
  126. imgList: ['https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/%E5%A4%B4%E5%83%8F.png'],
  127. name: "",
  128. list: [{
  129. name: '男',
  130. disabled: false
  131. },
  132. {
  133. name: '女',
  134. disabled: false
  135. },
  136. ],
  137. value: '男',
  138. date: "请选择出生日期",
  139. show: false,
  140. guanxi: "请选择",
  141. guanxiindex: -1,
  142. guanxilist: [{
  143. value: '1',
  144. label: '父亲'
  145. },
  146. {
  147. value: '2',
  148. label: '母亲'
  149. },
  150. {
  151. value: '3',
  152. label: '祖父'
  153. },
  154. {
  155. value: '4',
  156. label: '祖母'
  157. },
  158. {
  159. value: '5',
  160. label: '外祖父'
  161. },
  162. {
  163. value: '6',
  164. label: '外祖母'
  165. },
  166. {
  167. value: '7',
  168. label: '叔侄'
  169. },
  170. {
  171. value: '8',
  172. label: '其他'
  173. }
  174. ],
  175. idcrad: "",
  176. touxiang: "",
  177. time: "",
  178. info: "",
  179. social: "" //社保卡号
  180. }
  181. },
  182. methods: {
  183. ChooseImage() {
  184. uni.chooseImage({
  185. count: 1, //默认9
  186. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  187. sourceType: ['album', 'camera'], //从相册选择
  188. success: (res) => {
  189. this.imgList = res.tempFilePaths
  190. this.$request.upload("/api/v1/common/uploadFile", this.imgList[0]).then(data => {
  191. let re = JSON.parse(data)
  192. if (re.status == 0) {
  193. this.touxiang = re.data.url
  194. console.log(this.touxiang)
  195. }
  196. })
  197. }
  198. });
  199. },
  200. // 选中任一radio时,由radio-group触发
  201. radioGroupChange(e) {
  202. this.value = e
  203. },
  204. bindDateChange({
  205. detail
  206. }) {
  207. this.date = detail.value
  208. },
  209. confirm(e) {
  210. this.guanxiindex = e.detail.value
  211. this.guanxi = this.guanxilist[e.detail.value].label
  212. },
  213. addarchives: async function() {
  214. let num = 0
  215. if (this.value == "男") {
  216. num = 1
  217. } else {
  218. num = 2
  219. }
  220. if (this.imgList[0] == undefined) {
  221. uni.showToast({
  222. title: "请上传头像",
  223. icon: "none"
  224. })
  225. return false
  226. }
  227. if (this.name == "") {
  228. uni.showToast({
  229. title: "请填写名称",
  230. icon: "none"
  231. })
  232. return false
  233. }
  234. if (this.jianhuname == "") {
  235. uni.showToast({
  236. title: "请输入监护人姓名",
  237. icon: "none"
  238. })
  239. return false
  240. }
  241. if (!this.$util.isPhoneNumber(this.phone)) {
  242. uni.showToast({
  243. title: "请输入正确手机号",
  244. icon: "none"
  245. })
  246. return false
  247. }
  248. // if (!this.$util.isEmail(this.email)) {
  249. // uni.showToast({
  250. // title: "请填写正确的邮箱",
  251. // icon: "none"
  252. // })
  253. // return false
  254. // }
  255. if (this.birthhospital == "") {
  256. uni.showToast({
  257. title: "请填写正确的医院",
  258. icon: "none"
  259. })
  260. return false
  261. }
  262. if (this.address == "") {
  263. uni.showToast({
  264. title: "请填写正确的地址",
  265. icon: "none"
  266. })
  267. return false
  268. }
  269. if (this.date == "请选择出生日期") {
  270. uni.showToast({
  271. title: "请填写日期",
  272. icon: "none"
  273. })
  274. return false
  275. }
  276. if (this.guanxiindex == -1) {
  277. uni.showToast({
  278. title: "请选择被保人关系",
  279. icon: "none"
  280. })
  281. return false
  282. }
  283. let res = await this.$request.post("/api/v1/patient/createPatient", {
  284. name: this.name,
  285. sex: num,
  286. avatar: this.touxiang==''?this.imgList[0]:this.touxiang,
  287. birthday: this.date,
  288. relationship_type: this.guanxiindex,
  289. card_type: 1,
  290. card_number: this.idcrad,
  291. email: this.email,
  292. phone: this.phone,
  293. guardian_name: this.jianhuname,
  294. address: this.address,
  295. born_hospital: this.birthhospital,
  296. social_card_number: this.social
  297. })
  298. if (res.status == 0) {
  299. uni.showToast({
  300. title: "提交成功",
  301. icon: "none",
  302. duration: 1500
  303. })
  304. setTimeout(() => {
  305. uni.navigateBack({
  306. delta: 1
  307. })
  308. }, 1500)
  309. } else {
  310. uni.showModal({
  311. title: "错误",
  312. content: res.message,
  313. showCancel: true,
  314. })
  315. }
  316. },
  317. editarchives: async function() {
  318. let num = 0
  319. if (this.value == "男") {
  320. num = 1
  321. } else {
  322. num = 2
  323. }
  324. if (this.imgList[0] == undefined) {
  325. uni.showToast({
  326. title: "请上传头像",
  327. icon: "none"
  328. })
  329. return false
  330. }
  331. if (this.name == "") {
  332. uni.showToast({
  333. title: "请填写名称",
  334. icon: "none"
  335. })
  336. return false
  337. }
  338. if (this.jianhuname == "") {
  339. uni.showToast({
  340. title: "请输入监护人姓名",
  341. icon: "none"
  342. })
  343. return false
  344. }
  345. if (!this.$util.isPhoneNumber(this.phone)) {
  346. uni.showToast({
  347. title: "请输入正确手机号",
  348. icon: "none"
  349. })
  350. return false
  351. }
  352. // if (!this.$util.isEmail(this.email)) {
  353. // uni.showToast({
  354. // title: "请填写正确的邮箱",
  355. // icon: "none"
  356. // })
  357. // return false
  358. // }
  359. if (this.birthhospital == "") {
  360. uni.showToast({
  361. title: "请填写正确的医院",
  362. icon: "none"
  363. })
  364. return false
  365. }
  366. if (this.address == "") {
  367. uni.showToast({
  368. title: "请填写正确的地址",
  369. icon: "none"
  370. })
  371. return false
  372. }
  373. if (this.date == "请选择出生日期") {
  374. uni.showToast({
  375. title: "请填写日期",
  376. icon: "none"
  377. })
  378. return false
  379. }
  380. if (this.guanxiindex == -1) {
  381. uni.showToast({
  382. title: "请选择被保人关系",
  383. icon: "none"
  384. })
  385. return false
  386. }
  387. let res = await this.$request.post("/api/v1/patient/updatePatient", {
  388. id: this.info.id,
  389. name: this.name,
  390. sex: num,
  391. avatar: this.touxiang,
  392. birthday: this.date,
  393. relationship_type: this.guanxiindex,
  394. card_type: 1,
  395. card_number: this.idcrad,
  396. email: this.email,
  397. phone: this.phone,
  398. guardian_name: this.jianhuname,
  399. address: this.address,
  400. born_hospital: this.birthhospital,
  401. social_card_number: this.social
  402. })
  403. if (res.status == 0) {
  404. uni.showToast({
  405. title: "修改成功",
  406. icon: "none",
  407. duration: 1500
  408. })
  409. setTimeout(() => {
  410. uni.navigateBack({
  411. delta: 1
  412. })
  413. }, 1500)
  414. }
  415. }
  416. }
  417. };
  418. </script>
  419. <style scoped lang="scss">
  420. .main {}
  421. </style>