Pārlūkot izejas kodu

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

# Conflicts:
#	common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageLogDO.java
wangzhinan 4 gadi atpakaļ
vecāks
revīzija
6fbbc2db5d

+ 12 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -7323,12 +7323,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
            logger.info("开始=====" + wlyyPrescriptionDO.getCheckStatus());
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
            DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
            List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId, 1);
            List<WlyyPrescriptionExpressageDO> expressageDOS = prescriptionExpressageDao.findByOutpatientId(outpatientDO.getId());
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                try {
                    List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
                    List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId, 1);
                    DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                    List<WlyyPrescriptionExpressageDO> expressageDOS = prescriptionExpressageDao.findByOutpatientId(outpatientDO.getId());
                    //his处方拼接开方条件
                    com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
                    for (WlyyPrescriptionInfoDO info : infoDOS) {
@ -7413,6 +7414,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    e.printStackTrace();
                }
            }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                try {
                    com.alibaba.fastjson.JSONObject object = xzzxEntranceService.savePrescriptionToEntrance("0",outpatientDO.getCardNo(),outpatientDO.getRegisterNo(),outpatientDO.getDept(),doctorMappingDO.getMappingCode(),"50100",infoDOS);
                    logger.info("成功上传处方"+object);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            prescriptionLogService.addPrescriptionLog(prescriptionId, 20, 2, operate, operateName, reason, new Date());
            wlyyPrescriptionDO.setCheckStatus(2);

+ 109 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -1185,6 +1185,81 @@ public class XzzxEntranceService{
        logger.info(" GetLisApply json:"+json);
        return json;
    }
    /**
     * 互联网医院开处方信息更新到his
     * @param IoFlag  门诊住院标志
     * @param PayCardNo 就诊卡号
     * @param NullahNumber 挂号流水号
     * @param ApplyDept 执行科室
     * @param ApplyDoctor 开单医生
     * @param ExecuteDept 执行科室(药房)
     * @param prescriptionInfoDOList
     * @return
     * @throws Exception
     */
    public String savePrescriptionToHospital(String IoFlag,String PayCardNo,String NullahNumber,
                                             String ApplyDept,String ApplyDoctor,String ExecuteDept,List<WlyyPrescriptionInfoDO> prescriptionInfoDOList)throws Exception{
        String api = "savePrescriptionToHospital";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (!StringUtils.isEmpty(IoFlag)){
            condition += "<IoFlag>"+IoFlag+"</IoFlag>";
        }
        if (!StringUtils.isEmpty(PayCardNo)){
            condition += "<PayCardNo>"+PayCardNo+"</PayCardNo>";
        }
        if (!StringUtils.isEmpty(NullahNumber)){
            condition += "<NullahNumber>"+NullahNumber+"</NullahNumber>";
        }
        if (!StringUtils.isEmpty(ApplyDept)){
            condition += "<ApplyDept>"+ApplyDept+"</ApplyDept>";
        }
        if (!StringUtils.isEmpty(ApplyDoctor)){
            condition += "<ApplyDoctor>"+ApplyDoctor+"</ApplyDoctor>";
        }
        if (!StringUtils.isEmpty(ExecuteDept)){
            condition += "<ExecuteDept>"+ExecuteDept+"</ExecuteDept>";
        }
        condition +="<PresDetail>";
        for (WlyyPrescriptionInfoDO prescriptionInfoDO:prescriptionInfoDOList){
            String condition1 = "";
            condition1 += "<PhysicCode>"+prescriptionInfoDO.getDrugNo()+"</PhysicCode>";
            condition1 += "<Doseage>"+prescriptionInfoDO.getDosage()+"</Doseage>";
            condition1 += "<DoseUnit>"+prescriptionInfoDO.getUnit()+"</DoseUnit>";
            condition1 += "<Frequency>"+prescriptionInfoDO.getFrequency()+"</Frequency>";
            condition1 += "<DayCount>"+prescriptionInfoDO.getDays()+"</DayCount>";
            condition1 += "<Usage>"+prescriptionInfoDO.getUsageCode()+"</Usage>";
            condition1 += "<TotalDoseage>"+prescriptionInfoDO.getQuantity()+"</TotalDoseage>";
            condition1 += "<TotalUnit>"+prescriptionInfoDO.getPackUnit()+"</TotalUnit>";
            condition1 += "<PrescribeMemo>"+"</PrescribeMemo>";
            condition1 += "<FryMode>"+"</FryMode>";
            condition1 += "<HerbalTakeMethodClass>"+"</HerbalTakeMethodClass>";
            condition1 += "<HerbalFryMethod>"+"</HerbalFryMethod>";
            condition1 += "<HerbalFryMethod2>"+"</HerbalFryMethod2>";
            condition+="<PresInfo>"+condition1+"</PresInfo>";
        }
        condition+="</PresDetail>";
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("savePrescriptionToHospital params:"+params.toString());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info(" savePrescriptionToHospital json:"+json);
        return json;
    }
//=====================微信模板消息推送===================================
    public String sendMes(String wxId,String patient,String cardNo,String first,String noticeContent,String remark,String redirectUrl){
@ -2222,6 +2297,40 @@ public class XzzxEntranceService{
        return jsonArray;
    }
    /**
     *
     * @param ioFlag 门诊住院标志
     * @param payCardNo 就诊卡号
     * @param nullahNumber 挂号流水号
     * @param applyDept 执行科室
     * @param applyDoctor 开单医生
     * @param executeDept 执行科室(药房)
     * @param wlyyPrescriptionInfoVOS
     * @return
     * @throws Exception
     */
    public JSONObject savePrescriptionToEntrance(String ioFlag,String payCardNo,String nullahNumber,String applyDept,String applyDoctor,String executeDept,List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS) throws Exception {
        JSONObject jsonObject = new JSONObject();
        String response = "";
        String url = entranceUrl+"savePrescriptionToHospital";
        Map<String,String> params = new HashedMap();
        params.put("IoFlag",ioFlag);
        params.put("PayCardNo",payCardNo);
        params.put("NullahNumber",nullahNumber);
        params.put("ApplyDept",applyDept);
        params.put("ApplyDoctor",applyDoctor);
        params.put("ExecuteDept",executeDept);
        params.put("prescriptionInfoDOS",wlyyPrescriptionInfoDOS.toString());
        response = httpClientUtil.httpPost(url,params);
        logger.info("开方成功"+response);
        JSONObject object = JSONObject.parseObject(response);
        if(object.getInteger("status")==200){
             jsonObject = object.getJSONObject("obj");
        }
        return jsonObject;
    }
//=====================hospital应用调用entrance应用============end=================

+ 39 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/XzzxCotroller.java

@ -1,5 +1,6 @@
package com.yihu.jw.entrance.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
@ -381,4 +382,42 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
                                   @RequestParam(value = "spellCode",required = false)String spellCode)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.GetLisApply(spellCode));
    }
    /**
     * 互联网医院开处方信息更新到his
     *
     * @param IoFlag  门诊住院标志
     * @param PayCardNo 就诊卡号
     * @param NullahNumber 挂号流水号
     * @param ApplyDept 执行科室
     * @param ApplyDoctor 开单医生
     * @param ExecuteDept 执行科室(药房)
     * @param prescriptionInfoVOS
     */
    @PostMapping(value = "/savePrescriptionToHospital")
    @ApiOperation(value = "互联网医院开处方信息更新到his", notes = "互联网医院开处方信息更新到his")
    public ObjEnvelop savePrescriptionToHospital(@ApiParam(name = "IoFlag", value = "门诊住院标志", required = false)
                                                     @RequestParam(value = "IoFlag",required = false)String IoFlag,
                                                 @ApiParam(name = "PayCardNo", value = "就诊卡号", required = false)
                                                    @RequestParam(value = "PayCardNo",required = false)String PayCardNo,
                                                 @ApiParam(name = "NullahNumber", value = "挂号流水号", required = false)
                                                     @RequestParam(value = "NullahNumber",required = false)String NullahNumber,
                                                 @ApiParam(name = "ApplyDept", value = "执行科室", required = false)
                                                     @RequestParam(value = "ApplyDept",required = false)String ApplyDept,
                                                 @ApiParam(name = "ApplyDoctor", value = "开单医生", required = false)
                                                     @RequestParam(value = "ApplyDoctor",required = false)String ApplyDoctor,
                                                 @ApiParam(name = "ExecuteDept", value = "执行科室(药房)", required = false)
                                                     @RequestParam(value = "ExecuteDept",required = false)String ExecuteDept,
                                                 @ApiParam(name = "prescriptionInfoDOS", value = "药品信息", required = false)
                                                     @RequestParam(value = "prescriptionInfoDOS",required = false)String prescriptionInfoDOS)throws Exception{
        List<WlyyPrescriptionInfoDO> prescriptionInfoDOList = new ArrayList<>();
        if (prescriptionInfoDOS!=null){
            JSONArray jsonArray = JSONArray.parseArray(prescriptionInfoDOS);
            for (int i=0;i<jsonArray.size();i++){
                WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO = toEntity(jsonArray.getJSONObject(i).toJSONString(),WlyyPrescriptionInfoDO.class);
                prescriptionInfoDOList.add(wlyyPrescriptionInfoDO);
            }
        }
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.savePrescriptionToHospital(IoFlag,PayCardNo,NullahNumber,ApplyDept,ApplyDoctor,ExecuteDept,prescriptionInfoDOList));
    }
}