From 05628d269dff7ad4f2e9d3419b05b4e7e5768797 Mon Sep 17 00:00:00 2001
From: luoyisheng <yangdongji@argo-ai.cn>
Date: 星期三, 12 二月 2025 14:19:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java
index 5a457eb..9db5211 100644
--- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java
+++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java
@@ -1,7 +1,6 @@
 package com.sinata.system.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sinata.common.constant.CacheConstants;
@@ -12,6 +11,7 @@
 import com.sinata.common.utils.CollUtils;
 import com.sinata.common.utils.SecurityUtils;
 import com.sinata.common.utils.StringUtils;
+import com.sinata.system.domain.MwApplication;
 import com.sinata.system.domain.SysDepartment;
 import com.sinata.system.domain.SysDepartmentInfo;
 import com.sinata.system.domain.SysUserDepartment;
@@ -515,7 +515,8 @@
      * @param department
      * @return
      */
-    private String getRegionName(SysDepartment department) {
+    @Override
+    public String getRegionName(SysDepartment department) {
         String region = department.getDepartmentName();
         SysDepartment sysDepartment = this.lambdaQuery().eq(SysDepartment::getId, department.getParentId()).ne(SysDepartment::getId, -1).one();
         if (Objects.nonNull(sysDepartment)) {
@@ -881,4 +882,28 @@
     public List<MedicalInstitutionVO> getHospitalListByRouteId(Long id) {
         return baseMapper.getHospitalListByRouteId(id);
     }
+
+    /**
+     * 创建机构
+     *
+     * @param mwApplication
+     */
+    @Override
+    public void createDepartment(MwApplication mwApplication) {
+        SysDepartment parent = this.getById(mwApplication.getDepartmentId());
+        if (Objects.isNull(parent)) {
+            throw new ServiceException("找不到对应父级组织");
+        }
+        SysDepartment department = new SysDepartment();
+        department.setParentId(mwApplication.getDepartmentId());
+        department.setDepartmentName(mwApplication.getUnitName());
+        department.setContactPerson(mwApplication.getConcat());
+        department.setContactPhone(mwApplication.getPhone());
+        department.setOrgType(mwApplication.getUnitType().equals(1) ? DepartmentEnum.MEDICAL_INSTITUTION.getCode() : DepartmentEnum.DISPOSAL_UNIT.getCode());
+        department.setRegion(mwApplication.getRegion());
+        department.setRelation(mwApplication.getRelation());
+        department.setTreeCode(generateTreeCode(parent.getId()));
+        department.setOrgCode(getOrgCode(parent.getId(), department.getOrgType()));
+        save(department);
+    }
 }

--
Gitblit v1.7.1