Procházet zdrojové kódy

账户对应对公司多公司

liangpeile před 1 rokem
rodič
revize
97f3992d71

+ 15 - 15
medical_history-vue/src/views/admin/modules/AdminSpecialistUserForm.vue

@@ -167,21 +167,21 @@
       //     callback()
       //   }
       // },
-      validateC(rule, value, callback){
-        var params = {
-          tableName: 'admin_user',
-          fieldName: 'phone',
-          fieldVal: value,
-          dataId:this.model.id
-        };
-        duplicateCheck(params).then((res) => {
-          if (res.success) {
-            callback()
-          } else {
-            callback("手机号已存在!")
-          }
-        })
-      },
+      // validateC(rule, value, callback){
+      //   var params = {
+      //     tableName: 'admin_user',
+      //     fieldName: 'phone',
+      //     fieldVal: value,
+      //     dataId:this.model.id
+      //   };
+      //   duplicateCheck(params).then((res) => {
+      //     if (res.success) {
+      //       callback()
+      //     } else {
+      //       callback("手机号已存在!")
+      //     }
+      //   })
+      // },
       add () {
         this.edit(this.modelDefault);
       },

+ 29 - 13
medical_history/jeecg-boot-module-system/src/main/java/org/jeecg/modules/adminuser/controller/AdminDoctorUserController.java

@@ -75,31 +75,29 @@ public class AdminDoctorUserController extends JeecgController<AdminUser, IAdmin
     //@AutoLog(value = "用户管理-分页列表查询")
     @ApiOperation(value = "用户管理-分页列表查询", notes = "用户管理-分页列表查询")
     @GetMapping(value = "/list")
-    public Result<IPage<AdminUser>> queryPageList(AdminUser adminUser,
-                                                  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                  HttpServletRequest req, String ssname, String ssphone, String ssksname, String ssdwname) {
-
+    public Result<?> queryPageList(AdminUser adminUser,
+                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                   HttpServletRequest req, String ssname, String ssphone, String ssksname, String ssdwname) {
 
 
         QueryWrapper<AdminUser> queryWrapper = QueryGenerator.initQueryWrapper(adminUser, req.getParameterMap());
         ArrayList<AdminUser> adminUsers = new ArrayList<>();
-        IPage<AdminUser> pageList = null;
-
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         List<String> role = sysUserService.getRole(sysUser.getUsername());
-
         QueryWrapper<AdminCompSelect> adminCompSelectLambdaQueryWrapper = new QueryWrapper<>();
-
         if (!role.contains("admin")) {
             adminCompSelectLambdaQueryWrapper.eq("sys_org_code", sysUser.getOrgCode());
         }
+        adminCompSelectLambdaQueryWrapper.eq("doctor_and_specialist", "1");
+
+
         List<AdminCompSelect> list = adminCompSelectService.list(adminCompSelectLambdaQueryWrapper);
+        Page<AdminUser> pageList = new Page<>();
 
         for (AdminCompSelect adminCompSelect : list) {
             String orderId = adminCompSelect.getOrderId();
 
-            queryWrapper.eq("doctor_and_specialist", "1");
             if (ssname != null) {
                 queryWrapper.like("name", ssname);
             }
@@ -113,9 +111,9 @@ public class AdminDoctorUserController extends JeecgController<AdminUser, IAdmin
                 queryWrapper.like("dwname", ssdwname);
             }
             queryWrapper.eq("id", orderId);
-
             Page<AdminUser> page = new Page<AdminUser>(pageNo, pageSize);
             pageList = adminUserService.page(page, queryWrapper);
+
             List<AdminUser> records = pageList.getRecords();
             for (AdminUser record : records) {
                 record.setAvatar(adminCompSelect.getAvatar());
@@ -124,7 +122,9 @@ public class AdminDoctorUserController extends JeecgController<AdminUser, IAdmin
                 record.setDwname(adminCompSelect.getDwName());
                 adminUsers.add(record);
             }
+
         }
+
         pageList.setRecords(adminUsers);
 
 
@@ -193,7 +193,14 @@ public class AdminDoctorUserController extends JeecgController<AdminUser, IAdmin
     @ApiOperation(value = "用户管理-通过id删除", notes = "用户管理-通过id删除")
     @DeleteMapping(value = "/delete")
     public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
-        adminUserService.removeById(id);
+
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        AdminUser adminUser = adminUserService.getById(id);
+        LambdaQueryWrapper<AdminCompSelect> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AdminCompSelect::getSysOrgCode, sysUser.getOrgCode());
+        queryWrapper.eq(AdminCompSelect::getDoctorAndSpecialist, "1");
+        queryWrapper.eq(AdminCompSelect::getPhone, adminUser.getPhone());
+        adminCompSelectService.remove(queryWrapper);
         return Result.OK("删除成功!");
     }
 
@@ -207,7 +214,16 @@ public class AdminDoctorUserController extends JeecgController<AdminUser, IAdmin
     @ApiOperation(value = "用户管理-批量删除", notes = "用户管理-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        this.adminUserService.removeByIds(Arrays.asList(ids.split(",")));
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String[] split = ids.split(",");
+        for (int i = 0; i < split.length; i++) {
+            AdminUser adminUser = adminUserService.getById(split[i]);
+            LambdaQueryWrapper<AdminCompSelect> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(AdminCompSelect::getSysOrgCode, sysUser.getOrgCode());
+            queryWrapper.eq(AdminCompSelect::getDoctorAndSpecialist, "1");
+            queryWrapper.eq(AdminCompSelect::getPhone, adminUser.getPhone());
+            adminCompSelectService.remove(queryWrapper);
+        }
         return Result.OK("批量删除成功!");
     }
 

+ 235 - 195
medical_history/jeecg-boot-module-system/src/main/java/org/jeecg/modules/adminuser/controller/AdminSpecialistUserController.java

@@ -15,7 +15,9 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.PasswordUtil;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.adminuser.entity.AdminCompSelect;
 import org.jeecg.modules.adminuser.entity.AdminUser;
+import org.jeecg.modules.adminuser.service.IAdminCompSelectService;
 import org.jeecg.modules.adminuser.service.IAdminUserService;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -29,117 +31,136 @@ import org.springframework.web.servlet.ModelAndView;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
 /**
-* @Description: 专家用户管理
-* @Author: jeecg-boot
-* @Date:   2022-12-16
-* @Version: V1.0
-*/
-@Api(tags="专家用户管理")
+ * @Description: 专家用户管理
+ * @Author: jeecg-boot
+ * @Date: 2022-12-16
+ * @Version: V1.0
+ */
+@Api(tags = "专家用户管理")
 @RestController
 @RequestMapping("/adminSpecialistUser/adminUser")
 @Slf4j
 public class AdminSpecialistUserController extends JeecgController<AdminUser, IAdminUserService> {
-   @Autowired
-   private IAdminUserService adminUserService;
-   @Autowired
-   private ISysUserService sysUserService;
+    @Autowired
+    private IAdminUserService adminUserService;
+    @Autowired
+    private ISysUserService sysUserService;
+    @Autowired
+    private IAdminCompSelectService adminCompSelectService;
 
-   /**
-    * 分页列表查询
-    *
-    * @param adminUser
-    * @param pageNo
-    * @param pageSize
-    * @param req
-    * @return
-    */
-   //@AutoLog(value = "用户管理-分页列表查询")
-   @ApiOperation(value="用户管理-分页列表查询", notes="用户管理-分页列表查询")
-   @GetMapping(value = "/list")
-   public Result<IPage<AdminUser>> queryPageList(AdminUser adminUser,
-                                                 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-                                                 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-                                                 HttpServletRequest req,String ssname,String ssphone,String ssksname,String ssdwname) {
-       QueryWrapper<AdminUser> queryWrapper = QueryGenerator.initQueryWrapper(adminUser, req.getParameterMap());
-       queryWrapper.eq( "doctor_and_specialist","2" );
-       if (ssname != null){
-           queryWrapper.like("name",ssname);
-       }
-       if (ssphone != null){
-           queryWrapper.like("phone",ssphone);
-       }
-       if (ssksname != null){
-           queryWrapper.like("ksname",ssksname);
-       }
-       if (ssdwname != null){
-           queryWrapper.like("dwname",ssdwname);
-       }
-       LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-       List<String> role = sysUserService.getRole(sysUser.getUsername());
-       if (!role.contains("admin")){
-           queryWrapper.eq("sys_org_code", sysUser.getOrgCode());
-       }
-       Page<AdminUser> page = new Page<AdminUser>(pageNo, pageSize);
-       IPage<AdminUser> pageList = adminUserService.page(page, queryWrapper);
-       return Result.OK(pageList);
-   }
+    /**
+     * 分页列表查询
+     *
+     * @param adminUser
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "用户管理-分页列表查询")
+    @ApiOperation(value = "用户管理-分页列表查询", notes = "用户管理-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<AdminUser>> queryPageList(AdminUser adminUser,
+                                                  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                  HttpServletRequest req, String ssname, String ssphone, String ssksname, String ssdwname) {
+
+        QueryWrapper<AdminUser> queryWrapper = QueryGenerator.initQueryWrapper(adminUser, req.getParameterMap());
+        ArrayList<AdminUser> adminUsers = new ArrayList<>();
+        Page<AdminUser> pageList = new Page<>();
+
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        List<String> role = sysUserService.getRole(sysUser.getUsername());
+
+        QueryWrapper<AdminCompSelect> adminCompSelectLambdaQueryWrapper = new QueryWrapper<>();
+
+        if (!role.contains("admin")) {
+            adminCompSelectLambdaQueryWrapper.eq("sys_org_code", sysUser.getOrgCode());
+        }
+        adminCompSelectLambdaQueryWrapper.eq("doctor_and_specialist", "2");
+        List<AdminCompSelect> list = adminCompSelectService.list(adminCompSelectLambdaQueryWrapper);
+
+        for (AdminCompSelect adminCompSelect : list) {
+            String orderId = adminCompSelect.getOrderId();
+
+            if (ssname != null) {
+                queryWrapper.like("name", ssname);
+            }
+            if (ssphone != null) {
+                queryWrapper.like("phone", ssphone);
+            }
+            if (ssksname != null) {
+                queryWrapper.like("ksname", ssksname);
+            }
+            if (ssdwname != null) {
+                queryWrapper.like("dwname", ssdwname);
+            }
+            queryWrapper.eq("id", orderId);
+
+            Page<AdminUser> page = new Page<AdminUser>(pageNo, pageSize);
+            pageList = adminUserService.page(page, queryWrapper);
+            List<AdminUser> records = pageList.getRecords();
+            for (AdminUser record : records) {
+                record.setAvatar(adminCompSelect.getAvatar());
+                record.setCardPic(adminCompSelect.getCardPic());
+                record.setKsname(adminCompSelect.getKsName());
+                record.setDwname(adminCompSelect.getDwName());
+                adminUsers.add(record);
+            }
+        }
+        pageList.setRecords(adminUsers);
+
+
+        return Result.OK(pageList);
+    }
 
     @PostMapping(value = "/num")
     public Result<Integer> num() {
         QueryWrapper<AdminUser> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq( "doctor_and_specialist","2" );
+        queryWrapper.eq("doctor_and_specialist", "2");
         Integer num = adminUserService.num(queryWrapper);
         return Result.OK(num);
     }
 
-        /**
-         *   添加
-         *
-         * @param adminUser
-         * @return
-         */
+    /**
+     * 添加
+     *
+     * @param adminUser
+     * @return
+     */
     @AutoLog(value = "用户管理-添加")
-    @ApiOperation(value="用户管理-添加", notes="用户管理-添加")
+    @ApiOperation(value = "用户管理-添加", notes = "用户管理-添加")
     @PostMapping(value = "/add")
-    public Result<String> add(@RequestBody AdminUser adminUser) {
-        adminUser.setDoctorAndSpecialist("2");
-        String salt = oConvertUtils.randomGen(8);
-        adminUser.setSalt(salt);
-        if (adminUser.getPassword()==null){
-            adminUser.setPassword( "123456" );
-        }
-        if (adminUser.getPassword().equals( "" )){
-            adminUser.setPassword( "123456" );
-        }
-        String passwordEncode = PasswordUtil.encrypt(adminUser.getPhone(), adminUser.getPassword(), salt);
-        adminUser.setPassword(passwordEncode);
-        adminUserService.save(adminUser);
-        return Result.OK("添加成功!");
+    public Result<?> add(@RequestBody AdminUser adminUser) {
+
+        return adminUserService.saveMain(adminUser);
+
     }
 
     /**
-     *  编辑
+     * 编辑
      *
      * @param adminUser
      * @return
      */
     @AutoLog(value = "用户管理-编辑")
-    @ApiOperation(value="用户管理-编辑", notes="用户管理-编辑")
-    @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+    @ApiOperation(value = "用户管理-编辑", notes = "用户管理-编辑")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
     public Result<String> edit(@RequestBody AdminUser adminUser) {
-        adminUserService.updateById(adminUser);
+        adminUserService.updateByUser2(adminUser);
         return Result.OK("编辑成功!");
     }
 
 
-    @RequestMapping(value = "/updatePassWord", method = {RequestMethod.PUT,RequestMethod.POST})
+    @RequestMapping(value = "/updatePassWord", method = {RequestMethod.PUT, RequestMethod.POST})
     public Result<String> updatePassWord(@RequestBody AdminUser adminUser) {
-        if (!adminUser.getPassword().equals( "" )){
+        if (!adminUser.getPassword().equals("")) {
             AdminUser u = adminUserService.getOne(new LambdaQueryWrapper<AdminUser>().eq(AdminUser::getPhone,
                     adminUser.getPhone()));
             if (u == null) {
@@ -152,132 +173,151 @@ public class AdminSpecialistUserController extends JeecgController<AdminUser, IA
             adminUser.setPassword(passwordEncode);
             adminUserService.updateById(adminUser);
             return Result.OK("修改成功!");
-        }else {
+        } else {
             return Result.error("不能为空!");
         }
     }
-   /**
-    *   通过id删除
-    *
-    * @param id
-    * @return
-    */
-   @AutoLog(value = "用户管理-通过id删除")
-   @ApiOperation(value="用户管理-通过id删除", notes="用户管理-通过id删除")
-   @DeleteMapping(value = "/delete")
-   public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-       adminUserService.removeById(id);
-       return Result.OK("删除成功!");
-   }
 
-   /**
-    *  批量删除
-    *
-    * @param ids
-    * @return
-    */
-   @AutoLog(value = "用户管理-批量删除")
-   @ApiOperation(value="用户管理-批量删除", notes="用户管理-批量删除")
-   @DeleteMapping(value = "/deleteBatch")
-   public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-       this.adminUserService.removeByIds(Arrays.asList(ids.split(",")));
-       return Result.OK("批量删除成功!");
-   }
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "用户管理-通过id删除")
+    @ApiOperation(value = "用户管理-通过id删除", notes = "用户管理-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        AdminUser adminUser = adminUserService.getById(id);
+
+        LambdaQueryWrapper<AdminCompSelect> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AdminCompSelect::getSysOrgCode, sysUser.getOrgCode());
+        queryWrapper.eq(AdminCompSelect::getDoctorAndSpecialist, "2");
+        queryWrapper.eq(AdminCompSelect::getPhone, adminUser.getPhone());
+        adminCompSelectService.remove(queryWrapper);
+
+
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "用户管理-批量删除")
+    @ApiOperation(value = "用户管理-批量删除", notes = "用户管理-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String[] split = ids.split(",");
+        for (int i = 0; i < split.length; i++) {
+            AdminUser adminUser = adminUserService.getById(split[i]);
+            LambdaQueryWrapper<AdminCompSelect> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(AdminCompSelect::getSysOrgCode, sysUser.getOrgCode());
+            queryWrapper.eq(AdminCompSelect::getDoctorAndSpecialist, "2");
+            queryWrapper.eq(AdminCompSelect::getPhone, adminUser.getPhone());
+            adminCompSelectService.remove(queryWrapper);
+        }
+        return Result.OK("批量删除成功!");
+    }
 
-   /**
-    * 通过id查询
-    *
-    * @param id
-    * @return
-    */
-   //@AutoLog(value = "用户管理-通过id查询")
-   @ApiOperation(value="用户管理-通过id查询", notes="用户管理-通过id查询")
-   @GetMapping(value = "/queryById")
-   public Result<AdminUser> queryById(@RequestParam(name="id",required=true) String id) {
-       AdminUser adminUser = adminUserService.getById(id);
-       if(adminUser==null) {
-           return Result.error("未找到对应数据",null);
-       }
-       return Result.OK(adminUser);
-   }
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "用户管理-通过id查询")
+    @ApiOperation(value = "用户管理-通过id查询", notes = "用户管理-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<AdminUser> queryById(@RequestParam(name = "id", required = true) String id) {
+        AdminUser adminUser = adminUserService.getById(id);
+        if (adminUser == null) {
+            return Result.error("未找到对应数据", null);
+        }
+        return Result.OK(adminUser);
+    }
 
-   /**
-   * 导出excel
-   *
-   * @param request
-   * @param adminUser
-   */
-   @RequestMapping(value = "/exportXls")
-   public ModelAndView exportXls(HttpServletRequest request, AdminUser adminUser,String ssname,String ssphone,String ssksname,String ssdwname) {
-       adminUser.setName(ssname);
-       adminUser.setPhone(ssphone);
-       adminUser.setKsname(ssksname);
-       adminUser.setDwname(ssdwname);
-       adminUser.setDoctorAndSpecialist("2");
-       return super.exportXls(request, adminUser, AdminUser.class, "专家账户管理");
-   }
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param adminUser
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, AdminUser adminUser, String ssname, String ssphone, String ssksname, String ssdwname) {
+        adminUser.setName(ssname);
+        adminUser.setPhone(ssphone);
+        adminUser.setKsname(ssksname);
+        adminUser.setDwname(ssdwname);
+        adminUser.setDoctorAndSpecialist("2");
+        return super.exportXls(request, adminUser, AdminUser.class, "专家账户管理");
+    }
 
-   /**
+    /**
      * 通过excel导入数据
-   *
-   * @param request
-   * @param response
-   * @return
-   */
-   @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-   public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
 //        return super.importExcel1(request, response, AdminUser.class);
-       MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-       Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-       for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-           MultipartFile file = entity.getValue();// 获取上传文件对象
-           ImportParams params = new ImportParams();
-           params.setTitleRows(2);
-           params.setHeadRows(1);
-           params.setNeedSave(true);
-           try {
-               List<AdminUser> list = ExcelImportUtil.importExcel(file.getInputStream(), AdminUser.class, params);
-               int s = list.size();
-               for (int i = 0;i<s;i++){
-                   list.get( i ).setDoctorAndSpecialist("2");
-                   String salt = oConvertUtils.randomGen(8);
-                   list.get( i ).setSalt(salt);
-                   if (list.get( i ).getPassword()==null){
-                       list.get( i ).setPassword( "123456" );
-                   }
-                   if (list.get( i ).getPassword().equals( "" )){
-                       list.get( i ).setPassword( "123456" );
-                   }
-                   String passwordEncode = PasswordUtil.encrypt(list.get( i ).getPhone(), list.get( i ).getPassword(), salt);
-                   list.get( i ).setPassword(passwordEncode);
-               }
-               //update-begin-author:taoyan date:20190528 for:批量插入数据
-               long start = System.currentTimeMillis();
-               service.saveBatch(list);
-               //400条 saveBatch消耗时间1592毫秒  循环插入消耗时间1947毫秒
-               //1200条  saveBatch消耗时间3687毫秒 循环插入消耗时间5212毫秒
-               log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
-               //update-end-author:taoyan date:20190528 for:批量插入数据
-               return Result.ok("文件导入成功!数据行数:" + list.size());
-           } catch (Exception e) {
-               //update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示
-               String msg = e.getMessage();
-               log.error(msg, e);
-               if(msg!=null && msg.indexOf("Duplicate entry")>=0){
-                   return Result.error("文件导入失败:有重复数据!");
-               }else{
-                   return Result.error("文件导入失败:" + e.getMessage());
-               }
-               //update-end-author:taoyan date:20211124 for: 导入数据重复增加提示
-           } finally {
-               try {
-                   file.getInputStream().close();
-               } catch (IOException e) {
-                   e.printStackTrace();
-               }
-           }
-       }
-       return Result.error("文件导入失败!");
-   }
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();// 获取上传文件对象
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<AdminUser> list = ExcelImportUtil.importExcel(file.getInputStream(), AdminUser.class, params);
+                int s = list.size();
+                for (int i = 0; i < s; i++) {
+                    list.get(i).setDoctorAndSpecialist("2");
+                    String salt = oConvertUtils.randomGen(8);
+                    list.get(i).setSalt(salt);
+                    if (list.get(i).getPassword() == null) {
+                        list.get(i).setPassword("123456");
+                    }
+                    if (list.get(i).getPassword().equals("")) {
+                        list.get(i).setPassword("123456");
+                    }
+                    String passwordEncode = PasswordUtil.encrypt(list.get(i).getPhone(), list.get(i).getPassword(), salt);
+                    list.get(i).setPassword(passwordEncode);
+                }
+                //update-begin-author:taoyan date:20190528 for:批量插入数据
+                long start = System.currentTimeMillis();
+                service.saveBatch(list);
+                //400条 saveBatch消耗时间1592毫秒  循环插入消耗时间1947毫秒
+                //1200条  saveBatch消耗时间3687毫秒 循环插入消耗时间5212毫秒
+                log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
+                //update-end-author:taoyan date:20190528 for:批量插入数据
+                return Result.ok("文件导入成功!数据行数:" + list.size());
+            } catch (Exception e) {
+                //update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示
+                String msg = e.getMessage();
+                log.error(msg, e);
+                if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
+                    return Result.error("文件导入失败:有重复数据!");
+                } else {
+                    return Result.error("文件导入失败:" + e.getMessage());
+                }
+                //update-end-author:taoyan date:20211124 for: 导入数据重复增加提示
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.error("文件导入失败!");
+    }
 
 }

+ 4 - 0
medical_history/jeecg-boot-module-system/src/main/java/org/jeecg/modules/adminuser/entity/AdminCompSelect.java

@@ -79,5 +79,9 @@ public class AdminCompSelect implements Serializable {
     @ApiModelProperty(value = "证件照")
     private String cardPic;
 
+    /**医生还是专家  1是医生  2是专家*/
+    @ApiModelProperty(value = "医生还是专家  1是医生  2是专家")
+    private String doctorAndSpecialist;
+
 
 }

+ 3 - 0
medical_history/jeecg-boot-module-system/src/main/java/org/jeecg/modules/adminuser/service/IAdminUserService.java

@@ -35,5 +35,8 @@ public interface IAdminUserService extends IService<AdminUser> {
     //获取用户签约状态
     Result<?> getApiUserSignStatus(String authorization);
 
+    void updateByUser2(AdminUser adminUser);
     void updateByUser(AdminUser adminUser);
+
+    Result<?> saveMain(AdminUser adminUser);
 }

+ 109 - 0
medical_history/jeecg-boot-module-system/src/main/java/org/jeecg/modules/adminuser/service/impl/AdminUserServiceImpl.java

@@ -125,6 +125,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
 
         QueryWrapper<AdminUser> adminUserQueryWrapper = new QueryWrapper<>();
         adminUserQueryWrapper.eq("phone", phone);
+        adminUserQueryWrapper.eq("doctor_and_specialist", "1");
         AdminUser adminUsers = adminUserService.getOne(adminUserQueryWrapper);
 
         if (null != adminUsers) {
@@ -138,12 +139,14 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
             adminCompSelect.setDwName(adminUser.getDwname());
             adminCompSelect.setAvatar(adminUser.getAvatar());
             adminCompSelect.setCardPic(adminUser.getCardPic());
+            adminCompSelect.setDoctorAndSpecialist("1");
 
 
             QueryWrapper<AdminCompSelect> adminCompSelectQueryWrapper = new QueryWrapper<>();
             adminCompSelectQueryWrapper.eq("phone", phone);
             adminCompSelectQueryWrapper.eq("comp_name", compName);
             adminCompSelectQueryWrapper.eq("sys_org_code", adminUser.getSysOrgCode());
+            adminCompSelectQueryWrapper.eq("doctor_and_specialist", "1");
             List<AdminCompSelect> list = adminCompSelectService.list(adminCompSelectQueryWrapper);
 
             if (null != list && list.size() > 0) {
@@ -163,11 +166,13 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
             adminCompSelect.setDwName(adminUser.getDwname());
             adminCompSelect.setAvatar(adminUser.getAvatar());
             adminCompSelect.setCardPic(adminUser.getCardPic());
+            adminCompSelect.setDoctorAndSpecialist("1");
 
             QueryWrapper<AdminCompSelect> adminCompSelectQueryWrapper = new QueryWrapper<>();
             adminCompSelectQueryWrapper.eq("phone", phone);
             adminCompSelectQueryWrapper.eq("comp_name", compName);
             adminCompSelectQueryWrapper.eq("sys_org_code", adminUser.getSysOrgCode());
+            adminCompSelectQueryWrapper.eq("doctor_and_specialist", "1");
             List<AdminCompSelect> list = adminCompSelectService.list(adminCompSelectQueryWrapper);
 
             if (null != list && list.size() > 0) {
@@ -446,6 +451,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
         QueryWrapper<AdminCompSelect> adminCompSelectQueryWrapper = new QueryWrapper<>();
         adminCompSelectQueryWrapper.eq("phone",phone);
         adminCompSelectQueryWrapper.eq("sys_org_code",sysUser.getOrgCode());
+        adminCompSelectQueryWrapper.eq("doctor_and_specialist","1");
         AdminCompSelect adminCompSelect = adminCompSelectService.getOne(adminCompSelectQueryWrapper);
         adminCompSelect.setKsName(adminUser.getKsname());
         adminCompSelect.setDwName(adminUser.getDwname());
@@ -454,6 +460,93 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
         adminCompSelectService.updateById(adminCompSelect);
     }
 
+    @Override
+    public Result<?> saveMain(AdminUser adminUser) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        adminUser.setCompName(user.getRealname());
+        String phone = adminUser.getPhone();
+        String compName = adminUser.getCompName();
+        adminUser.setDoctorAndSpecialist("2");
+        String salt = oConvertUtils.randomGen(8);
+        adminUser.setSalt(salt);
+        if (adminUser.getPassword() == null) {
+            adminUser.setPassword("123456");
+        }
+        if (adminUser.getPassword().equals("")) {
+            adminUser.setPassword("123456");
+        }
+        adminUser.setWisMhu("允许");
+        adminUser.setCompleteInformation(1);
+        adminUser.setIsTrue("1");
+        adminUser.setSysOrgCode(user.getOrgCode());
+        adminUser.setYzh(user.getYzh());
+        adminUser.setWisWjdc("允许");
+        String passwordEncode = PasswordUtil.encrypt(adminUser.getPhone(), adminUser.getPassword(), salt);
+        adminUser.setPassword(passwordEncode);
+
+
+        QueryWrapper<AdminUser> adminUserQueryWrapper = new QueryWrapper<>();
+        adminUserQueryWrapper.eq("phone", phone);
+        adminUserQueryWrapper.eq("doctor_and_specialist", "2");
+        AdminUser adminUsers = adminUserService.getOne(adminUserQueryWrapper);
+
+        if (null != adminUsers) {
+
+            AdminCompSelect adminCompSelect = new AdminCompSelect();
+            adminCompSelect.setOrderId(adminUsers.getId());
+            adminCompSelect.setPhone(phone);
+            adminCompSelect.setCompName(compName);
+            adminCompSelect.setSysOrgCode(adminUser.getSysOrgCode());
+            adminCompSelect.setKsName(adminUser.getKsname());
+            adminCompSelect.setDwName(adminUser.getDwname());
+            adminCompSelect.setAvatar(adminUser.getAvatar());
+            adminCompSelect.setCardPic(adminUser.getCardPic());
+            adminCompSelect.setDoctorAndSpecialist("2");
+
+            QueryWrapper<AdminCompSelect> adminCompSelectQueryWrapper = new QueryWrapper<>();
+            adminCompSelectQueryWrapper.eq("phone", phone);
+            adminCompSelectQueryWrapper.eq("comp_name", compName);
+            adminCompSelectQueryWrapper.eq("sys_org_code", adminUser.getSysOrgCode());
+            adminCompSelectQueryWrapper.eq("doctor_and_specialist", "2");
+            List<AdminCompSelect> list = adminCompSelectService.list(adminCompSelectQueryWrapper);
+
+            if (null != list && list.size() > 0) {
+                    return Result.error("该手机号已存在该公司,请更换手机号进行注册");
+            } else {
+                adminCompSelectService.save(adminCompSelect);
+            }
+        } else {
+            adminUser.setId(UUID.randomUUID().toString().replace("-", ""));
+
+            AdminCompSelect adminCompSelect = new AdminCompSelect();
+            adminCompSelect.setOrderId(adminUser.getId());
+            adminCompSelect.setPhone(phone);
+            adminCompSelect.setCompName(compName);
+            adminCompSelect.setSysOrgCode(adminUser.getSysOrgCode());
+            adminCompSelect.setKsName(adminUser.getKsname());
+            adminCompSelect.setDwName(adminUser.getDwname());
+            adminCompSelect.setAvatar(adminUser.getAvatar());
+            adminCompSelect.setCardPic(adminUser.getCardPic());
+            adminCompSelect.setDoctorAndSpecialist("2");
+
+            QueryWrapper<AdminCompSelect> adminCompSelectQueryWrapper = new QueryWrapper<>();
+            adminCompSelectQueryWrapper.eq("phone", phone);
+            adminCompSelectQueryWrapper.eq("comp_name", compName);
+            adminCompSelectQueryWrapper.eq("sys_org_code", adminUser.getSysOrgCode());
+            adminCompSelectQueryWrapper.eq("doctor_and_specialist", "2");
+            List<AdminCompSelect> list = adminCompSelectService.list(adminCompSelectQueryWrapper);
+
+            if (null != list && list.size() > 0) {
+                return Result.error("该手机号已存在该公司,请更换手机号进行注册");
+            } else {
+                adminCompSelectService.save(adminCompSelect);
+            }
+            this.save(adminUser);
+
+        }
+        return Result.OK("操作成功");
+    }
+
     private Result<?> bankCardFourAuthConfirm(AdminUserVO adminUserVO, AdminUser adminUser) {
         BankCardFourAuthConfirmRequest request = new BankCardFourAuthConfirmRequest();
         request.setCardNo(adminUserVO.getBackCard());
@@ -512,5 +605,21 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
 
     }
 
+    @Override
+    public void updateByUser2(AdminUser adminUser) {
+        String phone = adminUser.getPhone();
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        QueryWrapper<AdminCompSelect> adminCompSelectQueryWrapper = new QueryWrapper<>();
+        adminCompSelectQueryWrapper.eq("phone",phone);
+        adminCompSelectQueryWrapper.eq("sys_org_code",sysUser.getOrgCode());
+        adminCompSelectQueryWrapper.eq("doctor_and_specialist","2");
+        AdminCompSelect adminCompSelect = adminCompSelectService.getOne(adminCompSelectQueryWrapper);
+        adminCompSelect.setKsName(adminUser.getKsname());
+        adminCompSelect.setDwName(adminUser.getDwname());
+        adminCompSelect.setAvatar(adminUser.getAvatar());
+        adminCompSelect.setCardPic(adminUser.getCardPic());
+        adminCompSelectService.updateById(adminCompSelect);
+    }
+
 
 }

+ 9 - 6
medical_history/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/controller/APIController.java

@@ -1098,7 +1098,9 @@ public class APIController {
 
     @ApiOperation(value = "获取登录人公司", notes = "获取登录人公司")
     @GetMapping(value = "getCompName")
-    public Result<?> getCompName(@RequestHeader("Authorization") String Authorization) {
+    public Result<?> getCompName(@RequestHeader("Authorization") String Authorization,
+                                 @RequestParam(name = "type", required = true) String type
+    ) {
 
         Result<List<AdminCompSelect>> result = new Result<>();
         if (Authorization.equals("")) {
@@ -1116,7 +1118,8 @@ public class APIController {
         }
         try {
             QueryWrapper<AdminCompSelect> queryWrapper1 = new QueryWrapper<>();
-            queryWrapper1.eq("phone",userPhone);
+            queryWrapper1.eq("phone", userPhone);
+            queryWrapper1.eq("doctor_and_specialist", type);
             List<AdminCompSelect> list = adminCompSelectService.list(queryWrapper1);
             result.setMessage("获取用户公司信息成功");
             result.setResult(list);
@@ -1239,11 +1242,11 @@ public class APIController {
     @ApiOperation(value = "小程序转账列表", notes = "小程序转账列表")
     @GetMapping(value = "transList")
     public Result<?> transList(@RequestHeader("Authorization") String Authorization,
-                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                          HttpServletRequest req) {
+                               @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                               @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                               HttpServletRequest req) {
 
-        return  adminTransferAccountsService.transList(Authorization,pageNo, pageSize,req);
+        return adminTransferAccountsService.transList(Authorization, pageNo, pageSize, req);
 
     }
 }