Explorar el Código

Merge branch 'dev1.0' of http://123.207.73.252:3000/lsw/hospital into Gogs-dev1.0

Ciallo hace 9 meses
padre
commit
165b06a5ac
Se han modificado 27 ficheros con 770 adiciones y 94 borrados
  1. 1 1
      admin-ui/src/views/system/dept/edit.vue
  2. 1 1
      admin-ui/src/views/system/dept/index.vue
  3. 2 2
      admin-ui/src/views/system/user/index.vue
  4. 136 0
      admin-ui/src/views/work/patient/index.vue
  5. 224 0
      admin-ui/src/views/work/patient/search.vue
  6. 1 1
      app/App.vue
  7. 88 0
      app/common/common.scss
  8. 9 10
      app/pages/department/index.vue
  9. 5 11
      app/pages/doctor/index.vue
  10. 3 4
      app/pages/index/index.vue
  11. 32 10
      app/pages/user/bind/add.vue
  12. 36 26
      app/pages/user/bind/index.vue
  13. 22 1
      app/pages/user/index.vue
  14. 1 1
      app/uni_modules/uview-ui/components/u-action-sheet/u-action-sheet.vue
  15. 1 1
      app/uni_modules/uview-ui/components/u-empty/u-empty.vue
  16. 16 0
      ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_UserController.java
  17. 6 8
      ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/BindUser.java
  18. 5 0
      ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/User.java
  19. 14 0
      ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/dto/BindDto.java
  20. 11 2
      ruoyi-admin/src/main/java/com/ruoyi/web/work/mapper/BindUserMapper.java
  21. 31 3
      ruoyi-admin/src/main/java/com/ruoyi/web/work/service/IBindUserService.java
  22. 84 5
      ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/BindUserServiceImpl.java
  23. 8 1
      ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/UserServiceImpl.java
  24. 12 0
      ruoyi-admin/src/main/resources/mapper/work/BindUserMapper.xml
  25. 18 0
      ruoyi-admin/src/test/test/test.java
  26. 0 6
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
  27. 3 0
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

+ 1 - 1
admin-ui/src/views/system/dept/edit.vue

@@ -5,7 +5,7 @@
         <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级科室" />
         <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级科室" />
       </el-form-item>
       </el-form-item>
       <el-form-item label="科室名称" prop="deptName"><el-input v-model="form.deptName" placeholder="请输入科室名称" /></el-form-item>
       <el-form-item label="科室名称" prop="deptName"><el-input v-model="form.deptName" placeholder="请输入科室名称" /></el-form-item>
-      <div v-if="form.parentId != 0 && form.ancestors.length == 3">
+      <div v-if="form.parentId != 0">
         <el-form-item label="科室介绍" prop="brief">
         <el-form-item label="科室介绍" prop="brief">
           <editor v-model="form.brief" placeholder="请输入"></editor>
           <editor v-model="form.brief" placeholder="请输入"></editor>
         </el-form-item>
         </el-form-item>

+ 1 - 1
admin-ui/src/views/system/dept/index.vue

@@ -26,7 +26,7 @@
       <el-table-column label="操作" align="center" width="220">
       <el-table-column label="操作" align="center" width="220">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:dept:edit']">修改</el-button>
           <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:dept:edit']">修改</el-button>
-          <el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)" v-hasPermi="['system:dept:add']" v-if="scope.row.ancestors.length < 3">新增</el-button>
+          <el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)" v-hasPermi="['system:dept:add']" v-if="scope.row.parentId==0">新增</el-button>
           <el-button v-if="scope.row.parentId != 0" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:dept:remove']">删除</el-button>
           <el-button v-if="scope.row.parentId != 0" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:dept:remove']">删除</el-button>
         </template>
         </template>
       </el-table-column>
       </el-table-column>

+ 2 - 2
admin-ui/src/views/system/user/index.vue

@@ -11,8 +11,8 @@
           <el-form-item label="账号" prop="userName">
           <el-form-item label="账号" prop="userName">
             <el-input v-model="queryParams.userName" placeholder="请输入账号" clearable @keyup.enter.native="handleQuery" class="se" />
             <el-input v-model="queryParams.userName" placeholder="请输入账号" clearable @keyup.enter.native="handleQuery" class="se" />
           </el-form-item>
           </el-form-item>
-          <el-form-item label="手机号" prop="phonenumber">
-            <el-input v-model="queryParams.phonenumber" placeholder="请输入手机号" clearable @keyup.enter.native="handleQuery" class="se" />
+          <el-form-item label="姓名" prop="nickName">
+            <el-input v-model="queryParams.nickName" placeholder="请输入姓名" clearable @keyup.enter.native="handleQuery" class="se" />
           </el-form-item>
           </el-form-item>
           <el-form-item label="创建时间">
           <el-form-item label="创建时间">
             <el-date-picker v-model="dateRange" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
             <el-date-picker v-model="dateRange" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>

+ 136 - 0
admin-ui/src/views/work/patient/index.vue

@@ -0,0 +1,136 @@
+<template>
+  <div class="app-container">
+    <!-- 行容器 -->
+    <el-row :gutter="20">
+      <!-- 列容器 -->
+      <!-- 左边的列表,显示各个科室 -->
+      <el-col :span="4">
+        <el-menu v-for="(item,index) in deptOptions">
+          <el-menu-item @click="handleNodeClick(item.department)" :key="index">
+            <span slot="title">{{item.department}}</span>
+          </el-menu-item>
+        </el-menu>
+      </el-col>
+      <!-- 患者诊断记录列表 -->
+      <el-col :span="20">
+        <el-form :model="queryParams" ref="queryForm" :inline="true" >
+          <el-form-item prop="physician">
+            <el-input v-model="queryParams.physician" placeholder="请输入主治医生" clearable @keyup.enter.native="handleQuery" class="se" />
+          </el-form-item>
+          <el-form-item prop="patientName">
+            <el-input v-model="queryParams.patientName" placeholder="请输入患者姓名" clearable @keyup.enter.native="handleQuery" class="se" />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
+            <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
+        <el-table :data="patientList" border @selection-change="selects" height="calc(100vh - 270px)">
+          <el-table-column type="selection" width="55" align="center" />
+          <el-table-column label="科室" align="center" prop="department" />
+          <el-table-column label="患者姓名" align="center" prop="name" />
+          <el-table-column label="主治医生" align="center" prop="physician" />
+          <el-table-column label="出院方式" align="center" prop="dischargeMethod">
+            <template slot-scope="scope">
+            <dict-tag :options="dict.type.discharge_method" :value="scope.row.dischargeMethod"></dict-tag>
+            </template>
+          </el-table-column>
+          <el-table-column label="出院时间" align="center" prop="dischargeTime" />
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button size="mini" type="text" icon="el-icon-search" @click="op('search',scope.row)" v-hasPermi="['work:dg:edit']">查看</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+        <pagination v-if="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import search from "@/views/work/patient/search.vue";
+export default {
+  dicts:['discharge_method'],
+  name: 'User',
+  data() {
+    return {
+      total:0,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      //科室名称
+      deptName:undefined,
+      // 部门树选项
+      deptOptions: null,
+      //患者表
+      patientList:null,
+      //查询参数
+      queryParams: {
+        pageNum:1,
+        pageSize:10,
+        physician: undefined,
+        patientName:undefined,
+        departmentName:undefined,
+      }
+    };
+  },
+  watch: {
+  },
+  created() {
+    this.getDepartment();
+  },
+  methods: {
+    // 表单重置
+    reset() {
+      this.form = {
+        physician:undefined,
+        name:undefined
+      };
+      this.resetForm('form');
+    },
+    /** 查询患者列表*/
+    getList(){
+      this.get({
+        url:'/work/pv1/patientCard',
+        data:this.queryParams
+      }).then((response)=>{
+        this.patientList = response.rows;
+        this.total = response.total;
+      })
+    },
+    /** 查询部门 */
+    getDepartment() {
+      this.get({
+        url:'/work/pv1/department'
+      }).then((response) => {
+        this.deptOptions = response.rows;
+      });
+    },
+    handleNodeClick(department){
+      this.queryParams.departmentName = department;
+      this.getList();
+    },
+    selects(rows) {
+      this.ids = rows.map(item => item.id)
+    },
+    op(tag, row) {
+      if (tag == 'search') {
+        this.iframe({ obj: search, param: {id:row.patientId,cardId:row.cardId, name:row.name, department:row.department}, title:'查看患者信息',width: '95%', height: '95%'});
+      }
+    },
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm('queryForm');
+      this.handleQuery();
+    },
+  }
+};
+</script>

+ 224 - 0
admin-ui/src/views/work/patient/search.vue

@@ -0,0 +1,224 @@
+<template>
+  <el-row :gutter="20">
+    <el-col :span="6">
+      <el-tabs type="card" @tab-click="handleTabClick" v-model="activeNames">
+        <el-tab-pane label="基本信息" name="info" style="width: 24vw">
+          <div style="height: 80vh; overflow-y: auto">
+            <el-descriptions  style="width: 100%" title="患者信息" :column="1" border>
+              <el-descriptions-item label="患者标识符">{{patientInfo.patientCode}}</el-descriptions-item>
+              <el-descriptions-item label="就诊卡号">{{patientInfo.cardNumber}}</el-descriptions-item>
+              <el-descriptions-item label="姓名">{{patientInfo.name}}</el-descriptions-item>
+              <el-descriptions-item label="性别">
+                <dict-tag :options="dict.type.patient_sex" :value="patientInfo.sex"/>
+              </el-descriptions-item>
+              <el-descriptions-item label="身份证号" prop="sfzh">{{patientInfo.sfzh}}</el-descriptions-item>
+              <el-descriptions-item label="出生时间" prop="birthDate">{{patientInfo.birthDate}}</el-descriptions-item>
+              <el-descriptions-item label="居住地址" prop="address">{{patientInfo.address}}</el-descriptions-item>
+              <el-descriptions-item label="联系电话" prop="phone">{{patientInfo.phone}}</el-descriptions-item>
+              <el-descriptions-item label="婚姻状况" prop="marital">
+                <dict-tag :options="dict.type.patient_marital" :value="patientInfo.marital" />
+              </el-descriptions-item>
+              <el-descriptions-item label="民族" prop="nation">{{patientInfo.nation}}</el-descriptions-item>
+              <el-descriptions-item label="职业" prop="career">{{patientInfo.career}}</el-descriptions-item>
+              <el-descriptions-item label="国籍" prop="nationality">{{patientInfo.nationality}}</el-descriptions-item>
+              <el-descriptions-item label="病历号" prop="blh">{{patientInfo.blh}}</el-descriptions-item>
+              <el-descriptions-item label="病人卡号" prop="brkh">{{patientInfo.brkh}}</el-descriptions-item>
+              <el-descriptions-item label="婴儿序号" prop="yexh">{{patientInfo.yexh}}</el-descriptions-item>
+            </el-descriptions>
+          </div>
+        </el-tab-pane>
+
+        <el-tab-pane label="就诊记录" @tab-click="handleTabClick" name="time" style="width: 24vw">
+          <el-timeline>
+            <el-timeline-item v-for="(item,index) in timeList" :timestamp="item.dischargeTime" :key="index">
+              <span @click="getCard(item.id)">{{item.department}}</span>
+            </el-timeline-item>
+          </el-timeline>
+        </el-tab-pane>
+      </el-tabs>
+    </el-col>
+
+    <el-col :span="18">
+      <el-tabs type="card" @tab-click="handleTabClick" v-model="activeName">
+        <el-tab-pane label="就诊信息" style="width: 70vw;" name="pv">
+          <el-descriptions :column="3" border height="calc(90vh - 273px)">
+            <el-descriptions-item label="患者类别">{{pvList.patientCategory}}</el-descriptions-item>
+            <el-descriptions-item label="所在病区">{{pvList.wardName}}</el-descriptions-item>
+            <el-descriptions-item label="主治医生">{{pvList.physician}}</el-descriptions-item>
+            <el-descriptions-item label="主管护士">{{pvList.nurseCode}}</el-descriptions-item>
+            <el-descriptions-item label="在院状态">
+              <dict-tag :options="dict.type.hospital_status" :value="pvList.hospitalStatus"/>
+            </el-descriptions-item>
+            <el-descriptions-item label="入院次数">{{pvList.hospitalizedNumber}}</el-descriptions-item>
+            <el-descriptions-item label="就诊号码">{{pvList.cardId}}</el-descriptions-item>
+            <el-descriptions-item label="出院方式">
+              <dict-tag :options="dict.type.discharge_method" :value="pvList.dischargeMothod"/>
+            </el-descriptions-item>
+            <el-descriptions-item label="入院时间">{{pvList.admissionTime}}</el-descriptions-item>
+            <el-descriptions-item label="出院时间">{{pvList.dischargeTime}}</el-descriptions-item>
+            <el-descriptions-item label="危重级别">{{pvList.level}}</el-descriptions-item>
+            <el-descriptions-item label="入区时间">{{pvList.entryTime}}</el-descriptions-item>
+            <el-descriptions-item label="出区时间">{{pvList.exitTime}}</el-descriptions-item>
+            <el-descriptions-item label="出区原因">{{pvList.reasonArea}}</el-descriptions-item>
+          </el-descriptions>
+        </el-tab-pane>
+
+        <el-tab-pane label="相关当事人/近亲段信息" style="width: 70vw;" name="nk">
+          <!-- 表格展示多个亲属的信息-->
+          <el-table height="calc(90vh - 273px)" width="69vw" :data="nkList">
+            <el-table-column label="姓名" align="center" prop="name"></el-table-column>
+            <el-table-column label="所属关系" align="center" prop="kinship"></el-table-column>
+            <el-table-column label="近亲地址" align="center" prop="address"></el-table-column>
+            <el-table-column label="联系电话" align="center" prop="phone"></el-table-column>
+            <el-table-column label="工作名称" align="center" prop="workName"></el-table-column>
+            <el-table-column label="工作类别" align="center" prop="workCode"></el-table-column>
+          </el-table>
+          <pagination v-show="totalNk > 0" :total="totalNk" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getNkList" />
+        </el-tab-pane>
+
+        <el-tab-pane label="诊断结果" style="width: 70vw" name="dg">
+          <el-table width="69vw" height="calc(90vh - 165px)" :data="dgList">
+            <el-table-column label="诊断名称" align="center" prop="diagnosticCode"></el-table-column>
+            <el-table-column label="诊断时间" align="center" prop="diagnosisTime"></el-table-column>
+            <el-table-column label="诊断类型" align="center" prop="diagnosticType">
+              <template slot-scope="scope">
+                <dict-tag :options="dict.type.diagnostic_type" :value="scope.row.diagnosticType"/>
+              </template>
+            </el-table-column>
+            <el-table-column label="诊断类别" align="center" prop="diagnosticCategoryCode">
+              <template slot-scope="scope">
+                <dict-tag :options="dict.type.diagnostic_category_code" :value="scope.row.diagnosticCategoryCode"/>
+              </template>
+            </el-table-column>
+          </el-table>
+          <pagination v-show="totalDg > 0" :total="totalDg" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getDgList" />
+        </el-tab-pane>
+      </el-tabs>
+    </el-col>
+  </el-row>
+
+</template>
+
+<script>
+export default {
+  dicts: ['diagnostic_type', 'diagnostic_category_code','hospital_status','discharge_method','patient_sex','patient_marital'],
+  data(){
+    return{
+      activeName:'pv',
+      activeNames:'info',
+      timeList:null,
+      //表数据总条数
+      totalNk:0,
+      totalDg:0,
+      dgList:null,
+      //pv表数据
+      pvList:null,
+      //nk表数据
+      nkList:null,
+      //obx表数据
+      obxList:null,
+      obrList:null,
+      //患者信息
+      patientInfo:null,
+      //就诊信息
+      pvInfo:null,
+      queryParams:{
+        pageNum:1,
+        pageSize:10
+      }
+    }
+  },
+  watch:{
+  },
+  created() {
+    this.getPatient();
+    this.getPvList();
+    this.handleTabClick('pv');
+  },
+  methods:{
+    getCard(id){
+      this.ajax({
+        url:'/work/pv1/list',
+        data:{
+          id:id
+        }
+      }).then((response)=>{
+        this.pvList = response.rows[0];
+        console.log(this.pvList)
+      })
+    },
+    handleTabClick(tab){
+      if(tab.name === 'time'){
+        this.getTime();
+      }
+      if(tab.name === 'nk'){
+        this.getNkList();
+      }
+      if(tab.name === 'dg'){
+        this.getDgList();
+      }
+      if(tab.name === 'pv'){
+        this.getPvList();
+      }
+    },
+    getTime(){
+      this.ajax({
+        url:'/work/pv1/list',
+        data:{
+          patientId:this.param.id,
+          department:this.param.department
+        }
+      }).then((response)=>{
+        console.log(this.param.name)
+        this.timeList = response.rows;
+        console.log(this.timeList);
+      })
+    },
+    /** 查询患者信息 */
+    getPatient(){
+      this.get({
+        url:'/work/patient/detail/'+this.param.id,
+      }).then((response)=>{
+        this.patientInfo = response.data;
+      })
+    },
+    getPvList(){
+      this.get({
+        url:'/work/pv1/list',
+        data:{
+          cardId:this.param.cardId
+        }
+      }).then((response)=>{
+        this.pvList = response.rows[0];
+      })
+    },
+    /** 查询亲属表 */
+    getNkList() {
+        this.ajax({
+          url:'/work/nk/list',
+          data:{
+            patientId:this.param.id,
+              ...this.queryParams
+          }
+        }).then((response)=>{
+          this.nkList = response.rows;
+          this.totalNk = response.total;
+        })
+    },
+    getDgList(){
+      this.ajax({
+        url:'/work/dg/list',
+        data:{
+          patientId:this.patientInfo.id,
+            ...this.queryParams
+        }
+      }).then((response)=>{
+        this.dgList = response.rows;
+        this.totalDg = response.total;
+      })
+    }
+  }
+}
+</script>
+<style scoped lang="scss">
+</style>

+ 1 - 1
app/App.vue

@@ -30,7 +30,7 @@ button::after {
 /**挂载iconfont字体图标*/
 /**挂载iconfont字体图标*/
 @font-face {
 @font-face {
 	font-family: 'iconfont';
 	font-family: 'iconfont';
-	src: url('https://at.alicdn.com/t/c/font_4620946_71l23z3aw5o.ttf?t=1721929654519') format('truetype');
+	src: url('https://at.alicdn.com/t/c/font_4620946_zhmq38l0vzq.ttf?t=1721980812832') format('truetype');
 	/* src: url('~@/static/font/iconfont.ttf') format('truetype'); */
 	/* src: url('~@/static/font/iconfont.ttf') format('truetype'); */
 }
 }
 .icon {
 .icon {

+ 88 - 0
app/common/common.scss

@@ -194,4 +194,92 @@
 			padding-right: 5px;
 			padding-right: 5px;
 		}
 		}
 	}
 	}
+}
+.form_group {
+	padding: 9px 0px 9px 0px;
+	overflow: hidden;
+	position: relative;
+	&.form_group:last-child {
+		border-bottom: 0px;
+	}
+	.lable {
+		font-size: 17px;
+		text-align: left;
+		position: relative;
+		font-weight: bold;
+	}
+	.re {
+		&::before {
+			content: '*';
+			width: 0px;
+			height: 0px;
+			color: red;
+			position: absolute;
+			top: -11px;
+			font-weight: bold;
+		}
+	}
+	.bgm {
+		border: 1px solid $line;
+		border-radius: 5px;
+		margin-top: 12px;
+		position: relative;
+		background-color: white;
+		.input {
+			border: 0px;
+			width: 75%;
+			margin-top: 0px;
+		}
+		.msg {
+			position: absolute;
+			right: 10px;
+			top: 9px;
+			color: $main-color;
+		}
+	}
+	.avatar {
+		position: absolute;
+		top: 0px;
+		right: 0px;
+		width: 55px;
+		height: 55px;
+		border-radius: 50%;
+	}
+	picker {
+		position: relative;
+		.more {
+			position: absolute;
+			right: 7px;
+			top: 13px;
+			font-weight: normal;
+		}
+	}
+	input {
+		font-size: 15px;
+		border-radius: 5px;
+		padding: 10px;
+		margin-top: 12px;
+		border: 1px solid $line;
+		background-color: white;
+	}
+	textarea {
+		font-size: 15px;
+		border-radius: 5px;
+		padding: 10px;
+		margin-top: 12px;
+		height: 120px;
+		width: 93%;
+		border: 1px solid $line;
+		background-color: white;
+	}
+	.start {
+		flex: 1;
+		margin-top: -17px;
+		text-align: left;
+	}
+	.hor {
+		flex: 0.7;
+		text-align: center;
+		padding-top: 5px;
+	}
 }
 }

+ 9 - 10
app/pages/department/index.vue

@@ -1,16 +1,12 @@
 <template>
 <template>
 	<view class="msilde">
 	<view class="msilde">
 		<view class="left">
 		<view class="left">
-			<u-collapse accordion >
-				<u-collapse-item :title="d.deptName" :name="d.deptId" v-for="(d, index) in list" :key="d.deptName">
-					<view :class="{ active: index == i.current }" v-for="(i, index) in d.children" :key="i.deptName" class="item" @click="selected(i, index)">{{ i.deptName }}</view>
-				</u-collapse-item>
-			</u-collapse>
+			<view :class="{ active: index == current }" v-for="(item, index) in list" :key="index" class="item" @click="selected(item, index)">{{ item.deptName }}</view>
 		</view>
 		</view>
 		<view class="right">
 		<view class="right">
 			<view class="contents">
 			<view class="contents">
-				<u-divider :text="item.deptName + '介绍'" v-if="item.deptName"></u-divider>
-				<u-parse :content="item.brief"></u-parse>
+				<u-parse :content="item.brief" v-if="item.brief"></u-parse>
+				<u-empty v-else text="整理资料中..."></u-empty>
 			</view>
 			</view>
 		</view>
 		</view>
 	</view>
 	</view>
@@ -20,6 +16,7 @@
 export default {
 export default {
 	data() {
 	data() {
 		return {
 		return {
+			current: 0,
 			item: {},
 			item: {},
 			list: []
 			list: []
 		};
 		};
@@ -33,17 +30,19 @@ export default {
 				url: '/app/department/list',
 				url: '/app/department/list',
 				success: (res) => {
 				success: (res) => {
 					this.list = res.data.data;
 					this.list = res.data.data;
+					this.selected(this.list[0], 0);
 				}
 				}
 			});
 			});
 		},
 		},
 		selected(item, index) {
 		selected(item, index) {
-			this.list.flatMap((i) => i.children).forEach((j) => (j.current = -1));
-			item.current = index;
+			this.current = index;
 			this.http.request({
 			this.http.request({
 				url: '/app/department/detail/' + item.deptId,
 				url: '/app/department/detail/' + item.deptId,
 				success: (res) => {
 				success: (res) => {
 					this.item = res.data.data;
 					this.item = res.data.data;
-					this.item.brief = res.data.data.brief.replace(new RegExp('/profile/upload/', 'g'), this.http.ip + '/profile/upload/');
+					if (res.data.data.brief) {
+						this.item.brief = res.data.data.brief.replace(new RegExp('/profile/upload/', 'g'), this.http.ip + '/profile/upload/');
+					}
 				}
 				}
 			});
 			});
 		}
 		}

+ 5 - 11
app/pages/doctor/index.vue

@@ -1,11 +1,7 @@
 <template>
 <template>
 	<view class="msilde">
 	<view class="msilde">
 		<view class="left">
 		<view class="left">
-			<u-collapse accordion >
-				<u-collapse-item :title="d.deptName" :name="d.deptId" v-for="(d, index) in list" :key="d.deptName">
-					<view :class="{ active: index == i.current }" v-for="(i, index) in d.children" :key="i.deptName" class="item" @click="selected(i, index)">{{ i.deptName }}</view>
-				</u-collapse-item>
-			</u-collapse>
+			<view :class="{ active: index == current }" v-for="(item, index) in list" :key="index" class="item" @click="selected(item, index)">{{ item.deptName }}</view>
 		</view>
 		</view>
 		<view class="right">
 		<view class="right">
 			<view class="list" v-if="doctor_list.length > 0">
 			<view class="list" v-if="doctor_list.length > 0">
@@ -26,9 +22,10 @@
 export default {
 export default {
 	data() {
 	data() {
 		return {
 		return {
+			current: 0,
 			ip: this.http.ip,
 			ip: this.http.ip,
 			doctor_list: {},
 			doctor_list: {},
-			list: [{ deptId: 0 }]
+			list: []
 		};
 		};
 	},
 	},
 	onLoad(e) {
 	onLoad(e) {
@@ -40,15 +37,12 @@ export default {
 				url: '/app/department/list',
 				url: '/app/department/list',
 				success: (res) => {
 				success: (res) => {
 					this.list = res.data.data;
 					this.list = res.data.data;
+					this.selected(this.list[0], 0);
 				}
 				}
 			});
 			});
 		},
 		},
-		open() {
-			this.current = -1;
-		},
 		selected(item, index) {
 		selected(item, index) {
-			this.list.flatMap((i) => i.children).forEach((j) => (j.current = -1));
-			item.current = index;
+			this.current = index;
 			this.http.request({
 			this.http.request({
 				url: '/app/doctor/list',
 				url: '/app/doctor/list',
 				data: { deptId: item.deptId },
 				data: { deptId: item.deptId },

+ 3 - 4
app/pages/index/index.vue

@@ -18,7 +18,7 @@
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
-			<view class="item" @click="go('/pages/department/index')">
+			<view class="item" @click="go('/pages/introduction/index')">
 				<view class="out">
 				<view class="out">
 					<view class="int" style="height: 87px; background-color: #ddf8f3">
 					<view class="int" style="height: 87px; background-color: #ddf8f3">
 						<view class="icon" style="color: #22b789">&#xe606;</view>
 						<view class="icon" style="color: #22b789">&#xe606;</view>
@@ -45,7 +45,7 @@
 			<view class="gg">
 			<view class="gg">
 				<view class="title">权威专家</view>
 				<view class="title">权威专家</view>
 				<view class="bor"></view>
 				<view class="bor"></view>
-				<view class="more" @click="go('/pages/news/index?type=新闻资讯')">
+				<view class="more" @click="go('/pages/doctor/index')">
 					<text>更多</text>
 					<text>更多</text>
 					<text class="icon">&#xe62b;</text>
 					<text class="icon">&#xe62b;</text>
 				</view>
 				</view>
@@ -64,7 +64,7 @@
 			<view class="gg">
 			<view class="gg">
 				<view class="title">健康知识</view>
 				<view class="title">健康知识</view>
 				<view class="bor"></view>
 				<view class="bor"></view>
-				<view class="more" @click="go('/pages/news/index?type=新闻资讯')">
+				<view class="more" @click="go('/pages/knowledge/index')">
 					<text>更多</text>
 					<text>更多</text>
 					<text class="icon">&#xe62b;</text>
 					<text class="icon">&#xe62b;</text>
 				</view>
 				</view>
@@ -192,7 +192,6 @@ page {
 	.gg {
 	.gg {
 		font-weight: bold;
 		font-weight: bold;
 		margin-bottom: 5px;
 		margin-bottom: 5px;
-		color: $font-c;
 		overflow: hidden;
 		overflow: hidden;
 		.title {
 		.title {
 			margin-left: 10px;
 			margin-left: 10px;

+ 32 - 10
app/pages/user/bind/add.vue

@@ -1,19 +1,41 @@
 <template>
 <template>
-	<view>
-		
+	<view class="main">
+		<view class="form_group">
+			<view class="lable re">手机号</view>
+			<input type="digit" v-model="item.phone" placeholder="请输入手机号" />
+		</view>
+		<button class="btn" @click="add()">确认</button>
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script>
 <script>
-	export default {
-		data() {
-			return {
-				
-			};
+export default {
+	data() {
+		return {
+			item: {}
+		};
+	},
+	methods: {
+		add() {
+			this.http.request({
+				url: '/app/user/bind',
+				method: 'POST',
+				data: this.item,
+				success: (res) => {
+					uni.showModal({
+						title: '提示',
+						content: '绑定成功',
+						showCancel: false,
+						success: (res) => {
+							uni.$emit('bind');
+							uni.navigateBack();
+						}
+					});
+				}
+			});
 		}
 		}
 	}
 	}
+};
 </script>
 </script>
 
 
-<style lang="scss">
-
-</style>
+<style lang="scss"></style>

+ 36 - 26
app/pages/user/bind/index.vue

@@ -1,20 +1,17 @@
 <template>
 <template>
 	<view class="main">
 	<view class="main">
 		<view class="list">
 		<view class="list">
-			<view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/knowledge/detail?id=' + item.id)">
+			<view class="item" v-for="(item, index) in list" :key="index" @click="go(item)">
 				<view class="title omit">
 				<view class="title omit">
-					<text class="icon" v-if="item.top === 1">&#xe61f;</text>
-					<text>{{ item.title }}</text>
-				</view>
-				<view class="desc">
-					<text>{{ item.type }}</text>
-					<text>发布于 {{ item.createTime }}</text>
+					<text>{{ item.patientName }}</text>
+					<text class="icon check" v-if="item.state == 1">&#xe63b;</text>
 				</view>
 				</view>
+				<view class="icon del" @click.stop="del(item)">&#xe641;</view>
 			</view>
 			</view>
 			<u-empty v-if="list.length == 0" text="你还未绑定就诊人"></u-empty>
 			<u-empty v-if="list.length == 0" text="你还未绑定就诊人"></u-empty>
 		</view>
 		</view>
 		<view class="mfooter">
 		<view class="mfooter">
-			<button class="btn" @click="go('/pages/job/position/manage/full_time_push')">
+			<button class="btn" @click="go('/pages/user/bind/add')">
 				<text class="icon">&#xe8d5;</text>
 				<text class="icon">&#xe8d5;</text>
 				<text>去绑定</text>
 				<text>去绑定</text>
 			</button>
 			</button>
@@ -31,20 +28,39 @@ export default {
 	},
 	},
 	onLoad(e) {
 	onLoad(e) {
 		this.getData();
 		this.getData();
+		uni.$on('bind', (res) => {
+			this.getData();
+		});
 	},
 	},
 	methods: {
 	methods: {
 		getData() {
 		getData() {
 			this.http.request({
 			this.http.request({
 				url: '/app/user/bind/list',
 				url: '/app/user/bind/list',
 				data: this.param,
 				data: this.param,
-				loading: 'false',
 				success: (res) => {
 				success: (res) => {
 					this.list = res.data.data;
 					this.list = res.data.data;
 				}
 				}
 			});
 			});
 		},
 		},
+		del(item) {
+			uni.showModal({
+				title: '提示',
+				content: '确定移除当前就诊人?',
+				success: (res) => {
+					if (res.confirm) {
+						this.http.request({
+							url: '/app/user/bind/remove/' + item.id,
+							success: (res) => {
+								uni.showToast({ title: '移除成功' });
+								this.list.splice(this.list.indexOf(item), 1);
+							}
+						});
+					}
+				}
+			});
+		},
 		go(url) {
 		go(url) {
-			uni.navigateTo({ url: url });
+			//uni.navigateTo({ url: url });
 		}
 		}
 	}
 	}
 };
 };
@@ -52,31 +68,25 @@ export default {
 
 
 <style lang="scss">
 <style lang="scss">
 .list {
 .list {
-	padding: 10px 12px;
 	background-color: white;
 	background-color: white;
-	margin: 10px;
 	border-radius: 10px;
 	border-radius: 10px;
 	.item {
 	.item {
-		border-radius: 5px;
-		padding: 13px 12px 13px 12px;
-		margin-bottom: 10px;
-		overflow: hidden;
+		padding: 16px 12px 16px 12px;
 		border-bottom: 1px solid $line;
 		border-bottom: 1px solid $line;
+		overflow: hidden;
 		.title {
 		.title {
 			font-size: 15px;
 			font-size: 15px;
 			font-weight: bold;
 			font-weight: bold;
-			.icon {
-				color: orangered;
-				padding-right: 3px;
+			.check {
+				color: $main-color;
+				padding-left: 5px;
 			}
 			}
 		}
 		}
-		.desc {
-			font-size: 14px;
-			padding-top: 10px;
-			color: $font-c;
-			text {
-				padding-right: 30px;
-			}
+		.del {
+			color: #f44336;
+			float: right;
+			margin-top: -20px;
+			font-size: 20px;
 		}
 		}
 	}
 	}
 }
 }

+ 22 - 1
app/pages/user/index.vue

@@ -3,7 +3,10 @@
 		<view class="user" @click="go('/pages/user/bind/index')">
 		<view class="user" @click="go('/pages/user/bind/index')">
 			<image :src="user.avatar ? ip + user.avatar : '../../static/favicon.png'" class="head"></image>
 			<image :src="user.avatar ? ip + user.avatar : '../../static/favicon.png'" class="head"></image>
 			<view class="con" v-if="user.id">
 			<view class="con" v-if="user.id">
-				<view class="nickName">{{ user.patientName ? user.patientName : '还未绑定就诊人' }}</view>
+				<view class="nickName">
+					{{ user.patientName ? user.patientName : '还未绑定就诊人' }}
+					<text class="icon" v-if="user.bindUserList.length > 1" @click.stop="show = true">&#xe6a7;</text>
+				</view>
 				<view class="welcome">欢迎使用岑溪人民医院小程序</view>
 				<view class="welcome">欢迎使用岑溪人民医院小程序</view>
 			</view>
 			</view>
 			<view class="con" v-else>
 			<view class="con" v-else>
@@ -39,6 +42,7 @@
 				<text class="icon arrow">&#xe62b;</text>
 				<text class="icon arrow">&#xe62b;</text>
 			</view>
 			</view>
 		</view>
 		</view>
+		<u-action-sheet round="20" :actions="user.bindUserList" key="patientName" @select="selectClick" cancelText="取消" :show="show" @close="show = false"></u-action-sheet>
 	</view>
 	</view>
 </template>
 </template>
 <script>
 <script>
@@ -70,6 +74,23 @@ export default {
 				}
 				}
 			});
 			});
 		},
 		},
+		//切换就诊人
+		selectClick(e) {
+			uni.showModal({
+				title: '提示',
+				content: '确定切换就诊人',
+				success: (res) => {
+					if (res.confirm) {
+						this.http.request({
+							url: '/app/user/bind/change/' + e.id,
+							success: (res) => {
+								this.getUserInfo();
+							}
+						});
+					}
+				}
+			});
+		},
 		go(url) {
 		go(url) {
 			if (this.hasLogin()) {
 			if (this.hasLogin()) {
 				uni.navigateTo({ url: url });
 				uni.navigateTo({ url: url });

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

@@ -68,7 +68,7 @@
 									<text
 									<text
 									    class="u-action-sheet__item-wrap__item__name"
 									    class="u-action-sheet__item-wrap__item__name"
 									    :style="[itemStyle(index)]"
 									    :style="[itemStyle(index)]"
-									>{{ item.name }}</text>
+									>{{ item.patientName }}</text>
 									<text
 									<text
 									    style="width: 90%;color: blue;margin-top: 5px;"
 									    style="width: 90%;color: blue;margin-top: 5px;"
 									    v-if="item.subname"
 									    v-if="item.subname"

+ 1 - 1
app/uni_modules/uview-ui/components/u-empty/u-empty.vue

@@ -89,7 +89,7 @@ $u-empty-slot-margin-top: 20rpx !default;
 		justify-content: center;
 		justify-content: center;
 		align-items: center;
 		align-items: center;
 		margin-top: -10px;
 		margin-top: -10px;
-		padding-bottom: 10px;
+		padding-bottom: 20px;
 	}
 	}
 }
 }
 .u-slot-wrap {
 .u-slot-wrap {

+ 16 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_UserController.java

@@ -3,6 +3,7 @@ package com.ruoyi.web.work.api;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.web.work.api.config.BaseController;
 import com.ruoyi.web.work.api.config.BaseController;
 import com.ruoyi.web.work.domain.BindUser;
 import com.ruoyi.web.work.domain.BindUser;
+import com.ruoyi.web.work.domain.dto.BindDto;
 import com.ruoyi.web.work.domain.dto.LoginDto;
 import com.ruoyi.web.work.domain.dto.LoginDto;
 import com.ruoyi.web.work.domain.dto.UserEditDto;
 import com.ruoyi.web.work.domain.dto.UserEditDto;
 import com.ruoyi.web.work.service.IBindUserService;
 import com.ruoyi.web.work.service.IBindUserService;
@@ -33,6 +34,21 @@ public class Api_UserController extends BaseController {
         return userService.login(dto);
         return userService.login(dto);
     }
     }
 
 
+    @PostMapping("/bind")
+    public AjaxResult bind(@Validated @RequestBody BindDto dto) throws ServerException {
+        return bindUserService.bind(dto);
+    }
+
+    @GetMapping(value = "/bind/remove/{id}")
+    public AjaxResult remove(@PathVariable("id") Long id) throws ServerException {
+        return bindUserService.remove(id);
+    }
+
+    @GetMapping(value = "/bind/change/{id}")
+    public AjaxResult change(@PathVariable("id") Long id) throws ServerException {
+        return bindUserService.change(id);
+    }
+
     @GetMapping("/bind/list")
     @GetMapping("/bind/list")
     public AjaxResult list(BindUser bindUser) {
     public AjaxResult list(BindUser bindUser) {
         bindUser.setUserId(getUser().getId());
         bindUser.setUserId(getUser().getId());

+ 6 - 8
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/BindUser.java

@@ -27,20 +27,18 @@ public class BindUser{
     @ApiModelProperty(value = "小程序id")
     @ApiModelProperty(value = "小程序id")
     private Long userId;
     private Long userId;
 
 
+    @ApiModelProperty(value = "患者姓名")
+    private String patientName;
+
+    @ApiModelProperty(value = "状态:0=未启用,1=当前就诊人")
+    private Integer state;
+
     @TableField(fill = FieldFill.INSERT)
     @TableField(fill = FieldFill.INSERT)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
     private Date createTime;
 
 
-    @ApiModelProperty(value = "患者姓名")
-    @TableField(exist = false)
-    private String patientName;
-
     @ApiModelProperty(value = "患者手机号")
     @ApiModelProperty(value = "患者手机号")
     @TableField(exist = false)
     @TableField(exist = false)
     private String phone;
     private String phone;
 
 
-    @ApiModelProperty(value = "患者身份证")
-    @TableField(exist = false)
-    private String sfzh;
-
 }
 }

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

@@ -9,6 +9,8 @@ import lombok.Data;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 
 
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
+
 /**
 /**
  * @author lsw
  * @author lsw
  * @date 2024-07-16
  * @date 2024-07-16
@@ -48,6 +50,9 @@ public class User{
     private Date updateTime;
     private Date updateTime;
 
 
     @TableField(exist = false)
     @TableField(exist = false)
+    private List<BindUser> bindUserList;
+
+    @TableField(exist = false)
     private String token;
     private String token;
 
 
 }
 }

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

@@ -0,0 +1,14 @@
+package com.ruoyi.web.work.domain.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+public class BindDto {
+
+    @NotBlank(message = "手机号不能为空")
+    @ApiModelProperty(value = "预留手机号")
+    private String phone;
+}

+ 11 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/mapper/BindUserMapper.java

@@ -1,8 +1,10 @@
 package com.ruoyi.web.work.mapper;
 package com.ruoyi.web.work.mapper;
 
 
-import java.util.List;
-import com.ruoyi.web.work.domain.BindUser;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.web.work.domain.BindUser;
+import com.ruoyi.web.work.domain.Patient;
+
+import java.util.List;
 
 
 /**
 /**
  * @author lsw
  * @author lsw
@@ -10,4 +12,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
  */
 public interface BindUserMapper extends BaseMapper<BindUser> {
 public interface BindUserMapper extends BaseMapper<BindUser> {
     List<BindUser> selectList(BindUser bindUser);
     List<BindUser> selectList(BindUser bindUser);
+
+    Patient selectPatient(Patient patient);
+
+    BindUser selectBindUser(BindUser bindUser);
+
+    boolean changeBindUser(BindUser bindUser);
+
 }
 }

+ 31 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/IBindUserService.java

@@ -1,13 +1,41 @@
 package com.ruoyi.web.work.service;
 package com.ruoyi.web.work.service;
 
 
-import java.util.List;
-import com.ruoyi.web.work.domain.BindUser;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.web.work.domain.BindUser;
+import com.ruoyi.web.work.domain.dto.BindDto;
+
+import java.rmi.ServerException;
+import java.util.List;
 
 
 /**
 /**
  * @author lsw
  * @author lsw
  * @date 2024-07-26
  * @date 2024-07-26
  */
  */
-public interface IBindUserService extends IService<BindUser>{
+public interface IBindUserService extends IService<BindUser> {
     List<BindUser> selectList(BindUser bindUser);
     List<BindUser> selectList(BindUser bindUser);
+
+    /**
+     * 绑定就诊人
+     *
+     * @param dto
+     * @return
+     */
+    AjaxResult bind(BindDto dto) throws ServerException;
+
+    /**
+     * 移除就诊人
+     *
+     * @param id
+     * @return
+     */
+    AjaxResult remove(Long id) throws ServerException;
+
+    /**
+     * 切换就诊人
+     *
+     * @param id
+     * @return
+     */
+    AjaxResult change(Long id) throws ServerException;
 }
 }

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

@@ -1,12 +1,22 @@
 package com.ruoyi.web.work.service.impl;
 package com.ruoyi.web.work.service.impl;
 
 
-import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.web.work.mapper.BindUserMapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.web.work.api.config.TokenServices;
+import com.ruoyi.web.work.api.util.AppUtil;
 import com.ruoyi.web.work.domain.BindUser;
 import com.ruoyi.web.work.domain.BindUser;
+import com.ruoyi.web.work.domain.Patient;
+import com.ruoyi.web.work.domain.User;
+import com.ruoyi.web.work.domain.dto.BindDto;
+import com.ruoyi.web.work.mapper.BindUserMapper;
 import com.ruoyi.web.work.service.IBindUserService;
 import com.ruoyi.web.work.service.IBindUserService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.web.work.service.IUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.rmi.ServerException;
+import java.util.List;
 
 
 /**
 /**
  * @author lsw
  * @author lsw
@@ -17,8 +27,77 @@ public class BindUserServiceImpl extends ServiceImpl<BindUserMapper, BindUser> i
     @Autowired
     @Autowired
     private BindUserMapper bindUserMapper;
     private BindUserMapper bindUserMapper;
 
 
+    @Autowired
+    IUserService userService;
+
+    @Autowired
+    private TokenServices tokenService;
+
     @Override
     @Override
     public List<BindUser> selectList(BindUser bindUser) {
     public List<BindUser> selectList(BindUser bindUser) {
         return bindUserMapper.selectList(bindUser);
         return bindUserMapper.selectList(bindUser);
     }
     }
+
+    @Transactional
+    @Override
+    public AjaxResult bind(BindDto dto) throws ServerException {
+        Patient patient = bindUserMapper.selectPatient(new Patient().setPhone(dto.getPhone()));
+        if (patient == null) {
+            return AjaxResult.error("预留的就诊人手机号不存在");
+        }
+        BindUser bindUser = new BindUser();
+        bindUser.setPatientId(patient.getId());
+        bindUser.setUserId(AppUtil.getUser().getId());
+        bindUser.setPatientName(patient.getName());
+        if (bindUserMapper.selectBindUser(bindUser) != null) {
+            return AjaxResult.error("你已绑定过该就诊人");
+        }
+        //如果只有一个就诊人直接设置成当前就诊人
+        List<BindUser> bindUserList = bindUserMapper.selectList(new BindUser().setUserId(AppUtil.getUser().getId()));
+        if (bindUserList.size() == 0) {
+            bindUser.setState(1);
+            User user = AppUtil.getUser();
+            user.setPatientId(patient.getId());
+            user.setPatientName(patient.getName());
+            if (!userService.updateById(user)) {
+                throw new ServerException("绑定就诊人失败");
+            }
+        }
+        if (!save(bindUser)) {
+            throw new ServerException("绑定就诊人失败");
+        }
+        return AjaxResult.success();
+    }
+
+    @Override
+    public AjaxResult remove(Long id) throws ServerException {
+        BindUser bindUser = getById(id);
+        if (bindUser == null || !bindUser.getUserId().equals(AppUtil.getUser().getId())) {
+            return AjaxResult.error("数据不存在或非法操作");
+        }
+        if (!removeById(id)) {
+            throw new ServerException("删除就诊人失败");
+        }
+        return AjaxResult.success();
+    }
+
+    @Transactional
+    @Override
+    public AjaxResult change(Long id) throws ServerException {
+        BindUser bindUser = getById(id);
+        if (bindUser == null || !bindUser.getUserId().equals(AppUtil.getUser().getId())) {
+            return AjaxResult.error("数据不存在或非法操作");
+        }
+        bindUserMapper.changeBindUser(bindUser);
+        bindUser.setState(1);
+        updateById(bindUser);
+        User user = AppUtil.getUser();
+        user.setPatientId(bindUser.getPatientId());
+        user.setPatientName(bindUser.getPatientName());
+        if (!userService.updateById(user)) {
+            throw new ServerException("切换就诊人失败");
+        }
+        tokenService.setLoginUser(userService.getById(AppUtil.getUser().getId()).setToken(AppUtil.getUser().getToken()));
+        return AjaxResult.success();
+    }
 }
 }

+ 8 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/UserServiceImpl.java

@@ -9,10 +9,12 @@ import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.http.HttpUtils;
 import com.ruoyi.common.utils.http.HttpUtils;
 import com.ruoyi.web.work.api.config.TokenServices;
 import com.ruoyi.web.work.api.config.TokenServices;
 import com.ruoyi.web.work.api.util.AppUtil;
 import com.ruoyi.web.work.api.util.AppUtil;
+import com.ruoyi.web.work.domain.BindUser;
 import com.ruoyi.web.work.domain.User;
 import com.ruoyi.web.work.domain.User;
 import com.ruoyi.web.work.domain.dto.LoginDto;
 import com.ruoyi.web.work.domain.dto.LoginDto;
 import com.ruoyi.web.work.domain.dto.UserEditDto;
 import com.ruoyi.web.work.domain.dto.UserEditDto;
 import com.ruoyi.web.work.mapper.UserMapper;
 import com.ruoyi.web.work.mapper.UserMapper;
+import com.ruoyi.web.work.service.IBindUserService;
 import com.ruoyi.web.work.service.IUserService;
 import com.ruoyi.web.work.service.IUserService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,6 +37,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     private TokenServices tokenService;
     private TokenServices tokenService;
 
 
     @Autowired
     @Autowired
+    IBindUserService bindUserService;
+
+    @Autowired
     private Environment env;
     private Environment env;
 
 
     @Override
     @Override
@@ -90,6 +95,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
 
 
     @Override
     @Override
     public AjaxResult info() {
     public AjaxResult info() {
-        return AjaxResult.success(getById(AppUtil.getUser().getId()));
+        User user =getById(AppUtil.getUser().getId());
+        user.setBindUserList(bindUserService.selectList(new BindUser().setUserId(user.getId())));
+        return AjaxResult.success(user);
     }
     }
 }
 }

+ 12 - 0
ruoyi-admin/src/main/resources/mapper/work/BindUserMapper.xml

@@ -19,4 +19,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         </where>
     </select>
     </select>
 
 
+    <select id="selectPatient" resultType="com.ruoyi.web.work.domain.Patient">
+        SELECT * FROM tb_patient WHERE phone=#{phone}
+    </select>
+
+    <select id="selectBindUser" resultType="com.ruoyi.web.work.domain.BindUser">
+        SELECT * FROM tb_bind_user WHERE user_id=#{userId} AND patient_id=#{patientId}
+    </select>
+
+    <update id="changeBindUser">
+        UPDATE tb_bind_user SET state = 0 WHERE user_id=#{userId}
+    </update>
+
 </mapper>
 </mapper>

+ 18 - 0
ruoyi-admin/src/test/test/test.java

@@ -0,0 +1,18 @@
+package test;
+
+import com.ruoyi.RuoYiApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = RuoYiApplication.class)
+public class test {
+
+    @Test
+    public void aa() {
+        System.out.println("单元测试");
+    }
+
+}

+ 0 - 6
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java

@@ -66,12 +66,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
     public AjaxResult treeList() {
     public AjaxResult treeList() {
         List<Map<String, Object>> all = deptMapper.treeList();
         List<Map<String, Object>> all = deptMapper.treeList();
         List<Map<String, Object>> list = all.stream().filter(r -> r.get("parentId").toString().equals("100")).collect(Collectors.toList());
         List<Map<String, Object>> list = all.stream().filter(r -> r.get("parentId").toString().equals("100")).collect(Collectors.toList());
-        for (Map record : list) {
-            List<Map<String, Object>> children = all.stream().filter(r -> r.get("parentId").toString().equals(record.get("deptId").toString())).collect(Collectors.toList());
-            if (children.size() > 0) {
-                record.put("children", children);
-            }
-        }
         return AjaxResult.success(list);
         return AjaxResult.success(list);
     }
     }
 
 

+ 3 - 0
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -67,6 +67,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<if test="userName != null and userName != ''">
 		<if test="userName != null and userName != ''">
 			AND u.user_name like concat('%', #{userName}, '%')
 			AND u.user_name like concat('%', #{userName}, '%')
 		</if>
 		</if>
+		<if test="nickName != null and nickName != ''">
+			AND u.nick_name like concat('%', #{nickName}, '%')
+		</if>
 		<if test="status != null and status != ''">
 		<if test="status != null and status != ''">
 			AND u.status = #{status}
 			AND u.status = #{status}
 		</if>
 		</if>