1
0
Переглянути джерело

fix:加上就诊人关系

lsw 9 місяців тому
батько
коміт
4867a6909f

+ 0 - 81
admin-ui/src/views/work/user/edit.vue

@@ -1,81 +0,0 @@
-<template>
-  <div class="cmain">
-      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
-        <el-form-item label="微信id" prop="openId">
-          <el-input v-model="form.openId" placeholder="请输入微信id" clearable/>
-        </el-form-item>
-        <el-form-item label="状态" prop="state">
-          <el-input v-model="form.state" placeholder="请输入状态" clearable/>
-        </el-form-item>
-        <el-form-item label="创建者" prop="createBy">
-          <el-input v-model="form.createBy" placeholder="请输入创建者" clearable/>
-        </el-form-item>
-        <el-form-item label="创建时间" prop="createTime">
-          <el-date-picker clearable
-            v-model="form.createTime"
-            type="date"
-            value-format="yyyy-MM-dd"
-            placeholder="请选择创建时间">
-          </el-date-picker>
-        </el-form-item>
-        <el-form-item label="更新者" prop="updateBy">
-          <el-input v-model="form.updateBy" placeholder="请输入更新者" clearable/>
-        </el-form-item>
-        <el-form-item label="更新时间" prop="updateTime">
-          <el-date-picker clearable
-            v-model="form.updateTime"
-            type="date"
-            value-format="yyyy-MM-dd"
-            placeholder="请选择更新时间">
-          </el-date-picker>
-        </el-form-item>
-      </el-form>
-    <div class="mfooter">
-      <el-button type="primary" @click="submitForm">确 定</el-button>
-      <el-button @click="$layer.close(layerid)">取 消</el-button>
-    </div>
-  </div>
-</template>
-
-<script>
-export default {
-  data() {
-    return {
-      form: {},
-      rules: {
-        openId: [
-          { required: true, message: "微信id不能为空", trigger: "blur" }
-        ],
-      }
-    };
-  },
-  mounted() {
-    if (this.param.id) {
-      this.ajax({ url: '/work/user/detail/' + this.param.id }).then(response => {
-        this.form = response.data;
-      });
-    }
-  },
-  methods: {
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id) {
-              this.ajax({method: 'post',url: '/work/user/edit', data: this.form }).then(response => {
-                  this.$modal.msgSuccess("修改成功");
-                  this.$layer.close(this.layerid);
-                  this.$parent.getList();
-              });
-          } else {
-              this.ajax({method: 'post',url: '/work/user/add', data: this.form }).then(response => {
-                  this.$modal.msgSuccess("新增成功");
-                  this.$layer.close(this.layerid);
-                  this.$parent.getList();
-               });
-          }
-        }
-      });
-    }
-  }
-};
-</script>

+ 1 - 15
admin-ui/src/views/work/user/index.vue

@@ -12,13 +12,7 @@
         <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
-    <el-row :gutter="10" class="mb8">
-      <el-button type="primary" icon="el-icon-plus" :disabled="ids.length > 0" @click="op('add')" v-hasPermi="['work:user:add']">新增</el-button>
-      <el-button type="success" icon="el-icon-edit" :disabled="ids.length != 1" @click="op('edit', ids)" v-hasPermi="['work:user:edit']">修改</el-button>
-      <el-button type="danger" icon="el-icon-delete" :disabled="ids.length == 0" @click="del" v-hasPermi="['work:user:remove']">删除{{ ids.length > 0 ? '(' + ids.length + ')' : '' }}</el-button>
-    </el-row>
-
-    <el-table :data="response.rows" border @selection-change="selects" height="calc(100vh - 270px)">
+    <el-table :data="response.rows" border @selection-change="selects" height="calc(100vh - 230px)">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="微信openId" align="left" prop="openId" />
       <el-table-column label="绑定就诊人" align="center" width="160">
@@ -52,7 +46,6 @@
 </template>
 
 <script>
-import edit from './edit';
 export default {
   name: 'User',
   data() {
@@ -88,13 +81,6 @@ export default {
       this.ids = rows.map((item) => item.id);
     },
     op(tag, row) {
-      if (tag == 'add') {
-        this.iframe({ obj: edit, param: {}, title: '新增', width: '45%', height: '55%' });
-      }
-      if (tag == 'edit') {
-        const id = row.id || this.ids[0];
-        this.iframe({ obj: edit, param: { id: id }, title: '编辑', width: '50%', height: '50%' });
-      }
       //账号状态
       if (tag == 'change') {
         let text = row.state === 0 ? '启用' : '禁用';

+ 30 - 5
app/pages/user/bind/add.vue

@@ -3,7 +3,7 @@
 		<view class="form">
 			<view class="form_group">
 				<view class="lable">绑定方式</view>
-				<picker :range="bindType" @change="picker">
+				<picker :range="bindType" @change="picker($event, 'type')">
 					<input placeholder="请选择" :value="bindType[item.type]" :disabled="true" />
 					<view class="icon more">&#xe62b;</view>
 				</picker>
@@ -17,6 +17,13 @@
 				<input type="tel" v-model="item.value" placeholder="请输入手机号" v-if="item.type == 0" />
 				<input type="idcard" v-model="item.value" placeholder="请输入身份证" v-else />
 			</view>
+			<view class="form_group">
+				<view class="lable">就诊人关系</view>
+				<picker :range="relationship" range-key="dictLabel" @change="picker($event, 'relationship')">
+					<input placeholder="请选择" v-model="item.relationship" :disabled="true" />
+					<view class="icon more">&#xe62b;</view>
+				</picker>
+			</view>
 		</view>
 		<button class="btn" @click="add()">确认</button>
 	</view>
@@ -26,15 +33,33 @@
 export default {
 	data() {
 		return {
-			item: { type: 0 },
-			bindType: ['手机号', '身份证']
+			item: { type: 0, relationship: '自己' },
+			bindType: ['手机号', '身份证'],
+			relationship: []
 		};
 	},
+	onLoad() {
+		this.getRelationship();
+	},
 	methods: {
-		picker(e) {
-			this.item.type = e.detail.value;
+		picker(e, tag) {
+			if (tag == 'type') {
+				this.item.type = e.detail.value;
+			}
+			if (tag == 'relationship') {
+				this.item.relationship = this.relationship[e.detail.value].dictLabel;
+			}
 			this.$forceUpdate();
 		},
+		getRelationship() {
+			this.http.request({
+				url: '/app/common/type/nk_kinship',
+				loading: 'false',
+				success: (res) => {
+					this.relationship = res.data.data;
+				}
+			});
+		},
 		add() {
 			let rule = [
 				{ name: 'name', checkType: 'notnull', errorMsg: '请输入姓名' },

+ 1 - 0
app/pages/user/bind/index.vue

@@ -4,6 +4,7 @@
 			<view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/user/bind/detail?id=' + item.id)">
 				<view class="title omit">
 					<text>{{ item.patientName }}</text>
+					<text class="check" v-if="item.relationship">{{item.relationship}}</text>
 					<text class="check" v-if="item.state == 1">(当前就诊人)</text>
 				</view>
 				<view class="icon del" @click.stop="del(item)">&#xe641;</view>

+ 6 - 0
app/pages/user/index.vue

@@ -10,6 +10,7 @@
 				<view v-else>
 					<view class="nickName">
 						<text>{{ user.patientName ? user.patientName : '还未绑定就诊人' }}</text>
+						<text v-if="user.relationship" class="relationship">({{ user.relationship }})</text>
 						<text class="icon" v-if="user.bindUserList && user.bindUserList.length > 1" @click.stop="show = true">&#xe6a7;切换就诊人</text>
 					</view>
 					<view class="welcome">欢迎使用岑溪人民医院小程序</view>
@@ -179,6 +180,11 @@ export default {
 			padding-left: 15px;
 			.nickName {
 				padding-top: 5px;
+				.relationship{
+					color: #7c7c7c;
+					font-size: 13px;
+					padding-left: 3px;
+				}
 				.icon {
 					padding-left: 6px;
 					font-size: 13px;

+ 8 - 1
app/uni_modules/uview-ui/components/u-action-sheet/u-action-sheet.vue

@@ -68,7 +68,9 @@
 									<text
 									    class="u-action-sheet__item-wrap__item__name"
 									    :style="[itemStyle(index)]"
-									>{{ item.patientName }}</text>
+									>{{ item.patientName }}
+									<text class="relationship" v-if="item.relationship">({{item.relationship}})</text>
+									</text>
 									<text
 									    style="width: 90%;color: blue;margin-top: 5px;"
 									    v-if="item.subname"
@@ -275,5 +277,10 @@
 		&--hover {
 			background-color: $u-action-sheet-cancel-text-hover-background-color;
 		}
+		.relationship{
+			color: #7c7c7c;
+			font-size: 13px;
+			padding-left: 3px;
+		}
 	}
 </style>

+ 3 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/BindUser.java

@@ -30,6 +30,9 @@ public class BindUser{
     @ApiModelProperty(value = "患者姓名")
     private String patientName;
 
+    @ApiModelProperty(value = "关系")
+    private String relationship;
+
     @ApiModelProperty(value = "状态:0=未启用,1=当前就诊人")
     private Integer state;
 

+ 3 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/User.java

@@ -32,6 +32,9 @@ public class User{
     @ApiModelProperty(value = "当前患者姓名")
     private String patientName;
 
+    @ApiModelProperty(value = "当前关系")
+    private String relationship;
+
     @ApiModelProperty(value = "状态:0=正常,1=停用")
     private Integer state;
 

+ 3 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/dto/BindDto.java

@@ -21,4 +21,7 @@ public class BindDto {
     @NotBlank(message = "手机号或身份证不能为空")
     private String value;
 
+    @NotBlank(message = "关系不能为空")
+    private String relationship;
+
 }

+ 5 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/BindUserServiceImpl.java

@@ -53,6 +53,7 @@ public class BindUserServiceImpl extends ServiceImpl<BindUserMapper, BindUser> i
         bindUser.setPatientId(patient.getId());
         bindUser.setUserId(AppUtil.getUser().getId());
         bindUser.setPatientName(patient.getName());
+        bindUser.setRelationship(dto.getRelationship());
         if (bindUserMapper.selectBindUser(bindUser) != null) {
             return AjaxResult.error("你已绑定过该就诊人");
         }
@@ -63,8 +64,9 @@ public class BindUserServiceImpl extends ServiceImpl<BindUserMapper, BindUser> i
             User user = AppUtil.getUser();
             user.setPatientId(patient.getId());
             user.setPatientName(patient.getName());
+            user.setRelationship(dto.getRelationship());
             if (!userService.updateById(user)) {
-                throw new ServerException("绑定就诊人失败");
+                throw new ServerException("缓存信息过期,绑定就诊人失败,请重新登录再试");
             }
             tokenService.setLoginUser(user);
         }
@@ -87,6 +89,7 @@ public class BindUserServiceImpl extends ServiceImpl<BindUserMapper, BindUser> i
         if (bindUser.getPatientId().equals(AppUtil.getUser().getPatientId())) {
             User user = AppUtil.getUser();
             user.setPatientName("");
+            user.setRelationship("");
             user.setPatientId(0l);
             userService.updateById(user);
             tokenService.setLoginUser(user);
@@ -107,6 +110,7 @@ public class BindUserServiceImpl extends ServiceImpl<BindUserMapper, BindUser> i
         User user = AppUtil.getUser();
         user.setPatientId(bindUser.getPatientId());
         user.setPatientName(bindUser.getPatientName());
+        user.setRelationship(bindUser.getRelationship());
         if (!userService.updateById(user)) {
             throw new ServerException("切换就诊人失败");
         }