ソースを参照

删除saasUser

LiTaohong 6 年 前
コミット
5f014970e7

+ 0 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -18,7 +18,6 @@ import java.util.Date;
*/
@Entity
@Table(name = "base_doctor")
@Where(clause = "del = 1")
public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    /**

+ 8 - 8
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgUserDO.java

@ -1,7 +1,7 @@
package com.yihu.jw.entity.base.org;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@ -23,9 +23,9 @@ public class BaseOrgUserDO extends IntegerIdentityEntity {
	private String orgCode;
    /**
	 * 用户账号,base_user表里的username
	 * 用户账号,base_user表里的id
	 */
	private String userAccount;
	private String userId;
	@Column(name = "org_code")
@ -36,12 +36,12 @@ public class BaseOrgUserDO extends IntegerIdentityEntity {
        this.orgCode = orgCode;
    }
	@Column(name = "user_account")
    public String getUserAccount() {
        return userAccount;
	@Column(name = "user_id")
    public String getUserId() {
        return userId;
    }
    public void setUserAccount(String userAccount) {
        this.userAccount = userAccount;
    public void setUserId(String userId) {
        this.userId = userId;
    }

+ 0 - 37
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasUserDO.java

@ -1,37 +0,0 @@
package com.yihu.jw.entity.base.saas;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
@Entity
@Table(name = "base_saas_user")
public class SaasUserDO extends UuidIdentityEntity {
    private String saasId;//租户ID
    private String userId;//用户账号
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "user_id")
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
}

+ 1 - 1
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -429,7 +429,7 @@ public class BaseRequestMapping {
        public static final String getOrgAreaTree  = "/getOrgAreaTree";
        public static final String queryOneById  = "/queryOneById";
        public static final String enableOrDis  = "/enableOrDis";
        public static final String queryCodeList  = "/queryCodeListBySaasId";
        public static final String queryOrgCodeAndNameListBySaasId  = "/queryOrgCodeAndNameListBySaasId";
    }

+ 0 - 32
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasUserVO.java

@ -1,32 +0,0 @@
package com.yihu.jw.restmodel.base.saas;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
@ApiModel(value = "SaasUserVO", description = "租户账号")
public class SaasUserVO extends UuidIdentityVO {
    private String saasId;//租户ID
    private String userId;//用户账号
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
}

+ 1 - 1
sql/init.sql

@ -695,7 +695,7 @@ CREATE TABLE `base_role_authority` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='角色权限';
-- 用户角色
Drop table IF EXISTS `base_user_role`;
Drop table IF EXISTS base_user_menu_role;
CREATE TABLE `base_user_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` varchar(50) CHARACTER SET utf8 NOT NULL COMMENT '用户ID',

ファイルの差分が大きいため隠しています
+ 0 - 43
svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorDao.java


+ 5 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java

@ -38,6 +38,9 @@ public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String
    @Query("select id from BaseOrgDO where del = 1 and saasid = ?1")
    List findOrgCodeBySaasId(String saasId);
    @Query("select code as code,name as name from BaseOrgDO where del = 1 and saasid = ?1 ")
    List<Map<String,Object>> findOrgListBySaasId(String saasId);
   /* @Query("select code as code,name as name from BaseOrgDO where del = 1 and saasid = ?1 ")
    List<Map<String,Object>> findOrgListBySaasId(String saasId);*/
    @Query("select code as code,name as name from BaseOrgDO where del = 1")
    List<Map<String,Object>> findOrgListBySaasId();
}

+ 0 - 13
svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/SaasUserDao.java

@ -1,13 +0,0 @@
package com.yihu.jw.base.dao.saas;
import com.yihu.jw.entity.base.saas.SaasUserDO;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
public interface SaasUserDao extends PagingAndSortingRepository<SaasUserDO, String> {
}

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java

@ -185,9 +185,9 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.BaseOrg.queryCodeList)
    @ApiOperation(value = "查询机构列表")
    @PostMapping(value = BaseRequestMapping.BaseOrg.queryOrgCodeAndNameListBySaasId)
    @ApiOperation(value = "查询机构代码和名称列表")
    public ListEnvelop queryOrgCodeAndNameList() throws Exception {
        return success(baseOrgService.findOrgCodeListBySaasId(""));
        return success(baseOrgService.findOrgListBySaasId(""));
    }
}

+ 37 - 32
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -86,8 +86,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        //医生基本信息
        List<BaseDoctorDO> doctors = this.findByField("id",doctorId);
        if(CollectionUtils.isEmpty(doctors)){
        BaseDoctorDO doctors = baseDoctorDao.findOne(doctorId);
        if(null == doctors){
            result.put("msg","doctor not exist for id:" + doctorId);
            result.put("response",ConstantUtils.FAIL);
            return result;
@ -103,7 +103,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            return result;
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("doctor",doctors.get(0));
        jsonObject.put("doctor",doctors);
        jsonObject.put("role",roleList);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",jsonObject);
@ -121,7 +121,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject result = new JSONObject();
        String orgCodeVale = null == orgCode ? "" : orgCode;
        String del = null == docStatus ? "" : docStatus;
        String nameOrIdcardValue = null == nameOrIdcard ? "" : nameOrIdcard;
        String nameOrIdcardValue = null == nameOrIdcard ? "" : "%" + nameOrIdcard + "%";
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
        String sql = "select" +
@ -143,7 +143,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "     doc.mobile,  " +
                "     concat(hos.org_name,'/',dept.name,'/',hos.doctor_duty_name) as org,  " +
                "     doc.job_title_name,  " +
                "     case doc.del when 0 then '无效' when 1 then '有效' end as status,  " +
                "     case doc.del when 0 then '已失效' when 1 then '生效中' end as status,  " +
                "      doc.create_time  " +
                "   from  " +
                "     base_doctor doc,  " +
@ -156,9 +156,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "    and " +
                "    hos.dept_code = dept.code  " +
                "    and  " +
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}'  ) and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}'))  " +
                "      and  " +
                "    ((doc.name like '{name}'  or ''= '{name}' )  and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}'))  " +
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}' ) or (doc.name like '{name}'  or ''= '{name}' )  and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}'))  " +
                "  ) tb  " +
                "GROUP BY tb.id order by tb.create_time desc limit {start},{end} ";
        String finalSql = sql
@ -182,9 +180,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "    and " +
                "    hos.dept_code = dept.code " +
                "    and " +
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}' ) and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}')) " +
                "      and " +
                "    ((doc.name like '{name}' or ''= '{name}')  and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}')) ";
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}' ) or (doc.name like '{name}' or ''= '{name}') and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}')) " ;
        String finalCountSql = countSql
                .replace("{idcard}",nameOrIdcardValue)
                .replace("{name}",nameOrIdcardValue)
@ -214,7 +210,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray hospital = jsonObject.getJSONArray("hospital");
        if(null == doctor || CollectionUtils.isEmpty(role) || CollectionUtils.isEmpty(hospital)){
        if(null == doctor || CollectionUtils.isEmpty(hospital)){
            result.put("msg","parameter doctor or hospital of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
@ -231,14 +227,15 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        baseDoctorDO.setPassword(baseDoctorDO.getIdcard().substring(11,17));
        this.save(baseDoctorDO);
        //组装医生角色关联关系
        //组装医生角色关联关系,医生默认可以没有角色
        if(!CollectionUtils.isEmpty(role)){
        BaseDoctorRoleDO baseDoctorRoleDO = null;
        List<BaseDoctorRoleDO> baseDoctorRoleDOList = new ArrayList<>();
        try {
            for(Object object : role){
                baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
                baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorDO.setDel("1");
                baseDoctorRoleDO.setDel(baseDoctorDO.getDel());
                baseDoctorRoleDOList.add(baseDoctorRoleDO);
            }
        } catch (IOException e) {
@ -247,6 +244,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            return result.toJSONString();
        }
        baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
        }
        // 组装医生任职机构及职业信息
        BaseDoctorHospitalDO baseDoctorHospitalDO = null;
@ -285,7 +283,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray hospital = jsonObject.getJSONArray("hospital");
        if(null == doctor || CollectionUtils.isEmpty(role)){
        if(null == doctor){
            result.put("msg","parameter role of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
@ -298,8 +296,11 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        // 修改医生信息
        BaseDoctorDO baseDoctorDO = null;
        try {
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
            BaseDoctorDO oldDoctor = baseDoctorDao.findOne(baseDoctorDO.getId());
            baseDoctorDO.setPassword(oldDoctor.getPassword());
        } catch (IOException e) {
            result.put("msg","convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
@ -307,23 +308,27 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        this.save(baseDoctorDO);
        //修改医生角色关联关系
        BaseDoctorRoleDO baseDoctorRoleDO = null;
        Set<Object> roleIdList = baseDoctorRoleService.findRoleIdList(baseDoctorDO.getId());
        try {
            for(Object object : hospital){
                baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
                if(roleIdList.contains(baseDoctorRoleDO.getId())){
                    roleIdList.remove(baseDoctorRoleDO.getId());
        //修改医生角色关联关系,医生默认可以没有角色
        if(!CollectionUtils.isEmpty(role)){
            BaseDoctorRoleDO baseDoctorRoleDO = null;
            Set<Object> roleIdList = baseDoctorRoleService.findRoleIdList(baseDoctorDO.getId());
            try {
                for(Object object : role){
                    baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
                    if(roleIdList.contains(baseDoctorRoleDO.getId())){
                        roleIdList.remove(baseDoctorRoleDO.getId());
                    }
                    baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                    baseDoctorRoleDO.setDel(baseDoctorDO.getDel());
                    baseDoctorRoleService.save(baseDoctorRoleDO);
                }
                baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorRoleService.save(baseDoctorRoleDO);
            } catch (IOException e) {
                result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
                result.put("response",ConstantUtils.FAIL);
            }
        } catch (IOException e) {
            result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
            baseDoctorRoleService.delete(roleIdList.toArray());
        }
        baseDoctorHospitalService.delete(roleIdList.toArray());
        // 修改医生任职机构及职业信息,前端不修改就不做任何操作
         if(!CollectionUtils.isEmpty(hospital)){
@ -423,8 +428,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        List<DictDoctorDutyDO> dutyDOList = dictDoctorDutyService.search(null);
        List<BaseDoctorHospitalDO> selectedDutylist = baseDoctorHospitalService.getOrgAndDutyListByDoctorCode(doctorCode);
        Set<Object> selectedDutySet = new HashSet<>();
        selectedDutylist.forEach( one -> selectedDutySet.add(one.getDoctorDutyCode()) );
        Set<String> selectedDutySet = new HashSet<>();
        selectedDutylist.forEach( one -> selectedDutySet.add(one.getOrgCode()+one.getDoctorDutyCode()) );
        List<OrgTree> orgTreeList = new ArrayList<>();
        for(BaseDoctorHospitalDO one : selectedDutylist){
@ -439,7 +444,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                orgTreeChild.setParentCode(one.getOrgCode());
                orgTreeChild.setCode(dictDoctorDutyDO.getCode());
                orgTreeChild.setName(dictDoctorDutyDO.getName());
                if(selectedDutySet.contains(dictDoctorDutyDO.getCode())){
                if(selectedDutySet.contains(one.getOrgCode()+dictDoctorDutyDO.getCode())){
                    orgTreeParent.setChecked(true);
                    orgTreeChild.setChecked(true);
                }

+ 8 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -163,7 +163,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
            //新增机构与管理员关联关系
            BaseOrgUserDO baseOrgUserDO = new BaseOrgUserDO();
            baseOrgUserDO.setOrgCode(baseOrgDO.getCode());
            baseOrgUserDO.setUserAccount(mobile);
            baseOrgUserDO.setUserId(mobile);
            baseOrgUserService.save(baseOrgUserDO);
            //新增用户(管理员)
@ -286,9 +286,9 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
     */
    public List findOrgCodeListBySaasId(String saasId){
        List result = new ArrayList();
        if(StringUtils.isEmpty(saasId)){
        /*if(StringUtils.isEmpty(saasId)){
            return result;
        }
        }*/
        return baseOrgDao.findOrgCodeBySaasId(saasId);
    }
@ -298,11 +298,11 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
     * @return
     */
    public List findOrgListBySaasId(String saasId){
        List result = new ArrayList();
        if(StringUtils.isEmpty(saasId)){
            return result;
        }
        return baseOrgDao.findOrgCodeBySaasId(saasId);
//        List result = new ArrayList();
//        if(StringUtils.isEmpty(saasId)){
//            return result;
//        }
        return baseOrgDao.findOrgListBySaasId();
    }

+ 0 - 16
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasUserService.java

@ -1,16 +0,0 @@
package com.yihu.jw.base.service.saas;
import com.yihu.jw.base.dao.saas.SaasUserDao;
import com.yihu.jw.entity.base.saas.SaasUserDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
@Service
public class SaasUserService extends BaseJpaService<SaasUserDO, SaasUserDao> {
}