Преглед на файлове

第三医院版本开发

wangzhinan преди 1 година
родител
ревизия
5493229d04

+ 26 - 3
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/DsyyPrescriptionService.java

@ -1130,7 +1130,7 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
           JSONObject object = array.getJSONObject(i);
           String PATIENT = object.getString("PATIENT");
           String OPID = object.getString("OPID");
           String res = selectHistoryEmrRecord(PATIENT,OPID);
           String res = selectHistoryEmrRecordJcpt(PATIENT,OPID);
           if (StringUtils.isNoneBlank(res)){
               jsonArray.add(object);
           }
@ -1138,6 +1138,29 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        return jsonArray;
    }
    /**
     * 查询历次就诊门诊病历文书集成平台
     * @param patientId 病人id
     * @param eventNo 就诊次数
     * @return
     */
    public String selectHistoryEmrRecordJcpt(String patientId,String eventNo) throws Exception {
        String url = entranceUrl +"selectEmrInfoIdJcpt";
        String object = "";
        Map<String,Object> params = new HashedMap();
        params.put("patientId",patientId);
        params.put("visitNo",eventNo);
        HttpResponse response = HttpUtils.doPost(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            object = rs.getString("obj");
        }
        return object;
    }
    /**
     * 查询历次就诊门诊病历文书
@ -1157,7 +1180,7 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            object = rs.getString("obj");
            object = rs.getString("detailModelList");
        }
        return object;
    }
@ -1284,7 +1307,7 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     */
    public JSONObject registerOutPatient(String outPatientId, String doctor){
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId).orElse(null);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId).get();
        List<WlyyPrescriptionExpressageDO> expressageDOS =prescriptionExpressageDao.findByOutpatientId(outPatientId);
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        BaseDoctorDO doctorDO = baseDoctorDao.findByIdAndDel(doctor);

+ 136 - 9
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/DsyyEntranceService.java

@ -50,6 +50,7 @@ import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.httpclient.util.EncodingUtil;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -841,7 +842,7 @@ public class DsyyEntranceService {
    public WlyyOutpatientVO selectOutpatientInfo(String patient,String conNo) throws Exception {
        WlyyOutpatientVO outpatientVO = new WlyyOutpatientVO();
        JSONArray array = new JSONArray();
        BasePatientDO patientDO = patientDao.findById(patient).orElse(null);
        BasePatientDO patientDO = patientDao.findById(patient).get();
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if (patientMappingDO!=null){
            patient = patientMappingDO.getMappingCode();
@ -1906,7 +1907,7 @@ public class DsyyEntranceService {
        if (StringUtils.isNoneBlank(hismzlsh)){
            object.put("hismzlsh",hismzlsh);
        }
        object.put("trade_type","5");
//        object.put("trade_type","5");
        object.put("accountType","01");
        object.put("sfxsjs","Y");
        condition = object.toJSONString();
@ -2854,8 +2855,8 @@ public class DsyyEntranceService {
                "<CREATE_USER_NAME>"+prescriptionDO.getDoctorName()+"</CREATE_USER_NAME>" +
                "<CREATE_DATE_TIME>"+DateUtil.dateToStrLong(prescriptionDO.getCreateTime())+"</CREATE_DATE_TIME>" +
                "<MR_CODE>EMR10.00.18_36</MR_CODE>" +
                "<TOPIC>嘉和提供</TOPIC>" +
                "<HOSPITAL_NO>医院编码</HOSPITAL_NO>" +
                "<TOPIC>互联网医院专用</TOPIC>" +
                "<HOSPITAL_NO>42661889-5</HOSPITAL_NO>" +
                "<DEPT_CODE>"+prescriptionDO.getDept()+"</DEPT_CODE>" +
                "<DEPT_NAME>"+prescriptionDO.getDeptName()+"</DEPT_NAME>" +
                "<FILE_FLAG>1</FILE_FLAG>" +
@ -2935,6 +2936,130 @@ public class DsyyEntranceService {
        return json;
    }
    public JSONArray selectEmrInfoIdAndVisitNo(String patientId,String visitNo) throws Exception {
        String url = "HTTP://10.95.8.41:51221";
        String xml = "{\n" +
                "    \"serverCode\": \"JHIDS-USD-HLWMZBL-012\",\n" +
                "    \"sysCode\": \"HLW\",\n" +
                "    \"pageSize\": \"10\",\n" +
                "    \"pageNo\": \"1\",\n" +
                "  \t\"orders\": [\n" +
                "\t\n" +
                "\t],\n" +
                "\t\"condition\": [\n" +
                "\t\t{\n" +
                "\t\t\t\"column\": \"PATIENT_ID\",\n" +
                "\t\t\t\"type\": \"eq\",\n" +
                "\t\t\t\"value\": \""+patientId+"\"\n" +
                "\t\t},\n" +
                "        \t{\n" +
                "\t\t\t\"column\": \"VISIT_ID\",\n" +
                "\t\t\t\"type\": \"eq\",\n" +
                "\t\t\t\"value\": \""+visitNo+"\"\n" +
                "\t\t}\n" +
                "\t]\n" +
                "}";
        logger.info("xml"+xml);
        String response = httpClientUtil.postHeadBodyText(url,xml);
        logger.info("response===="+response);
        JSONArray jsonArray =new JSONArray();
        Object json = JSON.parse(response);
        if (json instanceof JSONObject) {
            JSONObject jsonObject = (JSONObject) json;
            if (jsonObject.getString("code").equalsIgnoreCase("401")){
                throw new Exception(jsonObject.getString("message"));
            }
        } else if (json instanceof JSONArray) {
            JSONArray array = (JSONArray) json;
            array = JSONArray.parseArray(response);
            for (int i=0;i<array.size();i++){
                JSONObject object = array.getJSONObject(i);
                String EMRPDF=object.getString("EMRPDF");
                byte[] emrByte = Base64.decodeBase64(EMRPDF);
                String emrDecode = new String(emrByte, "GBK");
                object.put("EMRPDFHTMl", emrDecode);
            }
            jsonArray = array;
        }
        WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
        httpLogDO.setCode("selectEmrInfo");
        httpLogDO.setName("查下电子病历");
        httpLogDO.setRequest(xml);
        httpLogDO.setResponse(response);
        httpLogDO.setStatus("1");
        wlyyHttpLogDao.save(httpLogDO);
        return jsonArray;
    }
    public String dzblIcd10Save(String prescriptionId)throws Exception{
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).get();
        if (prescriptionDO==null){
            throw new Exception("该处方不存在");
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(prescriptionDO.getPatientCode());
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).get();
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
        BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor()).get();
        BasePatientDO patientDO = patientDao.findById(prescriptionDO.getPatientCode()).get();
        Integer visitId=0;
        if (outpatientDO.getRegisterNo() != null && outpatientDO.getRegisterNo().length() >= 3) {
            String str = outpatientDO.getRegisterNo().substring(outpatientDO.getRegisterNo().length() - 3);
            visitId = Integer.parseInt(str);
        }
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = diagnosisDao.findByPrescriptionId(prescriptionId,1);
        String diagnosis = "";
        for (WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOS){
            diagnosis+=diagnosisDO.getName()+"|"+diagnosisDO.getCode()+"|";
        }
        if (StringUtils.isNoneBlank(diagnosis)){
            diagnosis = diagnosis.substring(0,diagnosis.length()-1);
        }
        String sexName="未知";
        if (patientDO.getSex()==1){
            sexName="男";
        }else if (patientDO.getSex()==2){
            sexName="女";
        }
        String info="";
        List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
        for (int i=0;i<infoDOS.size();i++){
            WlyyPrescriptionInfoDO infoDO = infoDOS.get(i);
            info+=(i+1)+"|"+infoDO.getDrugName()+"|"+infoDO.getDosage()+"|"+infoDO.getUnit()+"|"+infoDO.getSupplyName()+"|"+
                    infoDO.getUsageName()+"|"+infoDO.getDays()+"|"+infoDO.getQuantity()+"|"+infoDO.getPackUnit()+"|";
            info = info.substring(0,info.length()-1);
        }
        String condition = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
                "  <MESSAGE>\n" +
                "    <PATIENT_ID>"+patientMappingDO.getMappingCode()+"</PATIENT_ID>\n" +
                "    <VISIT_ID>"+visitId+"</VISIT_ID>\n" +
                "    <NAME>"+outpatientDO.getPatientName()+"</NAME>\n" +
                "    <NAME_PHONETIC>CS</NAME_PHONETIC>\n" +
                "    <SEX>"+sexName+"</SEX>\n" +
                "    <ID_NO>"+patientDO.getIdcard()+"</ID_NO>\n" +
                "    <CITIZENSHIP>中国</CITIZENSHIP>\n" +
                "    <DATE_OF_BIRTH>"+patientDO.getBirthday()+"</DATE_OF_BIRTH>\n" +
                "    <CARD_NO>"+outpatientDO.getCardNo()+"</CARD_NO>\n" +
                "    <CREATE_DATE></CREATE_DATE>\n" +
                "    <AGE>"+DateUtil.getAgeForIdcard(patientDO.getIdcard())+"岁</AGE>\n" +
                "    <VISIT_DEPT>"+outpatientDO.getDept()+"</VISIT_DEPT>\n" +
                "    <VISIT_DATE>"+DateUtil.dateToStrLong(outpatientDO.getRegisterDate())+"</VISIT_DATE>\n" +
                "    <HIS_REGISTER_PK>"+outpatientDO.getRegisterNo()+"</HIS_REGISTER_PK>\n" +
                "    <DOCTOR_IN_CHARGE>"+doctorMappingDO.getMappingCode()+"</DOCTOR_IN_CHARGE>\n" +
                "    <HOSPITAL_NO>42661889-5</HOSPITAL_NO>\n" +
                "  </MESSAGE>";
        String pInput=condition;
        logger.info("电子病历诊断保存入参"+pInput);
        ServiceLocator locator = new ServiceLocator();
        java.net.URL endpoint = new java.net.URL("http://10.95.8.41/csp/jhip/JHIPLIB.SOAP.BS.Service.cls?CfgItem=JH1228%E4%BA%92%E8%81%94%E7%BD%91%E4%BF%9D%E5%AD%98%E6%8E%A5%E8%AF%8A%E4%BF%A1%E6%81%AFBS");
        String returnStr = locator.getServiceSoap(endpoint).send(pInput);
        logger.info("电子病历诊断保存出参"+returnStr);
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(returnStr).toString();
        return json;
    }
    /**
     * 电子病历保存
@ -2943,6 +3068,7 @@ public class DsyyEntranceService {
     * @throws Exception
     */
    public String dzblSave(String prescriptionId)throws Exception{
        dzblIcd10Save(prescriptionId);
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).get();
        if (prescriptionDO==null){
            throw new Exception("该处方不存在");
@ -2988,6 +3114,9 @@ public class DsyyEntranceService {
        String condition = "<MESSAGE>\n" +
                "    <PATIENT_ID>"+patientMappingDO.getMappingCode()+"</PATIENT_ID>\n" +
                "    <HIS_REGISTER_PK>"+outpatientDO.getRegisterNo()+"</HIS_REGISTER_PK>\n" +
                "   <FILE_VISIT_TYPE>0</FILE_VISIT_TYPE>"+
                "   <IS_MR_CREATE>0</IS_MR_CREATE>"+
                "   <SYNC_WAY>I</SYNC_WAY>"+
                "    <VISIT_ID>"+visitId+"</VISIT_ID>\n"+
                "    <IS_MR_CREATE>1</IS_MR_CREATE>\n" +
                "    <SYNC_WAY>1</SYNC_WAY>\n"+
@ -2995,13 +3124,13 @@ public class DsyyEntranceService {
                "    <CREATE_USER_NAME>"+prescriptionDO.getDoctorName()+"</CREATE_USER_NAME>\n" +
                "    <CREATE_DATE_TIME>"+DateUtil.dateToStrLong(prescriptionDO.getCreateTime())+"</CREATE_DATE_TIME>\n" +
                "    <MR_CODE>EMR10.00.18_36</MR_CODE>\n" +
                "    <TOPIC>嘉和提供</TOPIC>\n" +
                "    <HOSPITAL_NO>医院编码</HOSPITAL_NO>\n" +
                "    <TOPIC>互联网医院专用</TOPIC>\n" +
                "    <HOSPITAL_NO>42661889-5</HOSPITAL_NO>\n" +
                "    <DEPT_CODE>"+prescriptionDO.getDept()+"</DEPT_CODE>\n" +
                "    <DEPT_NAME>"+prescriptionDO.getDeptName()+"</DEPT_NAME>\n" +
                "    <FILE_FLAG>1</FILE_FLAG>\n" +
                "    <SHCZZT_FLAG>"+doctorMappingDO.getMappingCode()+"</SHCZZT_FLAG>\n" +
                "    <CA_SIGN_PIC>"+stamp+"</CA_SIGN_PIC>\n" +
                "    <CA_SIGN_PIC></CA_SIGN_PIC>\n" +
                "    <Structured_medical>\n" +
                "      <主诉>"+prescriptionEmrDO.getComplaint()+"</主诉>\n" +
                "      <流行病学史>"+prescriptionEmrDO.getPopularHistory()+"</流行病学史>\n" +
@ -3256,8 +3385,6 @@ public class DsyyEntranceService {
    public String checkPrescription(String serviceCode,String xml,String name){
        String url = "http://10.95.8.71:2002/face?charset=utf-8&post_type=1&serviceCode="+serviceCode;
        JSONObject object = new JSONObject();
        object.put("xml",xml);
        logger.info("xml"+xml);
        String response = httpClientUtil.postBodyText(url,xml);
        XMLSerializer xmlSerializer = new XMLSerializer();

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

@ -1653,7 +1653,7 @@ public class EntranceService {
    }
    public String ylzRefund(String outPatientId,boolean sys) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId).orElse(null);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId).get();
        if (outpatientDO == null) {
            throw new Exception("门诊信息表为空");
        }

+ 15 - 2
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -7,6 +7,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxPayLogDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
@ -15,6 +16,7 @@ import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
@ -1405,7 +1407,19 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        orderRefundDO.setPatientName(patientDO.getName());
        orderRefundDO.setRefundDesc(description);
        orderRefundDO = orderRefundDao.save(orderRefundDO);
        String map = ylzPayService.refund(patientDO.getIdcard(),"123456",patientDO.getName(),"01",patientDO.getIdcard(),"01",orderRefundDO.getRefundPrice().toString(),"1",orderRefundDO.getOrderNo(),orderRefundDO.getOutRefundNo(),patientDO.getIdcard());
        String operatorId = "";
        String operatorName = "";
        if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
            operatorId = "123456";
            operatorName =businessOrderDO.getPatientName();
        }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){
            operatorId = "hlwyy";
            operatorName = "互联网医院";
        }else if(wechatId.equalsIgnoreCase("xm_hcyy_wx")){
            operatorId = "hlwyy";
            operatorName = "互联网医院";
        }
        String map = ylzPayService.refund(patientDO.getIdcard(),operatorId,operatorName,"01",patientDO.getIdcard(),"01",orderRefundDO.getRefundPrice().toString(),"1",orderRefundDO.getOrderNo(),orderRefundDO.getOutRefundNo(),patientDO.getIdcard());
        JSONObject object = JSONObject.parseObject(map);
        if (object.get("respCode").toString().equalsIgnoreCase("000000")){
            orderRefundDO.setStatus(2);
@ -2051,7 +2065,6 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    /**
     * 预交金支付
     * @param code

+ 15 - 1
common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java

@ -436,10 +436,24 @@ public class HttpClientUtil {
        return ret;
    }
    public  String postHeadBodyText(String url, String params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("text/plain; charset=GBK");
        headers.setContentType(type);
        headers.add("grant_type","client_credentials");
        headers.add("client_id","HLW");
        headers.add("client_secret","123456");
        headers.add("Accept", MediaType.TEXT_PLAIN_VALUE.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params, headers);
        String ret = restTemplate.postForObject(url, formEntity, String.class);
        return ret;
    }
    public  static String postBodyStatic(String url, com.alibaba.fastjson.JSONObject params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        MediaType type = MediaType.parseMediaType("application/json; charset=GBK");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);

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

@ -559,10 +559,19 @@ public class DsyyController extends EnvelopRestEndpoint {
    @PostMapping(value = "/selectEmrInfoId")
    @ApiOperation(value = "病历查询")
    public ObjEnvelop selectEmrInfoId(@ApiParam(name = "patientId", value = "患者id", required = false)
    public ListEnvelop selectEmrInfoId(@ApiParam(name = "patientId", value = "患者id", required = false)
                               @RequestParam(value = "patientId",required = false)String patientId,
                                     @ApiParam(name = "visitNo", value = "就诊次数", required = false)
                                               @ApiParam(name = "visitNo", value = "就诊次数", required = false)
                                     @RequestParam(value = "visitNo",required = false)String visitNo) throws Exception {
        return success("请求成功",dsyyEntranceService.selectEmrInfoIdAndVisitNo(patientId,visitNo));
    }
    @PostMapping(value = "/selectEmrInfoIdJcpt")
    @ApiOperation(value = "病历查询-webservice")
    public ObjEnvelop<String> selectEmrInfoIdJcpt(@ApiParam(name = "patientId", value = "患者id", required = false)
                                       @RequestParam(value = "patientId",required = false)String patientId,
                                                  @ApiParam(name = "visitNo", value = "就诊次数", required = false)
                                       @RequestParam(value = "visitNo",required = false)String visitNo) throws Exception {
        return success("请求成功",dsyyEntranceService.selectEmrInfoId(patientId,visitNo));
    }