Jelajahi Sumber

Merge branch 'dev' of yeshijie/jw2.0 into dev

yeshijie 6 tahun lalu
induk
melakukan
e3fff982d5

+ 12 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/system/SystemDictEndpoint.java

@ -8,7 +8,6 @@ import com.yihu.jw.entity.base.system.SystemDictDO;
import com.yihu.jw.restmodel.base.system.SystemDictVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
@ -33,7 +32,7 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private SystemDictService systemDictService;
    @Value("${configDefault.saasId}")
    private String saasId;
    private String defaultSaasId;
    @PostMapping(value = BaseRequestMapping.SystemDict.DELETE)
@ -54,7 +53,7 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
            @RequestParam String jsonData) throws Exception {
        SystemDictDO systemDictDO = toEntity(jsonData, SystemDictDO.class);
        if(StringUtils.isBlank(systemDictDO.getSaasId())){
            systemDictDO.setSaasId(saasId);
            systemDictDO.setSaasId(defaultSaasId);
        }
        if (null == systemDictDO.getCode()) {
            return failed("ID不能为空", Envelop.class);
@ -68,6 +67,8 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
    public Envelop page(
            @ApiParam(name = "dictType", value = "字典类型")
            @RequestParam(value = "dictType", required = true) String dictType,
            @ApiParam(name = "saasId", value = "saasId")
            @RequestParam(value = "saasId", required = false) String saasId,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
@ -76,6 +77,9 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        if(StringUtils.isBlank(saasId)){
            saasId = defaultSaasId;
        }
        if (StringUtils.isBlank(filters)) {
            filters = "saasId=" + saasId+";";
        } else {
@ -93,10 +97,15 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
    public ListEnvelop<SystemDictVO> list(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "saasId", value = "saasId")
            @RequestParam(value = "saasId", required = false) String saasId,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        if(StringUtils.isBlank(saasId)){
            saasId = defaultSaasId;
        }
        if (StringUtils.isBlank(filters)) {
            filters = "saasId=" + saasId+";";
        } else {

+ 13 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/system/SystemDictEntryEndpoint.java

@ -16,7 +16,6 @@ import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -33,7 +32,7 @@ public class SystemDictEntryEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private SystemDictEntryService systemDictEntryService;
    @Value("${configDefault.saasId}")
    private String saasId;
    private String defaultSaasId;
    @PostMapping(value = BaseRequestMapping.SystemDictEntry.CREATE)
    @ApiOperation(value = "创建")
@ -47,7 +46,7 @@ public class SystemDictEntryEndpoint extends EnvelopRestEndpoint {
            return failed("字典项编码不能为空!",ObjEnvelop.class);
        }
        if(StringUtils.isBlank(systemDictEntryDO.getSaasId())){
            systemDictEntryDO.setSaasId(saasId);
            systemDictEntryDO.setSaasId(defaultSaasId);
        }
        if(StringUtils.isNotBlank(systemDictEntryDO.getValue())){
            systemDictEntryDO.setPyCode(PinyinUtil.getPinYinHeadChar(systemDictEntryDO.getValue(), true));
@ -80,7 +79,7 @@ public class SystemDictEntryEndpoint extends EnvelopRestEndpoint {
            return failed("字典项编码不能为空!",ObjEnvelop.class);
        }
        if(StringUtils.isBlank(systemDictEntryDO.getSaasId())){
            systemDictEntryDO.setSaasId(saasId);
            systemDictEntryDO.setSaasId(defaultSaasId);
        }
        if(StringUtils.isNotBlank(systemDictEntryDO.getValue())){
            systemDictEntryDO.setPyCode(PinyinUtil.getPinYinHeadChar(systemDictEntryDO.getValue(), true));
@ -122,12 +121,17 @@ public class SystemDictEntryEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "saasId", value = "saasId")
            @RequestParam(value = "saasId", required = false) String saasId,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        if(StringUtils.isBlank(saasId)){
            saasId = defaultSaasId;
        }
        if (StringUtils.isBlank(filters)) {
            filters = "saasId=" + saasId+";";
        } else {
@ -143,10 +147,15 @@ public class SystemDictEntryEndpoint extends EnvelopRestEndpoint {
    public ListEnvelop<SystemDictEntryVO> list (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "saasId", value = "saasId")
            @RequestParam(value = "saasId", required = false) String saasId,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        if(StringUtils.isBlank(saasId)){
            saasId = defaultSaasId;
        }
        if (StringUtils.isBlank(filters)) {
            filters = "saasId=" + saasId+";";
        } else {

+ 25 - 12
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java

@ -382,6 +382,19 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
        saas.setAppSecret(getCode());
        saas = saasDao.save(saas);
        String saasId = saas.getId();
        //字典配置(由于需要支持租户对字典的crud,目前考虑直接复制一套字典给租户单独使用)
//        List<SystemDictDO> systemDictDOList = systemDictDao.findBySaasId(defaultSaasId);
//        List<SystemDictDO> dictDOList = new ArrayList<>(systemDictDOList.size());
//        systemDictDOList.forEach(dict->{
//            SystemDictDO systemDictDO = new SystemDictDO();
//            systemDictDO.setSaasId(saasId);
//            systemDictDO.setName(dict.getName());
//            systemDictDO.setCode(dict.getCode());
//            systemDictDO.setPyCode(dict.getPyCode());
//            systemDictDO.setType(dict.getType());
//            dictDOList.add(systemDictDO);
//        });
        //系统字典项
        List<SystemDictEntryDO> systemDictEntryDOList = systemDictEntryDao.findBySaasId(defaultSaasId);
        List<SystemDictEntryDO> dictEntryDOList = new ArrayList<>(systemDictEntryDOList.size());
@ -462,17 +475,17 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
            diseaseDO.setCreateTime(new Date());
            diseaseDOList.add(diseaseDO);
        });
        //科室字典
        List<DictHospitalDeptDO> dictHospitalDeptDOList = dictHospitalDeptService.findBySaasId(defaultSaasId);
        List<DictHospitalDeptDO> hospitalDeptDOList = new ArrayList<>(dictHospitalDeptDOList.size());
        dictHospitalDeptDOList.forEach(dict->{
            DictHospitalDeptDO deptDO = new DictHospitalDeptDO();
            deptDO.setOrgCode(saasId);
            deptDO.setName(dict.getName());
            deptDO.setCode(dict.getCode());
            deptDO.setCreateTime(new Date());
            hospitalDeptDOList.add(deptDO);
        });
//        //科室字典
//        List<DictHospitalDeptDO> dictHospitalDeptDOList = dictHospitalDeptService.findBySaasId(defaultSaasId);
//        List<DictHospitalDeptDO> hospitalDeptDOList = new ArrayList<>(dictHospitalDeptDOList.size());
//        dictHospitalDeptDOList.forEach(dict->{
//            DictHospitalDeptDO deptDO = new DictHospitalDeptDO();
//            deptDO.setOrgCode(saasId);
//            deptDO.setName(dict.getName());
//            deptDO.setCode(dict.getCode());
//            deptDO.setCreateTime(new Date());
//            hospitalDeptDOList.add(deptDO);
//        });
        //保存数据
//        systemDictDao.save(dictDOList);
@ -482,7 +495,7 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
        dictIcd10Dao.save(icd10DOList);
        dictHealthProblemDao.save(healthProblemDOList);
        dictDiseaseDao.save(diseaseDOList);
        dictHospitalDeptService.batchInsert(hospitalDeptDOList);
//        dictHospitalDeptService.batchInsert(hospitalDeptDOList);
        return saas;
    }

+ 20 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/service/system/SystemDictService.java

@ -91,6 +91,8 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
        } else if (SystemDictEnum.DiseaseDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictDiseaseService.queryAll(saasId, createPage(page, size, sorts));
        } else {
            jsonObject = this.queryAll(saasId, createPage(page, size, sorts));
        }
        jsonArray.add(jsonObject);
        return jsonArray;
@ -286,7 +288,9 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
        long count = 0;
        if (SystemDictEnum.Icd10Dict == SystemDictEnum.valueOf(type)) {
            DictIcd10DO dictIcd10DO = objectMapper.readValue(json, DictIcd10DO.class);
            dictIcd10DO.setSaasId(saasId);
            if(StringUtils.isBlank(dictIcd10DO.getSaasId())){
                dictIcd10DO.setSaasId(saasId);
            }
            dictIcd10Service.save(dictIcd10DO);
        } else if (SystemDictEnum.HospitalDeptDict == SystemDictEnum.valueOf(type)) {
            //科室只与机构有关。
@ -295,22 +299,30 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
        } else if (SystemDictEnum.JobTitleDict == SystemDictEnum.valueOf(type)) {
            DictJobTitleDO dictJobTitleDO = objectMapper.readValue(json, DictJobTitleDO.class);
            dictJobTitleDO.setSaasId(saasId);
            if(StringUtils.isBlank(dictJobTitleDO.getSaasId())){
                dictJobTitleDO.setSaasId(saasId);
            }
            dictJobTitleService.save(dictJobTitleDO);
        } else if (SystemDictEnum.HealthProblemDict == SystemDictEnum.valueOf(type)) {
            DictHealthProblemDO dictHealthProblemDO = objectMapper.readValue(json, DictHealthProblemDO.class);
            dictHealthProblemDO.setSaasId(saasId);
            if(StringUtils.isBlank(dictHealthProblemDO.getSaasId())){
                dictHealthProblemDO.setSaasId(saasId);
            }
            dictHealthProblemService.save(dictHealthProblemDO);
        } else if (SystemDictEnum.MedicineDict == SystemDictEnum.valueOf(type)) {
            DictMedicineDO dictMedicineDO = objectMapper.readValue(json, DictMedicineDO.class);
            dictMedicineDO.setSaasId(saasId);
            if(StringUtils.isBlank(dictMedicineDO.getSaasId())){
                dictMedicineDO.setSaasId(saasId);
            }
            dictMedicineService.save(dictMedicineDO);
        } else if (SystemDictEnum.DiseaseDict == SystemDictEnum.valueOf(type)) {
            DictDiseaseDO dictDiseaseDO = objectMapper.readValue(json, DictDiseaseDO.class);
            dictDiseaseDO.setSaasId(saasId);
            if(StringUtils.isBlank(dictDiseaseDO.getSaasId())){
                dictDiseaseDO.setSaasId(saasId);
            }
            dictDiseaseService.save(dictDiseaseDO);
        } else {
            SystemDictDO systemDictDO = objectMapper.readValue(json, SystemDictDO.class);
@ -321,7 +333,9 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
                systemDictDO.setPyCode(PinyinUtil.getPinYinHeadChar(systemDictDO.getName(), true));
            }
            systemDictDO.setType(SystemDictDO.Type.basic);
            systemDictDO.setSaasId(saasId);
            if(StringUtils.isBlank(systemDictDO.getSaasId())){
                systemDictDO.setSaasId(saasId);
            }
            this.save(systemDictDO);
        }
        result.put("response", ConstantUtils.SUCCESS);