LAPTOP-KB9HII50\70708 пре 2 година
родитељ
комит
247a2604ca

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/ehr/dict/SystemDict.java

@ -16,7 +16,7 @@ import java.util.Date;
@Table(name = "system_dicts")
@Access(value = AccessType.PROPERTY)
public class SystemDict {
    private long id;
    private Long id;
    private String name;
    private String reference;
    private String authorId;
@ -27,10 +27,10 @@ public class SystemDict {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", unique = true, nullable = false)
    public long getId() {
    public Long getId() {
        return id;
    }
    public void setId(long id) {
    public void setId(Long id) {
        this.id = id;
    }

+ 1 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/quota/controller/TjQuotaLogEndPoint.java

@ -113,7 +113,7 @@ public class TjQuotaLogEndPoint extends EnvelopRestEndpoint {
        return mTjQuotaLog;
    }
    @RequestMapping(name = "initialResult", method = RequestMethod.GET)
    @RequestMapping(name = "/tj/initialResult", method = RequestMethod.GET)
    @ApiOperation(value = "指标结果页")
    public ListEnvelop initialResult(@ApiParam(name = "quotaCode", value = "指标code", required = true)
                                         @RequestParam(value = "quotaCode") String quotaCode){

+ 153 - 10
svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/controller/RsReportCategoryEndPoint.java

@ -2,7 +2,14 @@ package com.yihu.jw.basic.resource.controller;
import com.yihu.ehr.constants.ApiVersion;
import com.yihu.ehr.constants.ServiceApi;
import com.yihu.jw.basic.resource.model.RsCategoryTypeTreeModel;
import com.yihu.jw.basic.resource.service.RsResourceCategoryService;
import com.yihu.jw.entity.ehr.resource.RsResourceCategory;
import com.yihu.jw.restmodel.ehr.resource.MRsCategory;
import com.yihu.jw.restmodel.ehr.resource.MRsReportCategory;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.entity.ehr.resource.RsReportCategory;
import com.yihu.jw.basic.resource.service.RsReportCategoryService;
@ -30,6 +37,8 @@ public class RsReportCategoryEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private RsReportCategoryService rsReportCategoryService;
    @Autowired
    private RsResourceCategoryService rsCategoryService;
    @ApiOperation("根据ID获取资源报表分类")
    @RequestMapping(value = ServiceApi.Resources.RsReportCategory, method = RequestMethod.GET)
@ -88,18 +97,48 @@ public class RsReportCategoryEndPoint extends EnvelopRestEndpoint {
    @ApiOperation("新增资源报表分类")
    @RequestMapping(value = ServiceApi.Resources.RsReportCategorySave, method = RequestMethod.POST)
    public MRsReportCategory add(
    public ObjEnvelop add(
            @ApiParam(name = "rsReportCategory", value = "资源报表分类JSON", required = true)
            @RequestBody String rsReportCategory) throws Exception {
        RsReportCategory newRsReportCategory = toEntity(rsReportCategory, RsReportCategory.class);
        if (null == newRsReportCategory.getPid()) {
            newRsReportCategory.setPid(0);
        }
        if (null == newRsReportCategory.getSortNo()) {
            newRsReportCategory.setSortNo(99);
            @RequestBody String rsReportCategory) {
        try {
            RsReportCategory newRsReportCategory = toEntity(rsReportCategory, RsReportCategory.class);
            if (null == newRsReportCategory.getPid()) {
                newRsReportCategory.setPid(0);
            }
            if (null == newRsReportCategory.getSortNo()) {
                newRsReportCategory.setSortNo(99);
            }
            if(newRsReportCategory.getId()==null){
                //新增判断名称和code 是否唯一
                if(!rsReportCategoryService.isUniqueName(0, newRsReportCategory.getName())){
                    return ObjEnvelop.getError("名称已存在",-1);
                }
                if(!rsReportCategoryService.isUniqueCode(0, newRsReportCategory.getCode())){
                    return ObjEnvelop.getError("编码已存在",-1);
                }
            }else{
                //修改 如果有修改name和code要判断是否唯一
                RsReportCategory oldRsReportCategory = rsReportCategoryService.getById(newRsReportCategory.getId());
                if(!oldRsReportCategory.getName().equals(newRsReportCategory.getName())){
                    if(!rsReportCategoryService.isUniqueName(newRsReportCategory.getId(), newRsReportCategory.getName())){
                        return ObjEnvelop.getError("名称已存在",-1);
                    }
                }
                if(!oldRsReportCategory.getCode().equals(newRsReportCategory.getCode())){
                    if(!rsReportCategoryService.isUniqueCode(newRsReportCategory.getId(), newRsReportCategory.getCode())){
                        return ObjEnvelop.getError("编码已存在",-1);
                    }
                }
            }
            newRsReportCategory = rsReportCategoryService.save(newRsReportCategory);
            MRsReportCategory mRsReportCategory = convertToModel(newRsReportCategory, MRsReportCategory.class);
            return ObjEnvelop.getSuccess("操作成功",mRsReportCategory);
        }catch (Exception e){
            e.printStackTrace();
        }
        newRsReportCategory = rsReportCategoryService.save(newRsReportCategory);
        return convertToModel(newRsReportCategory, MRsReportCategory.class);
        return ObjEnvelop.getError("操作失败",-1);
    }
    @ApiOperation("更新资源报表分类")
@ -175,4 +214,108 @@ public class RsReportCategoryEndPoint extends EnvelopRestEndpoint {
        List<Integer> categoryIds = rsReportCategoryService.getCategoryIds(code);
        return categoryIds;
    }
    @RequestMapping(value = ServiceApi.Resources.CategoryTree, method = RequestMethod.GET)
    @ApiOperation(value = "获取所有资源类别转成的RsCategoryTypeTreeModel列表,初始页面显示")
    public ListEnvelop getRsCategoryTreeModels(
            @ApiParam(name = "userResource", value = "授权资源")
            @RequestParam(value = "userResource") String userResource,
            @ApiParam(name = "name", value = "资源类别的名称")
            @RequestParam(value = "name",required = false) String name) throws Exception {
        ListEnvelop envelop = new ListEnvelop();
        //获取到的顶级cda类别集合
        List<RsResourceCategory> categoryList;
        if(userResource.equals("*")) {
            categoryList = rsCategoryService.getRsCategoryByPid("");
        }else {
            categoryList = rsCategoryService.findByCodeAndPid("derived", "");
        }
        //顶级类别中符合条件的类别集合
        List<RsResourceCategory> mRsCategoriesSome = new ArrayList<>();
        //顶级类别中不符合条件的类别集合
        List<RsResourceCategory> mRsCategoriesOthers = new ArrayList<>();
        if (categoryList == null || categoryList.size() == 0){
            envelop.setStatus(-1);
            envelop.setMessage("没有匹配条件的资源类别!");
            return envelop;
        }
        List<RsCategoryTypeTreeModel> treeList = new ArrayList<>();
        if(StringUtils.isEmpty(name)){
            treeList = getRsCategoryTreeModelChild(categoryList);
            envelop.setDetailModelList(treeList);
            return envelop;
        }
        for(RsResourceCategory mRsCategory : categoryList){
            if(mRsCategory.getName().contains(name)){
                mRsCategoriesSome.add(mRsCategory);
                continue;
            }
            mRsCategoriesOthers.add(mRsCategory);
        }
        if (mRsCategoriesSome.size() != 0){
            treeList.addAll(getRsCategoryTreeModelChild(mRsCategoriesSome));
        }
        treeList .addAll(getRsCategoryTreeModelByName(mRsCategoriesOthers, name));
        envelop.setDetailModelList(treeList);
        return envelop;
    }
    /**
     *
     * 根据父级信息获取全部的子级信息(树形model)
     * @param info 父级信息
     * @return 全部子级信息
     */
    private List<RsCategoryTypeTreeModel> getRsCategoryTreeModelChild(List<RsResourceCategory> info) {
        List<RsCategoryTypeTreeModel> treeInfo = new ArrayList<>();
        for (int i = 0; i < info.size(); i++) {
            RsResourceCategory typeInfo = info.get(i);
            RsCategoryTypeTreeModel tree = convertToModel(typeInfo, RsCategoryTypeTreeModel.class);
            List<RsResourceCategory> categoryListChild = rsCategoryService.getRsCategoryByPid(typeInfo.getId());
            List<RsCategoryTypeTreeModel> listChildTree = getRsCategoryTreeModelChild(categoryListChild);
            tree.setChildren(listChildTree);
            treeInfo.add(tree);
        }
        return treeInfo;
    }
    /**
     * 递归不满足的父级类别集合的子集中满足条件TreeModel集合的方法
     * @param mRsCategories 不符合的父级类别的集合
     * @param name
     * @return
     */
    private List<RsCategoryTypeTreeModel> getRsCategoryTreeModelByName(List<RsResourceCategory> mRsCategories, String name) throws ParseException {
        //结构:treeList 包含treeModel,treeModel包含listOfParent
        List<RsCategoryTypeTreeModel> treeList = new ArrayList<>();
        for(RsResourceCategory mRsCategory:mRsCategories){
            List<RsCategoryTypeTreeModel> childList = new ArrayList<>();
            RsCategoryTypeTreeModel treeModel = convertToModel(mRsCategory,RsCategoryTypeTreeModel.class);
            String pid = mRsCategory.getId();
            //获取所有下一级cda类别
            List<RsResourceCategory> listAll = rsCategoryService.getRsCategoryByPid(pid);
            if(listAll.size() == 0){
                continue;
            }
            //获取所有下一级符合要求的资源类别
            String filters ="pid="+pid+";name?"+name;
            //modify by cws
            List<RsResourceCategory> listSome = rsCategoryService.search(filters);
            //List<MRsCategory> listSome = (List<MRsCategory>)responseEntity.getBody();
            if(listSome.size()!=0){
                childList.addAll(getRsCategoryTreeModelChild(listSome));
            }
            //取剩下不符合要求的进行递归
            listAll.removeAll(listSome);
            if(listAll.size() != 0){
                childList.addAll(getRsCategoryTreeModelByName(listAll, name));
            }
            if(childList.size() != 0){
                treeModel.setChildren(childList);
                treeList.add(treeModel);
            }
        }
        return treeList;
    }
}

+ 90 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/model/RsCategoryTypeTreeModel.java

@ -0,0 +1,90 @@
package com.yihu.jw.basic.resource.model;
import java.util.List;
/**
 * Created by yww on 2016/3/18.
 */
public class RsCategoryTypeTreeModel {
    private String id;
    private String name;
    private String pid;
    private String description;
    private List<RsCategoryTypeTreeModel> children;
    private  List<RsResourcesModel>  rsResourceslist;
    private String resourceIds;
    private String resourceCode;
    private boolean ischecked = false; // 是否选中(报表视图配置用到)
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getPid() {
        return pid;
    }
    public void setPid(String pid) {
        this.pid = pid;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public List<RsCategoryTypeTreeModel> getChildren() {
        return children;
    }
    public void setChildren(List<RsCategoryTypeTreeModel> children) {
        this.children = children;
    }
    public String getResourceIds() {
        return resourceIds;
    }
    public void setResourceIds(String resourceIds) {
        this.resourceIds = resourceIds;
    }
    public String getResourceCode() {
        return resourceCode;
    }
    public void setResourceCode(String resourceCode) {
        this.resourceCode = resourceCode;
    }
    public List<RsResourcesModel> getRsResourceslist() {
        return rsResourceslist;
    }
    public void setRsResourceslist(List<RsResourcesModel> rsResourceslist) {
        this.rsResourceslist = rsResourceslist;
    }
    public boolean getIschecked() {
        return ischecked;
    }
    public void setIschecked(boolean ischecked) {
        this.ischecked = ischecked;
    }
}

+ 179 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/model/RsResourcesModel.java

@ -0,0 +1,179 @@
package com.yihu.jw.basic.resource.model;
/**
 * Created by hzp on 2016/5/4.
 * 资源列表
 */
public class RsResourcesModel {
    private String id;
    private String code;
    private String name;
    private String categoryId;
    private String categoryName;
    private String rsInterface;
    private String rsInterfaceName;
    private String grantType;
    private String description;
    private Integer dataSource;
    private String echartType;
    private String dimension;
    private String createDate;
    private String creator;
    private String modifyDate;
    private String modifier;
    // 计量数值
    private String dataMeasurement;
    // 单位
    private String dataUnit;
    // 单位放置位置
    private String dataPosition;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getCategoryId() {
        return categoryId;
    }
    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }
    public String getCategoryName() {
        return categoryName;
    }
    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }
    public String getRsInterface()
    {
        return rsInterface;
    }
    public void setRsInterface(String rsInterface)
    {
        this.rsInterface = rsInterface;
    }
    public String getRsInterfaceName() {
        return rsInterfaceName;
    }
    public void setRsInterfaceName(String rsInterfaceName) {
        this.rsInterfaceName = rsInterfaceName;
    }
    public String getGrantType()
    {
        return grantType;
    }
    public void setGrantType(String grantType)
    {
        this.grantType = grantType;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public Integer getDataSource() {
        return dataSource;
    }
    public void setDataSource(Integer dataSource) {
        this.dataSource = dataSource;
    }
    public String getEchartType() {
        return echartType;
    }
    public void setEchartType(String echartType) {
        this.echartType = echartType;
    }
    public String getDimension() {
        return dimension;
    }
    public void setDimension(String dimension) {
        this.dimension = dimension;
    }
    public String getCreateDate() {
        return createDate;
    }
    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }
    public String getCreator() {
        return creator;
    }
    public void setCreator(String creator) {
        this.creator = creator;
    }
    public String getModifyDate() {
        return modifyDate;
    }
    public void setModifyDate(String modifyDate) {
        this.modifyDate = modifyDate;
    }
    public String getModifier() {
        return modifier;
    }
    public void setModifier(String modifier) {
        this.modifier = modifier;
    }
    public String getDataMeasurement() {
        return dataMeasurement;
    }
    public void setDataMeasurement(String dataMeasurement) {
        this.dataMeasurement = dataMeasurement;
    }
    public String getDataUnit() {
        return dataUnit;
    }
    public void setDataUnit(String dataUnit) {
        this.dataUnit = dataUnit;
    }
    public String getDataPosition() {
        return dataPosition;
    }
    public void setDataPosition(String dataPosition) {
        this.dataPosition = dataPosition;
    }
}

+ 63 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/user/controller/UserEndPoint.java

@ -2,13 +2,19 @@ package com.yihu.jw.basic.user.controller;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.jw.basic.address.service.AddressDictService;
import com.yihu.jw.basic.dict.service.SystemDictEntryService;
import com.yihu.jw.basic.dict.service.SystemDictService;
import com.yihu.jw.basic.org.service.OrgService;
import com.yihu.jw.basic.util.ConstantUtil;
import com.yihu.jw.entity.ehr.address.AddressDict;
import com.yihu.jw.entity.ehr.dict.SystemDict;
import com.yihu.jw.entity.ehr.org.OrgMemberRelation;
import com.yihu.jw.basic.org.service.OrgMemberRelationService;
import com.yihu.jw.basic.patient.service.DemographicService;
import com.yihu.jw.basic.security.service.UserSecurityService;
import com.yihu.jw.basic.user.dao.XUserTypeRolesRepository;
import com.yihu.jw.entity.ehr.org.Organization;
import com.yihu.jw.entity.ehr.user.Roles;
import com.yihu.jw.entity.ehr.user.UserTypeRoles;
import com.yihu.jw.basic.user.service.RoleUserService;
@ -20,6 +26,7 @@ import com.yihu.jw.basic.user.service.DoctorService;
import com.yihu.jw.basic.user.service.UserService;
import com.yihu.ehr.constants.ApiVersion;
import com.yihu.jw.phonics.PinyinUtil;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -35,6 +42,8 @@ import com.yihu.utils.date.DateUtil;
import com.yihu.jw.entity.ehr.id.BizObject;
import com.yihu.jw.util.common.LogService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -43,6 +52,7 @@ import org.apache.commons.lang.time.DateFormatUtils;
import org.csource.common.MyException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -95,6 +105,14 @@ public class UserEndPoint extends EnvelopRestEndpoint {
    private OrgMemberRelationService relationService;
    @Autowired
    private XUserTypeRolesRepository xUserTypeRolesRepository;
    @Autowired
    private SystemDictService dictService;
    @Autowired
    private SystemDictEntryService systemDictEntryService;
    @Autowired
    private AddressDictService geographyDictService;
    @Autowired
    private OrgService orgService;
    @RequestMapping(value = ServiceApi.Users.Users, method = RequestMethod.GET)
    @ApiOperation(value = "获取用户列表", notes = "根据查询条件获取用户列表在前端表格展示")
@ -1132,4 +1150,49 @@ public class UserEndPoint extends EnvelopRestEndpoint {
        return envelop;
    }
    /**
     * 通过系统设置字典获取准确的位置信息
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getDistrictByUserId")
    public ListEnvelop getDistrictByUserId(){
        try {
            List<SystemDict> systemDictList = dictService.search(null, "phoneticCode=XTSZ", null, 1, 1);
            if (systemDictList.size()==0) {
                return ListEnvelop.getError("获取系统设置信息失败");
            }
            Integer systemSettingId = systemDictList.get(0).getId().intValue();
            List<SystemDictEntry> systemDictEntryList = systemDictEntryService.search(null,"dictId=" + systemSettingId + ";code=CITY",null,1,1);
            if(systemDictEntryList.size()>0) {
                String cityId = systemDictEntryList.get(0).getValue();
                List<AddressDict> addressDictList = geographyDictService.getPidToAddr(Integer.parseInt(cityId));
                return ListEnvelop.getSuccess("查询成功",addressDictList);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return ListEnvelop.getError("查询失败");
    }
    @GetMapping(value = "/getOrgByUserId")
    public Envelop getOrgByUserId(){
        try {
            List<SystemDict> systemDictList = dictService.search(null, "phoneticCode=XTSZ", null, 1, 1);
            if (systemDictList.size()==0) {
                return ListEnvelop.getError("获取系统设置信息失败");
            }
            Integer systemSettingId = systemDictList.get(0).getId().intValue();
            List<SystemDictEntry> systemDictEntryList = systemDictEntryService.search(null,"dictId=" + systemSettingId + ";code=CITY",null,1,1);
            if(systemDictEntryList.size()>0) {
                String cityId = systemDictEntryList.get(0).getValue();
                List<Organization> orgList = orgService.getOrgListByAddressPid(Integer.parseInt(cityId));
                return ListEnvelop.getSuccess("查询成功",orgList);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return ListEnvelop.getError("查询失败");
    }
}