Pārlūkot izejas kodu

Merge branch 'dev' of wangjun/wlyy2.0 into dev

wangzhinan 4 gadi atpakaļ
vecāks
revīzija
d7f8ed3276

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

@ -2372,6 +2372,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //上传his开方
                //sendHisDiagnosis(jsonData, outpatientDO, prescription)
                //zsSynHis(prescription.getId());
                Map<String, Object> result1 = new HashedMap();
                result1.put("code", 1);
                result1.put("mes", "开方提交成功");
@ -2396,7 +2397,60 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    /**
     * 组装检查检验项目参数
     *
     * @param outpatientId
     * @return
     */
    public void syCheckParam(String outpatientId) throws  Exception{
        String condition ="";
        condition = "<IoFlag>"+0+"</IoFlag>";
        StringBuffer inspectionList = new StringBuffer();
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        String applyDoctor = "";
        if (null!=outpatientDO){
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(outpatientDO.getDoctor());
            if (null!=doctorMappingDO){
                applyDoctor = doctorMappingDO.getMappingCode();
            }
            condition += "<PayCardNo>"+outpatientDO.getCardNo()+"</PayCardNo>";
            condition += "<NullahNumber>"+outpatientDO.getRegisterNo()+"</NullahNumber>";
            condition += "<ApplyDept>"+outpatientDO.getDept()+"</ApplyDept>";
            condition += "<ApplyDoctor>"+applyDoctor+"</ApplyDoctor>";
            List<WlyyInspectionDO>  wlyyInspectionDOS = wlyyInspectionDao.findByOutpatientId(outpatientDO.getId());
            if (null!=wlyyInspectionDOS&&wlyyInspectionDOS.size()>0){
                for (WlyyInspectionDO wlyyInspectionDO:wlyyInspectionDOS){
                    inspectionList.append("<PresInfo>");
                    inspectionList.append("<ClinicCode>"+wlyyInspectionDO.getCode()+"</ClinicCode>");
                    inspectionList.append("<ClinicNum>"+wlyyInspectionDO.getQuantity()+"</ClinicNum>");
                    inspectionList.append("<ExecuteDept>"+wlyyInspectionDO.getDept()+"</ExecuteDept>");
                    inspectionList.append("<CheckResult>"+wlyyInspectionDO.getYwjcResult()+"</CheckResult>");
                    inspectionList.append("<CheckPart>"+wlyyInspectionDO.getCheckPart()+"</CheckPart>");
                    inspectionList.append("<SickSynptom>"+"临床症状和体征 "+"</SickSynptom>");
                    inspectionList.append("<Height>"+"身高"+"</Height>");
                    inspectionList.append("<Weight>"+"体重"+"</Weight>");
                    inspectionList.append("<SensitiveName>"+"过敏史"+"</SensitiveName>");
                    inspectionList.append("<SampleCode>"+"标本类型"+"</SampleCode>");
                    inspectionList.append("<ChiefComplaint>"+"主诉"+"</ChiefComplaint>");
                    inspectionList.append("<MedicalHistory>"+"病史"+"</MedicalHistory>");
                    inspectionList.append("<InspectionPurpose>"+wlyyInspectionDO.getGoal()+"</InspectionPurpose>");
                    inspectionList.append("<PastHistory>"+"既往史"+"</PastHistory>");
                    inspectionList.append("<LisCheckResult>"+"历史检验相关结果(化验单)"+"</LisCheckResult>");
                    inspectionList.append("<InspectionResult>"+"相关辅助检查"+"</InspectionResult>");
                    inspectionList.append("<InspectionNotice>"+"注意事项"+"</InspectionNotice>");
                    inspectionList.append("<Memo>"+wlyyInspectionDO.getCode()+"</Memo>");
                    inspectionList.append("</PresInfo>");
                }
                condition += "<PresDetail>" +inspectionList.toString()+"</PresDetail>";
            }
            String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                    "<root>"+condition+"</root>";
            Map resultMap =  xzzxEntranceService.checkSyncHis(msgBody);
            logger.info("同步his检查检验返回结果:"+resultMap.get("success"));
        }
    }
    /**
     * 计算药品费用

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

@ -1096,7 +1096,7 @@ public class XzzxEntranceService{
     * @return
     * @throws Exception
     */
    public String  GetCheckBody()throws Exception{
    public String  GetCheckBody(String spellCode)throws Exception{
        String api = "GetCheckBody";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
@ -1106,9 +1106,11 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (!StringUtils.isEmpty(spellCode)){
            condition = "<spell_code>"+spellCode+"</spell_code>";
        }
        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);
@ -1185,6 +1187,68 @@ public class XzzxEntranceService{
        logger.info(" GetLisApply json:"+json);
        return json;
    }
    /**
     * 组装检查检验项目参数
     *
     * @param
     * @return
     */
    public String saveInspectToHospital(String IoFlag,String PayCardNo,String NullahNumber,String ApplyDept,String ApplyDoctor,List<WlyyInspectionDO> wlyyInspectionDOS) throws  Exception{
        String api = "saveInspectToHospital";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        condition = "<IoFlag>"+IoFlag+"</IoFlag>";
        StringBuffer inspectionList = new StringBuffer();
        String applyDoctor = "";
        condition += "<PayCardNo>"+PayCardNo+"</PayCardNo>";
        condition += "<NullahNumber>"+NullahNumber+"</NullahNumber>";
        condition += "<ApplyDept>"+ApplyDept+"</ApplyDept>";
        condition += "<ApplyDoctor>"+ApplyDoctor+"</ApplyDoctor>";
        for (WlyyInspectionDO wlyyInspectionDO:wlyyInspectionDOS){
            inspectionList.append("<PresInfo>");
            inspectionList.append("<ClinicCode>"+wlyyInspectionDO.getCode()+"</ClinicCode>");
            inspectionList.append("<ClinicNum>"+wlyyInspectionDO.getQuantity()+"</ClinicNum>");
            inspectionList.append("<ExecuteDept>"+wlyyInspectionDO.getDept()+"</ExecuteDept>");
            inspectionList.append("<CheckResult>"+wlyyInspectionDO.getYwjcResult()+"</CheckResult>");
            inspectionList.append("<CheckPart>"+wlyyInspectionDO.getCheckPart()+"</CheckPart>");
            inspectionList.append("<SickSynptom>"+"临床症状和体征 "+"</SickSynptom>");
            inspectionList.append("<Height>"+"身高"+"</Height>");
            inspectionList.append("<Weight>"+"体重"+"</Weight>");
            inspectionList.append("<SensitiveName>"+"过敏史"+"</SensitiveName>");
            inspectionList.append("<SampleCode>"+"标本类型"+"</SampleCode>");
            inspectionList.append("<ChiefComplaint>"+"主诉"+"</ChiefComplaint>");
            inspectionList.append("<MedicalHistory>"+"病史"+"</MedicalHistory>");
            inspectionList.append("<InspectionPurpose>"+wlyyInspectionDO.getGoal()+"</InspectionPurpose>");
            inspectionList.append("<PastHistory>"+"既往史"+"</PastHistory>");
            inspectionList.append("<LisCheckResult>"+"历史检验相关结果(化验单)"+"</LisCheckResult>");
            inspectionList.append("<InspectionResult>"+"相关辅助检查"+"</InspectionResult>");
            inspectionList.append("<InspectionNotice>"+"注意事项"+"</InspectionNotice>");
            inspectionList.append("<Memo>"+wlyyInspectionDO.getCode()+"</Memo>");
            inspectionList.append("</PresInfo>");
        }
        condition += "<PresDetail>" +inspectionList.toString()+"</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("saveInspectToHospital params:"+params.toString());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info(" saveInspectToHospital json:"+json);
        return json;
    }
//=====================微信模板消息推送===================================
    public String sendMes(String wxId,String patient,String cardNo,String first,String noticeContent,String remark,String redirectUrl){
@ -2222,6 +2286,138 @@ public class XzzxEntranceService{
        return jsonArray;
    }
    /**
     * 查询检查部位
     * @param spellCode 拼音码
     * @return
     */
    public JSONArray selectCheckBody(String spellCode) throws Exception {
        String response="";
        String url = entranceUrl+"getCheckBody?spellCode="+spellCode;
        response = httpClientUtil.get(url,"GBK");
        JSONObject object = JSONObject.parseObject(response);
        JSONArray jsonArray = new JSONArray();
        if(object.getInteger("status")==200){
            String obj = object.getString("obj");
            JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
            for (int i=0;i<array.size();i++){
                JSONObject jsonObject = array.getJSONObject(i);
                JSONObject object1 = new JSONObject();
                object1.put("@action","select");
                object1.put("name",jsonObject.getString("NAME"));
                object1.put("code",jsonObject.getString("CODE"));
                object1.put("data",jsonObject.getString("DATA"));
                object1.put("py_code",jsonObject.getString("SPELL_CODE"));
                object1.put("memo",jsonObject.getString("MEMO"));
                object1.put("wb_code",jsonObject.getString("WBZX_CODE"));
                object1.put("sequence",jsonObject.getString("SEQUENCE"));
                object1.put("valid",jsonObject.getString("VALID"));
                jsonArray.add(object1);
            }
        }
        return jsonArray;
    }
    /**
     * 查询检查项目
     * @param spellCode 拼音码或药品名字
     * @return
     */
        public JSONArray selectExamApply(String spellCode) throws Exception {
        String response="";
        String url = entranceUrl+"getExamApply?spellCode="+spellCode;
        response = httpClientUtil.get(url,"GBK");
        JSONObject object = JSONObject.parseObject(response);
        JSONArray jsonArray = new JSONArray();
        if(object.getInteger("status")==200){
            String obj = object.getString("obj");
            JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
            for (int i=0;i<array.size();i++){
                JSONObject jsonObject = array.getJSONObject(i);
                JSONObject object1 = new JSONObject();
                object1.put("@action","select");
                object1.put("name",jsonObject.getString("ITEM_NAME"));
                object1.put("code",jsonObject.getString("ITEM_CODE"));
                object1.put("type",jsonObject.getString("ITEM_CLASS"));
                object1.put("py_code",jsonObject.getString("SPELL_CODE"));
                object1.put("charge_amount",jsonObject.getString("FACT_PRICE"));
                object1.put("child_amount",jsonObject.getString("CHILD_PRICE"));
                object1.put("charge_unit",jsonObject.getString("UNIT"));
                object1.put("wb_code",jsonObject.getString("FIVE_PEN_CODE"));
                object1.put("memo",jsonObject.getString("MEMO"));
                jsonArray.add(object1);
            }
        }
        return jsonArray;
    }
    /**
     * 查询检验项目
     * @param spellCode 拼音码或药品名字
     * @return
     */
    public JSONArray selectLisApply(String spellCode) throws Exception {
        String response="";
        String url = entranceUrl+"getLisApply?spellCode="+spellCode;
        response = httpClientUtil.get(url,"GBK");
        JSONObject object = JSONObject.parseObject(response);
        JSONArray jsonArray = new JSONArray();
        if(object.getInteger("status")==200){
            String obj = object.getString("obj");
            JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
            for (int i=0;i<array.size();i++){
                JSONObject jsonObject = array.getJSONObject(i);
                JSONObject object1 = new JSONObject();
                object1.put("@action","select");
                object1.put("name",jsonObject.getString("ITEM_NAME"));
                object1.put("code",jsonObject.getString("ITEM_CODE"));
                object1.put("type",jsonObject.getString("ITEM_CLASS"));
                object1.put("py_code",jsonObject.getString("SPELL_CODE"));
                object1.put("charge_amount",jsonObject.getString("FACT_PRICE"));
                object1.put("child_amount",jsonObject.getString("CHILD_PRICE"));
                object1.put("charge_unit",jsonObject.getString("UNIT"));
                object1.put("wb_code",jsonObject.getString("FIVE_PEN_CODE"));
                object1.put("memo",jsonObject.getString("MEMO"));
                jsonArray.add(object1);
            }
        }
        return jsonArray;
    }
/**
 * 检查检验项目同步his
 * @param msgBody 拼音码或药品名字
 * @return
 */
public Map checkSyncHis(String msgBody) throws Exception {
    String response="";
    Map resultMap=new HashMap();
    String url = entranceUrl+"saveInspectToHospital?msgBody="+msgBody;
    response = httpClientUtil.get(url,"GBK");
    JSONObject object = JSONObject.parseObject(response);
    if(object.getInteger("status")==200){
        String obj = object.getString("obj");
        JSONObject rootObject = JSONObject.parseObject(obj);
        if (null!=rootObject&&"0".equalsIgnoreCase(rootObject.getString("code"))){
            resultMap.put("success",rootObject.getString("success"));
            resultMap.put("code",rootObject.getString("code"));
            resultMap.put("msg",rootObject.getString("msg"));
            JSONObject dataObj = JSONObject.parseObject(rootObject.getString("data"));
            if (null!=dataObj){
                JSONObject presDetailobj = JSONObject.parseObject(dataObj.getString("PresDetail"));
                resultMap.put("msg",presDetailobj.getString("PresNo"));
                logger.info("his医嘱号:"+presDetailobj.getString("PresNo"));
            }
        }else if(null!=rootObject&&!"0".equalsIgnoreCase(rootObject.getString("code"))){
            resultMap.put("success",rootObject.getString("success"));
            resultMap.put("code",rootObject.getString("code"));
            resultMap.put("msg",rootObject.getString("msg"));
        }else {
            resultMap.put("success","obj转化失败");
        }
    }else {
        resultMap.put("success","调用entrance接口返回失败");
    }
    return resultMap;
}
//=====================hospital应用调用entrance应用============end=================

+ 4 - 1
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -398,7 +398,10 @@ public class BaseHospitalRequestMapping {
        public static final String findByPrescriptionCodeByStatus = "/findByPrescriptionCodeByStatus";
        public static final String findByPartsCode = "/findByPartsCode";
        public static final String xzzxFindByPartsCode = "/xzzxFindByPartsCode";
        //检查项目查询
        public static final String xzzxSelectExamApply = "/xzzxSelectExamApply";
        public static final String xzzxSelectLisApply = "/xzzxSelectLisApply";
        public static final String findDictByName = "/findDictByName";
        public static final String getJcmb="/getJcmb";

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

@ -1,6 +1,8 @@
package com.yihu.jw.entrance.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
@ -353,8 +355,9 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
     */
    @GetMapping(value = "/getCheckBody")
    @ApiOperation(value = "获取检查部位字典", notes = "获取检查部位字典")
    public ObjEnvelop getCheckBody()throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.GetCheckBody());
    public ObjEnvelop getCheckBody(@ApiParam(name = "spellCode", value = "拼音码", required = false)
                                       @RequestParam(value = "spellCode",required = false)String spellCode)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.GetCheckBody(spellCode));
    }
@ -381,4 +384,32 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
                                   @RequestParam(value = "spellCode",required = false)String spellCode)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.GetLisApply(spellCode));
    }
    /**
     * 获取检验单据信息
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/saveInspectToHospital")
    @ApiOperation(value = "互联网医院开检查检验信息更新到his", notes = "互联网医院开检查检验信息更新到his")
    public ObjEnvelop saveInspectToHospital(@ApiParam(name = "PayCardNo", value = "就诊卡号", required = false)
                                  @RequestParam(value = "PayCardNo",required = false)String PayCardNo,
                                            @ApiParam(name = "IoFlag", value = "门诊住院标志", required = false)
                                            @RequestParam(value = "IoFlag",required = false)String IoFlag,
                                            @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 = "wlyyInspectionDOS", value = "检查json", required = false)
                                                @RequestParam(value = "wlyyInspectionDOS",required = false) String wlyyInspectionDOS)throws Exception{
        JSONArray jsonArray = JSONArray.parseArray(wlyyInspectionDOS);
        List<WlyyInspectionDO> wlyyInspectionS = new ArrayList<>();
        for (int i=0;i<jsonArray.size();i++){
            WlyyInspectionDO inspectionDO = toEntity(jsonArray.get(i).toString(),WlyyInspectionDO.class);
            wlyyInspectionS.add(inspectionDO);
        }
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.saveInspectToHospital(IoFlag,PayCardNo,NullahNumber,ApplyDept,ApplyDoctor,wlyyInspectionS));
    }
}

+ 20 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -1058,7 +1058,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                      @RequestParam(value = "prescriptionCode", required = true)String prescriptionCode)throws Exception{
        return success(prescriptionLogService.findByPrescriptionCodeByStatus(prescriptionCode));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.xzzxFindByPartsCode)
    @ApiOperation(value = "心脏查询部位字典", notes = "心脏查询部位字典")
    public ListEnvelop xzzxFindByPartsCode(@ApiParam(name = "spellCode", value = "父节点ID,第一层为0")
                                       @RequestParam(value = "spellCode", required = false)String spellCode)throws Exception{
        return success(xzzxEntranceService.selectCheckBody(spellCode));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByPartsCode)
    @ApiOperation(value = "查询部位字典", notes = "查询部位字典")
    public ListEnvelop findByPartsCode(@ApiParam(name = "parentCode", value = "父节点ID,第一层为0")
@ -2056,4 +2061,18 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        BaseDoctorDO baseDoctorDO=baseDoctorInfoService.popularityIncrease(doctor);
        return  success("操作成功",baseDoctorDO);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.xzzxSelectExamApply)
    @ApiOperation(value = "检查项目查询接口")
    public ListEnvelop selectExamApply(
            @ApiParam(name = "spellCode", value = "拼音首字母")
            @RequestParam(value = "spellCode",defaultValue = "") String spellCode) throws Exception {
        return success(xzzxEntranceService.selectExamApply(spellCode));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.xzzxSelectLisApply)
    @ApiOperation(value = "检验项目查询接口")
    public ListEnvelop selectLisApply(
            @ApiParam(name = "spellCode", value = "拼音首字母")
            @RequestParam(value = "spellCode",defaultValue = "") String spellCode) throws Exception {
        return success(xzzxEntranceService.selectLisApply(spellCode));
    }
}