소스 검색

用户-关联机构,职称接口变更

zdm 6 년 전
부모
커밋
fd92363636

+ 12 - 0
src/main/java/com.yihu.ehr/basic/org/model/OrgMemberRelation.java

@ -1,5 +1,7 @@
package com.yihu.ehr.basic.org.model;
import org.hibernate.annotations.Formula;
import javax.persistence.*;
/**
@ -27,6 +29,8 @@ public class OrgMemberRelation {
    private String jkzlDoctorSn; // 总部的坐诊sn
    private String jkzlHosDeptId; // 总部的科室Id
    private String dutyNameStr;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", nullable = false)
@ -100,6 +104,14 @@ public class OrgMemberRelation {
    public void setDutyName(String dutyName) {
        this.dutyName = dutyName;
    }
    @Formula("( SELECT a.NAME FROM rs_dictionary_entry a WHERE a.DICT_ID = 573 AND a.CODE = duty_name )")
    public String getDutyNameStr() {
        return dutyNameStr;
    }
    public void setDutyNameStr(String dutyNameStr) {
        this.dutyNameStr = dutyNameStr;
    }
    @Column(name = "user_id", nullable = true, insertable = true, updatable = true)
    public String getUserId() {

+ 0 - 2
src/main/java/com.yihu.ehr/basic/user/controller/DoctorEndPoint.java

@ -12,7 +12,6 @@ import com.yihu.ehr.basic.org.service.OrgMemberRelationService;
import com.yihu.ehr.basic.org.service.OrgService;
import com.yihu.ehr.basic.patient.service.DemographicService;
import com.yihu.ehr.basic.user.entity.Doctors;
import com.yihu.ehr.basic.user.entity.Roles;
import com.yihu.ehr.basic.user.entity.User;
import com.yihu.ehr.basic.user.service.DoctorService;
import com.yihu.ehr.basic.user.service.RoleUserService;
@ -24,7 +23,6 @@ import com.yihu.ehr.constants.ApiVersion;
import com.yihu.ehr.constants.ServiceApi;
import com.yihu.ehr.controller.EnvelopRestEndPoint;
import com.yihu.ehr.entity.patient.DemographicInfo;
import com.yihu.ehr.model.common.Result;
import com.yihu.ehr.model.org.MOrgDeptJson;
import com.yihu.ehr.model.user.MDoctor;
import com.yihu.ehr.util.datetime.DateUtil;

+ 9 - 7
src/main/java/com.yihu.ehr/basic/user/controller/RoleUserEndPoint.java

@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.yihu.ehr.basic.apps.model.UserApp;
import com.yihu.ehr.basic.apps.service.UserAppService;
import com.yihu.ehr.basic.org.model.OrgDept;
import com.yihu.ehr.basic.org.model.OrgDeptDetail;
import com.yihu.ehr.basic.org.model.OrgMemberRelation;
import com.yihu.ehr.basic.org.model.Organization;
import com.yihu.ehr.basic.org.service.OrgDeptService;
@ -14,10 +13,10 @@ import com.yihu.ehr.basic.user.dao.XUserTypeRepository;
import com.yihu.ehr.basic.user.dao.XUserTypeRolesRepository;
import com.yihu.ehr.basic.user.entity.*;
import com.yihu.ehr.basic.user.service.*;
import com.yihu.ehr.commons.model.MOrgMemberRlaJson;
import com.yihu.ehr.constants.ApiVersion;
import com.yihu.ehr.constants.ServiceApi;
import com.yihu.ehr.controller.EnvelopRestEndPoint;
import com.yihu.ehr.model.org.MOrgDeptJson;
import com.yihu.ehr.model.user.MRoleOrg;
import com.yihu.ehr.model.user.MRoleUser;
import com.yihu.ehr.util.rest.Envelop;
@ -401,14 +400,15 @@ public class RoleUserEndPoint extends EnvelopRestEndPoint {
        orgMemberRelationService.deleteOrgMemberRelationByUserId(userId);
        String orgId = "";
        List<String> deptIds = new ArrayList<>();
        String dutyId="";
        OrgMemberRelation orgMemberRelation = null ;
        List<MOrgDeptJson> orgDeptJsonList = objectMapper.readValue(orgModel, new TypeReference<List<MOrgDeptJson>>() {
        List<MOrgMemberRlaJson> orgDeptJsonList = objectMapper.readValue(orgModel, new TypeReference<List<MOrgMemberRlaJson>>() {
        });
        if (orgDeptJsonList != null && orgDeptJsonList.size() > 0) {
            for (MOrgDeptJson mOrgDeptJson : orgDeptJsonList) {
            for (MOrgMemberRlaJson mOrgDeptJson : orgDeptJsonList) {
                orgId = mOrgDeptJson.getOrgId().toString();
                deptIds = Arrays.asList(mOrgDeptJson.getDeptIds().split(","));
                dutyId = mOrgDeptJson.getDutyId().toString();
                if (deptIds.size() > 0) {
                    for (String deptId : deptIds) {
                        int deptIdInt = Integer.parseInt(deptId);
@ -417,7 +417,8 @@ public class RoleUserEndPoint extends EnvelopRestEndPoint {
                        if (res == 0) {
                            orgMemberRelation = new OrgMemberRelation();
                            orgMemberRelation.setUserId(userId);
                            //存储的是资源字典中行政业务管理职称的编码
                            orgMemberRelation.setDutyName(dutyId);
                            //TODO 验证数据存储
                            // 获取机构关联信息 - 名称
                            orgMemberRelation.setOrgId(orgId);
@ -435,7 +436,6 @@ public class RoleUserEndPoint extends EnvelopRestEndPoint {
                            orgMemberRelation.setStatus(0);
                            orgMemberRelation = orgMemberRelationService.save(orgMemberRelation);
                            if (orgMemberRelation != null) {
                                //新增成功,继续循环
                                continue;
@ -451,6 +451,8 @@ public class RoleUserEndPoint extends EnvelopRestEndPoint {
                    }
                }
            }
//            List<OrgMemberRelation> memberRelationList = orgMemberRelationService.findByField("userId", userId);
//            envelop.setDetailModelList(memberRelationList);
        }
        envelop.setSuccessFlg(true);
        return envelop;

+ 36 - 0
src/main/java/com.yihu.ehr/commons/model/MOrgMemberRlaJson.java

@ -0,0 +1,36 @@
package com.yihu.ehr.commons.model;
import java.io.Serializable;
/**
 * Created by wxw on 2017/10/10.
 */
public class MOrgMemberRlaJson implements Serializable {
    private String orgId;
    private String deptIds;
    private String dutyId;
    public String getOrgId() {
        return orgId;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }
    public String getDeptIds() {
        return deptIds;
    }
    public void setDeptIds(String deptIds) {
        this.deptIds = deptIds;
    }
    public String getDutyId() {
        return dutyId;
    }
    public void setDutyId(String dutyId) {
        this.dutyId = dutyId;
    }
}