Browse Source

科室字典同步

zdm 6 years ago
parent
commit
328b7efb97

+ 5 - 0
business/base-service/src/main/java/com/yihu/jw/dict/dao/DictHospitalDeptDao.java

@ -3,6 +3,7 @@ package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -39,4 +40,8 @@ public interface DictHospitalDeptDao extends PagingAndSortingRepository<DictHosp
    DictHospitalDeptDO findByCode(String code);
    @Modifying
    @Query("delete from DictHospitalDeptDO  where orgCode=?1")
    void deleteBySource(String orgCode);
}

+ 17 - 12
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -3,8 +3,8 @@ package com.yihu.jw.hospital.prescription.service.entrance;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.hospital.mapping.HospitalDeptMappingDO;
import com.yihu.jw.hospital.mapping.dao.HospitalDeptMappingDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
import com.yihu.jw.hospital.prescription.service.entrance.util.WebserviceUtil;
@ -69,7 +69,7 @@ public class EntranceService {
    @Value("${hospital.TargetSysCode}")
    private String targetSysCode;
    @Autowired
    private HospitalDeptMappingDao hospitalDeptMappingDao;
    private DictHospitalDeptDao DictHospitalDeptDao;
    /**
     * 获取本地示例返参
@ -698,7 +698,7 @@ public class EntranceService {
     * @throws Exception
     */
    @org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class)
    public List<HospitalDeptMappingDO> MS02001(boolean demoFlag) throws Exception {
    public List<DictHospitalDeptDO> MS02001(boolean demoFlag) throws Exception {
        String fid=MS02001;
        String resp="";
        if (demoFlag) {
@ -716,14 +716,19 @@ public class EntranceService {
            resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
        }
        JSONArray jsonArray= ConvertUtil.convertListEnvelopInBody(resp);
        List<HospitalDeptMappingDO> hospitalDeptMappingDOS=new ArrayList<>();
        HospitalDeptMappingDO hdmDo;
        List<DictHospitalDeptDO> hospitalDeptMappingDOS=new ArrayList<>();
        DictHospitalDeptDO hdmDo;
        String orgCode="350211A1002";
        //删除旧数据
        hospitalDeptMappingDao.deleteBySource("1");
        DictHospitalDeptDao.deleteBySource(orgCode);
        for(Object object:jsonArray){
            hdmDo=new HospitalDeptMappingDO();
            hdmDo=new DictHospitalDeptDO();
            net.sf.json.JSONObject jsonObjectBody=(net.sf.json.JSONObject)object;
            hdmDo.setSerialNo(null==jsonObjectBody.get("Serial_No")?"":jsonObjectBody.get("Serial_No").toString());
            hdmDo.setOrgCode(orgCode);
            hdmDo.setCode(null==jsonObjectBody.get("Dept_Code")?"":jsonObjectBody.get("Dept_Code").toString());
            hdmDo.setName(null==jsonObjectBody.get("Dept_Name")?"":jsonObjectBody.get("Dept_Name").toString());
            hdmDo.setDeptTypeCode(null==jsonObjectBody.get("Dept_Type_Code")?"":jsonObjectBody.get("Dept_Type_Code").toString());
       /*     hdmDo.setSerialNo(null==jsonObjectBody.get("Serial_No")?"":jsonObjectBody.get("Serial_No").toString());
            hdmDo.setDeptCode(null==jsonObjectBody.get("Dept_Code")?"":jsonObjectBody.get("Dept_Code").toString());
            hdmDo.setDeptName(null==jsonObjectBody.get("Dept_Name")?"":jsonObjectBody.get("Dept_Name").toString());
            hdmDo.setDeptAlias(null==jsonObjectBody.get("Dept_Alias")?"":jsonObjectBody.get("Dept_Alias").toString());
@ -736,7 +741,6 @@ public class EntranceService {
            hdmDo.setInputCode(null==jsonObjectBody.get("Input_Code")?"":jsonObjectBody.get("Input_Code").toString());
            hdmDo.setPinyinCode(null==jsonObjectBody.get("Pinyin_Code")?"":jsonObjectBody.get("Pinyin_Code").toString());
            hdmDo.setWubiCode(null==jsonObjectBody.get("Wubi_Code")?"":jsonObjectBody.get("Wubi_Code").toString());
            hdmDo.setDeptTypeCode(null==jsonObjectBody.get("Dept_Type_Code")?"":jsonObjectBody.get("Dept_Type_Code").toString());
            hdmDo.setLocation(null==jsonObjectBody.get("Location")?"":jsonObjectBody.get("Location").toString());
            hdmDo.setDisplaySequence(null==jsonObjectBody.get("Display_Sequence")?"":jsonObjectBody.get("Display_Sequence").toString());
            hdmDo.setOpenBedNum(null==jsonObjectBody.get("Open_Bed_Num")?"":jsonObjectBody.get("Open_Bed_Num").toString());
@ -749,11 +753,12 @@ public class EntranceService {
            hdmDo.setDeptZipCode(null==jsonObjectBody.get("Dept_Zip_Code")?"":jsonObjectBody.get("Dept_Zip_Code").toString());
            hdmDo.setDeDlid(null==jsonObjectBody.get("De_Dlid")?"":jsonObjectBody.get("De_Dlid").toString());
            hdmDo.setDeLcid(null==jsonObjectBody.get("De_Lcid")?"":jsonObjectBody.get("De_Lcid").toString());
            hdmDo.setSource("1");
            hdmDo.setSource("1");*/
            hdmDo.setCreateTime(new Date());
            hospitalDeptMappingDOS.add(hdmDo);
        }
        hospitalDeptMappingDao.save(hospitalDeptMappingDOS);
        DictHospitalDeptDao.save(hospitalDeptMappingDOS);
//        hospitalDeptMappingDao.save(hospitalDeptMappingDOS);
        return hospitalDeptMappingDOS;
    }

+ 2 - 5
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java

@ -1,9 +1,8 @@
package com.yihu.jw.entrance.controller;
import com.yihu.jw.entity.hospital.mapping.HospitalDeptMappingDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -12,7 +11,6 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -20,7 +18,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
@ -176,7 +173,7 @@ public class MqSdkController extends EnvelopRestEndpoint {
    @GetMapping(value = "/MS02001")
    @ApiOperation(value = "科室字典  ")
    public ListEnvelop MS02001() throws Exception {
        List<HospitalDeptMappingDO> obj = entranceService.MS02001(demoFlag);
        List<DictHospitalDeptDO> obj = entranceService.MS02001(demoFlag);
        return success(obj);
    }