Forráskód Böngészése

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

huangwenjie 5 éve
szülő
commit
9bbe86b632

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

@ -3,9 +3,11 @@ 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;
import javax.transaction.Transactional;
import java.util.List;
import java.util.Map;
@ -21,6 +23,7 @@ import java.util.Map;
 * </pre>
 * @since 1.
 */
//@Transactional
public interface DictHospitalDeptDao extends PagingAndSortingRepository<DictHospitalDeptDO, Integer>, JpaSpecificationExecutor<DictHospitalDeptDO>  {
    @Query("select code as code,name as name from DictHospitalDeptDO where orgCode in ?1")
@ -39,4 +42,8 @@ public interface DictHospitalDeptDao extends PagingAndSortingRepository<DictHosp
    DictHospitalDeptDO findByCode(String code);
    @Modifying
    @Query("delete from DictHospitalDeptDO  where orgCode=?1")
    void deleteByOrgCode(String orgCode);
}

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/mapping/dao/PatientMappingDao.java

@ -10,4 +10,5 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface PatientMappingDao extends PagingAndSortingRepository<PatientMappingDO, String>, JpaSpecificationExecutor<PatientMappingDO> {
    PatientMappingDO findByIdcardAndSource(String idcard,String source);
    PatientMappingDO findByMappingCodeAndSource(String mappingCode,String source);
}

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

@ -3,8 +3,13 @@ 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.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.dict.service.DictHospitalDeptService;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.hospital.mapping.HospitalDeptMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.hospital.mapping.dao.HospitalDeptMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
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;
@ -21,6 +26,7 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -35,6 +41,7 @@ import java.util.stream.Collectors;
 * Created by zdm on 2019/5/20.
 */
@Service
@Transactional
public class EntranceService {
    //门诊余额查询
    private static String BS15017="BS15017";
@ -69,7 +76,9 @@ public class EntranceService {
    @Value("${hospital.TargetSysCode}")
    private String targetSysCode;
    @Autowired
    private HospitalDeptMappingDao hospitalDeptMappingDao;
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private PatientMappingDao patientMappingDao;
    /**
     * 获取本地示例返参
@ -262,6 +271,8 @@ public class EntranceService {
                                if (!(null != stringSet && stringSet.contains(realOrder))) {
                                    //初始化处方
                                    wlyyPrescriptionVO = initWlyyPrescriptionVo(new WlyyPrescriptionVO(), jsonObjectBody, realOrder);
                                    wlyyPrescriptionVO.setHospital("350211A1002");
                                    wlyyPrescriptionVO.setHospitalName("厦门市中山医院");
                                    wlyyPrescriptionVOMap.put(realOrder, wlyyPrescriptionVO);
                                    //主诊断 毒蛇咬伤&T63.001
                                    String[] icdName = jsonObjectBody.get("icd_name").toString().split("&");
@ -347,10 +358,18 @@ public class EntranceService {
        wlyyPrescriptionVO.setRealOrder(realOrder);
        wlyyPrescriptionVO.setSerialNo(null != jsonObjectBody.get("REGISTER_SN") ? jsonObjectBody.get("REGISTER_SN").toString() : "");
        wlyyPrescriptionVO.setType(1);
        wlyyPrescriptionVO.setPatientCode(null != jsonObjectBody.get("PAT_NO") ? jsonObjectBody.get("PAT_NO").toString() : "");
        wlyyPrescriptionVO.setPatientName(null != jsonObjectBody.get("UOM") ? jsonObjectBody.get("UOM").toString() : "");
        //TODO 通过映射表获取居民身份证号e
        wlyyPrescriptionVO.setIdcard("");
        String patNo=null != jsonObjectBody.get("PAT_NO") ? jsonObjectBody.get("PAT_NO").toString() : "";
        String patientName=null != jsonObjectBody.get("UOM") ? jsonObjectBody.get("UOM").toString() : "";
        PatientMappingDO patientMappingDo=new PatientMappingDO();
        if(StringUtils.isNotBlank(patNo)){
            patientMappingDo=  patientMappingDao.findByMappingCodeAndSource(patNo,"1");
            patNo=StringUtils.isBlank(patientMappingDo.getPatient())?patNo:patientMappingDo.getPatient();
            patientName=StringUtils.isBlank(patientMappingDo.getPatientName())?patientName:patientMappingDo.getPatientName();
        }
        wlyyPrescriptionVO.setPatientCode(patNo);
        wlyyPrescriptionVO.setPatientName(patientName);
        wlyyPrescriptionVO.setIdcard(patientMappingDo.getIdcard());
        //TODO 社保卡号
        wlyyPrescriptionVO.setSsc("");
        wlyyPrescriptionVO.setHisDoctorCode(null != jsonObjectBody.get("PRESC_DOC") ? jsonObjectBody.get("PRESC_DOC").toString() : "");
@ -427,13 +446,22 @@ public class EntranceService {
            net.sf.json.JSONObject jsonObjectMgsInfo = (net.sf.json.JSONObject) object;
            if (null != jsonObjectMgsInfo) {
                wlyyOutpatientVO = new WlyyOutpatientVO();
                wlyyOutpatientVO.setHospital("350211A1002");
                wlyyOutpatientVO.setHospitalName("厦门市中山医院");
                wlyyOutpatientVO.setAdmNo(null == jsonObjectMgsInfo.get("ADM_NO") ? "" : jsonObjectMgsInfo.get("ADM_NO") + "");
                wlyyOutpatientVO.setRegisterNo(null == jsonObjectMgsInfo.get("REGISTER_SN") ? "" : jsonObjectMgsInfo.get("REGISTER_SN") + "");
                wlyyOutpatientVO.setDept(null == jsonObjectMgsInfo.get("ADM_SPEC") ? "" : jsonObjectMgsInfo.get("ADM_SPEC") + "");
                wlyyOutpatientVO.setDeptName(null == jsonObjectMgsInfo.get("ADM_SPEC_NAME") ? "" : jsonObjectMgsInfo.get("ADM_SPEC_NAME") + "");
                wlyyOutpatientVO.setPatient(null == jsonObjectMgsInfo.get("PAT_NO") ? "" : jsonObjectMgsInfo.get("PAT_NO") + "");
                wlyyOutpatientVO.setPatientName(null == jsonObjectMgsInfo.get("PAT_NAME") ? "" : jsonObjectMgsInfo.get("PAT_NAME") + "");
                String patNo=null != jsonObjectMgsInfo.get("PAT_NO") ? jsonObjectMgsInfo.get("PAT_NO").toString() : "";
                String patientName=null != jsonObjectMgsInfo.get("PAT_NAME") ? jsonObjectMgsInfo.get("PAT_NAME").toString() : "";
                PatientMappingDO patientMappingDo=new PatientMappingDO();
                if(StringUtils.isNotBlank(patNo)){
                    patientMappingDo=  patientMappingDao.findByMappingCodeAndSource(patNo,"1");
                    patNo=StringUtils.isBlank(patientMappingDo.getPatient())?patNo:patientMappingDo.getPatient();
                    patientName=StringUtils.isBlank(patientMappingDo.getPatientName())?patientName:patientMappingDo.getPatientName();
                }
                wlyyOutpatientVO.setPatient(patNo);
                wlyyOutpatientVO.setPatientName(patientName);
                wlyyOutpatientVO.setDoctor(null == jsonObjectMgsInfo.get("CON_DOC") ? "" : jsonObjectMgsInfo.get("CON_DOC") + "");
                wlyyOutpatientVO.setDoctorName(null == jsonObjectMgsInfo.get("CON_DOC_NAME") ? "" : jsonObjectMgsInfo.get("CON_DOC_NAME") + "");
@ -697,8 +725,8 @@ public class EntranceService {
     * @return
     * @throws Exception
     */
    @org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class)
    public List<HospitalDeptMappingDO> MS02001(boolean demoFlag) throws Exception {
//    @org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class)
    public List<DictHospitalDeptDO> MS02001(boolean demoFlag) throws Exception {
        String fid=MS02001;
        String resp="";
        if (demoFlag) {
@ -716,14 +744,36 @@ 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";
        Map<String,String> orgCodeMap=new HashMap<>();
        //6总部7金榜8夏禾
        orgCodeMap.put("6",orgCode);
        orgCodeMap.put("7","");
        orgCodeMap.put("8","");
        //删除旧数据
        hospitalDeptMappingDao.deleteBySource("1");
        List<String> strings=new ArrayList<>(orgCodeMap.values()) ;
        for(String s:strings) {
            if(StringUtils.isNotBlank(s)){
                dictHospitalDeptDao.deleteByOrgCode(s);
            }
        }
        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());
            String deptTypeCode=null==jsonObjectBody.get("Dept_Type_Code")?"":jsonObjectBody.get("Dept_Type_Code").toString();
            if(StringUtils.isNotBlank(orgCodeMap.get(deptTypeCode))){
                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(deptTypeCode);
                hdmDo.setCreateTime(new Date());
//                DictHospitalDeptDao.save(hdmDo);
                hospitalDeptMappingDOS.add(hdmDo);
            }
       /*     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 +786,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 +798,11 @@ 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.setCreateTime(new Date());
            hospitalDeptMappingDOS.add(hdmDo);
            hdmDo.setSource("1");*/
        }
        hospitalDeptMappingDao.save(hospitalDeptMappingDOS);
        dictHospitalDeptDao.save(hospitalDeptMappingDOS);
        return hospitalDeptMappingDOS;
    }

+ 13 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHospitalDeptDO.java

@ -41,6 +41,12 @@ public class DictHospitalDeptDO extends IntegerIdentityEntity {
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date createTime;
    /**
     * 6总部7金榜8夏禾
     */
    @Autowired
    private String deptTypeCode;
	@Column(name = "org_code")
    public String getOrgCode() {
@ -74,4 +80,11 @@ public class DictHospitalDeptDO extends IntegerIdentityEntity {
        this.createTime = createTime;
    }
    public String getDeptTypeCode() {
        return deptTypeCode;
    }
    public void setDeptTypeCode(String deptTypeCode) {
        this.deptTypeCode = deptTypeCode;
    }
}

+ 8 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHospitalDeptService.java

@ -95,4 +95,12 @@ public class DictHospitalDeptService extends BaseJpaService<DictHospitalDeptDO,
       return dictHospitalDeptDao.findByOrgCode(orgCode);
    }
    /**
     * 批量保存
     * @return
     */
    public void saveBatch(List<DictHospitalDeptDO> dictHospitalDeptDOS)throws Exception{
        dictHospitalDeptDao.save(dictHospitalDeptDOS);
    }
}

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

@ -1,9 +1,9 @@
package com.yihu.jw.entrance.controller;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.hospital.mapping.HospitalDeptMappingDO;
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 +12,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 +19,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
@ -176,7 +174,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);
    }