123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <template>
- <view class="main">
- <form>
- <view class="cu-form-group margin-top">
- <view class="title">头像</view>
- <image class="cu-avatar radius bg-gray" @click="ChooseImage" :src='imgList[0]' mode='aspectFill'>
- </image>
- </view>
- <view class="cu-form-group">
- <view class="title">就诊人姓名:</view>
- <input v-model="name" placeholder-style="text-align:right" style="text-align: right;" placeholder="请输入姓名"></input>
- </view>
- <view class="cu-form-group">
- <view class="title">就诊人性别:</view>
- <u-radio-group v-model="value" @change="radioGroupChange">
- <u-radio v-for="(item, index) in list" :key="index" :name="item.name" :disabled="item.disabled">
- {{item.name}}
- </u-radio>
- </u-radio-group>
- </view>
- <view class="cu-form-group">
- <view class="title">出身年月:</view>
- <picker mode="date" :value="date" :end="time" @change="bindDateChange">
- <view class="picker">
- {{date}}
- </view>
- </picker>
- </view>
- <view class="cu-form-group" @click="show=!show">
- <view class="title">与就诊人关系:</view>
- <picker :value="guanxi" @change="confirm" :range="guanxilist" range-key="label">
- <view class="picker">
- {{guanxi}}
- </view>
- </picker>
- </view>
- <view class="cu-form-group margin-top">
- <view class="title">就诊信息(非必填)</view>
- </view>
- <view class="cu-form-group">
- <view class="title">就诊人身份证:</view>
- <input v-model="idcrad" placeholder-style="text-align:right" style="text-align: right;" placeholder="请输入就诊人身份证号"></input>
- </view>
- <view class="padding-sm bg-white" style="color: #C0C0C0;">
- 注:就诊人信息用于平台审核和医疗业务使用,不会外传。请正却确填写就诊人信息,如需修改身份信息可电话联系客服修改(13330431369)
- </view>
- </form>
- <view class="cu-bar bg-white tabbar" v-if="info==''" style="position: fixed;bottom: 0;width: 100%;">
- <view class="submit" style="background-color: #0B73B9;color: white;" @click="addarchives">
- 提交
- </view>
- </view>
- <view class="cu-bar bg-white tabbar" v-else style="position: fixed;bottom: 0;width: 100%;">
- <view class="submit" style="background-color: #0B73B9;color: white;" @click="editarchives">
- 修改
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- onLoad(options) {
- let date = new Date();
- let nian = date.getFullYear()
- let yue = date.getMonth() + 1
- let ri = date.getDate() >= 10 ? date.getDate() : '0' + date.getDate()
- this.time = nian + "-" + yue + "-" + ri
- if (options.info) {
- this.info = JSON.parse(options.info)
- }
- if (this.info != "") {
- uni.setNavigationBarTitle({
- title: "修改档案"
- })
- this.name = this.info.name
- this.imgList = [this.info.avatar]
- this.date = this.info.birthday
- this.value = this.list[this.info.sex - 1].name
- this.guanxi = this.guanxilist[this.info.relationship_type].label
- this.idcrad = this.info.card_number
- }
- },
- onShow() {
- },
- data() {
- return {
- imgList: '',
- name: "",
- list: [{
- name: '男',
- disabled: false
- },
- {
- name: '女',
- disabled: false
- },
- ],
- value: '男',
- date: "请选择出生日期",
- show: false,
- guanxi: "请选择",
- guanxiindex: -1,
- guanxilist: [{
- value: '1',
- label: '父亲'
- },
- {
- value: '2',
- label: '母亲'
- },
- {
- value: '3',
- label: '祖父'
- },
- {
- value: '4',
- label: '祖母'
- },
- {
- value: '5',
- label: '外祖父'
- },
- {
- value: '6',
- label: '外祖母'
- },
- {
- value: '7',
- label: '叔侄'
- },
- {
- value: '8',
- label: '其他'
- }
- ],
- idcrad: "",
- touxiang: "",
- time: "",
- info: ""
- }
- },
- methods: {
- ChooseImage() {
- uni.chooseImage({
- count: 1, //默认9
- sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album', 'camera'], //从相册选择
- success: (res) => {
- this.imgList = res.tempFilePaths
- this.$request.upload("/api/v1/common/uploadFile", this.imgList[0]).then(data => {
- let re = JSON.parse(data)
- if (re.status == 0) {
- this.touxiang = re.data.url
- console.log(this.touxiang)
- }
- })
- }
- });
- },
- // 选中任一radio时,由radio-group触发
- radioGroupChange(e) {
- this.value = e
- },
- bindDateChange({
- detail
- }) {
- this.date = detail.value
- },
- confirm(e) {
- this.guanxiindex = e.detail.value
- this.guanxi = this.guanxilist[e.detail.value].label
- },
- addarchives: async function() {
- let num = 0
- if (this.value == "男") {
- num = 1
- } else {
- num = 2
- }
- if (this.imgList[0] == undefined) {
- uni.showToast({
- title: "请上传头像",
- icon: "none"
- })
- return false
- }
- if (this.name == "") {
- uni.showToast({
- title: "请填写名称",
- icon: "none"
- })
- return false
- }
- if (this.date == "请选择出生日期") {
- uni.showToast({
- title: "请填写日期",
- icon: "none"
- })
- return false
- }
- if (this.guanxiindex == -1) {
- uni.showToast({
- title: "请选择被保人关系",
- icon: "none"
- })
- return false
- }
- let res = await this.$request.post("/api/v1/patient/createPatient", {
- name: this.name,
- sex: num,
- avatar: this.touxiang,
- birthday: this.date,
- relationship_type: this.guanxiindex,
- card_type: 1,
- card_number: this.idcrad
- })
- if (res.status == 0) {
- uni.showToast({
- title: "提交成功",
- icon: "none",
- duration: 1500
- })
- setTimeout(() => {
- uni.navigateBack({
- delta: 1
- })
- }, 1500)
- }
- },
- editarchives: async function() {
- let num = 0
- if (this.value == "男") {
- num = 1
- } else {
- num = 2
- }
- if (this.imgList[0] == undefined) {
- uni.showToast({
- title: "请上传头像",
- icon: "none"
- })
- return false
- }
- if (this.name == "") {
- uni.showToast({
- title: "请填写名称",
- icon: "none"
- })
- return false
- }
- if (this.date == "请选择出生日期") {
- uni.showToast({
- title: "请填写日期",
- icon: "none"
- })
- return false
- }
- if (this.guanxiindex == -1) {
- uni.showToast({
- title: "请选择被保人关系",
- icon: "none"
- })
- return false
- }
- let res = await this.$request.post("/api/v1/patient/updatePatient", {
- id: this.info.id,
- name: this.name,
- sex: num,
- avatar: this.touxiang,
- birthday: this.date,
- relationship_type: this.guanxiindex,
- card_type: 1,
- card_number: this.idcrad
- })
- if (res.status == 0) {
- uni.showToast({
- title: "修改成功",
- icon: "none",
- duration: 1500
- })
- setTimeout(() => {
- uni.navigateBack({
- delta: 1
- })
- }, 1500)
- }
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .main {}
- </style>
|