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

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

wangzhinan преди 4 години
родител
ревизия
739c54870e

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

@ -2311,7 +2311,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if (StringUtils.isNotBlank(inspectionJson)) {
                List<WlyyInspectionDO> inspections = (List<WlyyInspectionDO>) com.alibaba.fastjson.JSONArray.parseArray(inspectionJson, WlyyInspectionDO.class);
                for (WlyyInspectionDO ins : inspections) {
                    YkEmrJcsqDO ykEmrJcsqDO =new YkEmrJcsqDO();
                    ins.setDel(1);
                    ins.setCreateTime(new Date());
                    ins.setPrescriptionId(prescription.getId());
@ -2372,7 +2371,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //上传his开方
                //sendHisDiagnosis(jsonData, outpatientDO, prescription)
                //zsSynHis(prescription.getId());
                //同步检查检验
                List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescription.getId(),1);
                if (inspectionDOS != null && inspectionDOS.size() > 0) {
                    syCheckParam(outpatientDO.getId());
                }
                Map<String, Object> result1 = new HashedMap();
                result1.put("code", 1);
                result1.put("mes", "开方提交成功");
@ -2419,34 +2422,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            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);
            Map resultMap =  xzzxEntranceService.checkSyncHis("0",outpatientDO.getCardNo(),outpatientDO.getRegisterNo(),outpatientDO.getDept(),applyDoctor,wlyyInspectionDOS.toString());
            logger.info("同步his检查检验返回结果:"+resultMap.get("success"));
        }
@ -8599,5 +8577,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public void updateHisStatusByOutpatientId(String outpatientId){
        outpatientDao.updateHisStatusById(outpatientId,1);
    }
    //调用天际合理用药审方接口
    public String checkPrescriptionTJ(String prescriptionId){
        String doctor="";
        String patient="";
        List<WlyyPrescriptionInfoDO> infos = new ArrayList<>();
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = new ArrayList<>();
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
        if (null!=wlyyPrescriptionDO){
            doctor = wlyyPrescriptionDO.getDoctor();
            patient = wlyyPrescriptionDO.getPatientCode();
            infos = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
            diagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId,1);
        }
        String res = "";
        try {
            res= xzzxEntranceService.checkInputInfo(doctor,patient,infos,diagnosisDOS);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  res;
    }
}

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

@ -18,6 +18,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
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.prescription.*;
@ -29,7 +30,11 @@ import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.util.AES;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
import com.yihu.jw.restmodel.hospital.doctor.CheckInfoVO;
import com.yihu.jw.restmodel.hospital.doctor.PersonInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
@ -39,8 +44,10 @@ import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.utils.security.MD5;
import net.sf.json.xml.XMLSerializer;
import nu.xom.*;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.DocumentHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -48,6 +55,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.io.IOException;
import java.io.StringReader;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -101,6 +111,10 @@ public class XzzxEntranceService{
    private WlyyInspectionDao wlyyInspectionDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BasePatientDao basePatientDao;
@ -113,7 +127,10 @@ public class XzzxEntranceService{
    public static String entranceUrlLocal = "http://localhost:10023/xzzx/";
    public static String hospitalUrl = "http://192.168.118.240:10022/";//172.16.100.63
    //合理用药接口地址
    public static String checkInfosUrl="http://192.168.102.243:8040/service/api/check.do?tag=1";
    //保存天际处方接口地址
    public static String saveTianJiPrescription = "http://192.168.102.243:8040/service/api/checkFromXmlToJson.do?tag=2";
    public String getSelectUrl(){
@ -1282,7 +1299,6 @@ public class XzzxEntranceService{
        String condition ="";
        condition = "<IoFlag>"+IoFlag+"</IoFlag>";
        StringBuffer inspectionList = new StringBuffer();
        String applyDoctor = "";
        condition += "<PayCardNo>"+PayCardNo+"</PayCardNo>";
        condition += "<NullahNumber>"+NullahNumber+"</NullahNumber>";
        condition += "<ApplyDept>"+ApplyDept+"</ApplyDept>";
@ -1300,11 +1316,11 @@ public class XzzxEntranceService{
            inspectionList.append("<SensitiveName>"+"过敏史"+"</SensitiveName>");
            inspectionList.append("<SampleCode>"+"标本类型"+"</SampleCode>");
            inspectionList.append("<ChiefComplaint>"+"主诉"+"</ChiefComplaint>");
            inspectionList.append("<MedicalHistory>"+"病史"+"</MedicalHistory>");
            inspectionList.append("<MedicalHistory>"+wlyyInspectionDO.getInformation()+"</MedicalHistory>");
            inspectionList.append("<InspectionPurpose>"+wlyyInspectionDO.getGoal()+"</InspectionPurpose>");
            inspectionList.append("<PastHistory>"+"既往史"+"</PastHistory>");
            inspectionList.append("<LisCheckResult>"+"历史检验相关结果(化验单)"+"</LisCheckResult>");
            inspectionList.append("<InspectionResult>"+"相关辅助检查"+"</InspectionResult>");
            inspectionList.append("<LisCheckResult>"+wlyyInspectionDO.getYwjcResult()+"</LisCheckResult>");
            inspectionList.append("<InspectionResult>"+wlyyInspectionDO.getAdresult()+"</InspectionResult>");
            inspectionList.append("<InspectionNotice>"+"注意事项"+"</InspectionNotice>");
            inspectionList.append("<Memo>"+wlyyInspectionDO.getCode()+"</Memo>");
            inspectionList.append("</PresInfo>");
@ -1323,7 +1339,134 @@ public class XzzxEntranceService{
        return json;
    }
    /*
     *合理用药审核接口入参
     */
    public String checkPrescriptionInfoParam(JSONObject patientAndDoctor,List<WlyyPrescriptionInfoDO> infos){
        String checkDoctor="<Doctor POSITION=\""+patientAndDoctor.getString("POSITION")+
                "\" NAME=\""+patientAndDoctor.getString("DOCTOR_NAME")+
                "\" DEPT_CODE=\""+patientAndDoctor.getString("DEPT_CODE")+
                "\" DEPT_NAME=\""+patientAndDoctor.getString("DEPT_NAME")+"\" USER_ID=\""+patientAndDoctor.getString("doctorId")+"\" />";
        String checkPatient="<Patient NAME=\""+patientAndDoctor.getString("patientName")+
                "\" ID=\""+patientAndDoctor.getString("patientId")+
                "\" VISIT_ID=\"0\" PATIENT_PRES_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+
                "\" BIRTH=\""+patientAndDoctor.getString("birth")+
                "\" HEIGHT=\"0\" WEIGHT=\"0\" GENDER=\""+patientAndDoctor.getString("gender")+
                "\" PREGNANT=\"\" LACT=\"否\" HEPATICAL=\"是\" RENAL=\"是\" PANCREAS=\"否\" ALERGY_DRUGS=\"青霉素类\" IDENTITY_TYPE=\"\" FEE_TYPE=\""+patientAndDoctor.getString("FEE_TYPE")+
                "\" SCR=\"\" SCR_UNIT=\"umol/L\" GESTATION_AGE=\"\" PRETERM_BIRTH=\"\" DRUG_HISTORY=\"\" FAMILY_DISEASE_HISTORY=\"\" GENETIC_DISEASE=\"\" MEDICARE_01=\"\" MEDICARE_02=\"\" MEDICARE_03=\"\" MEDICARE_04=\"\" MEDICARE_05=\"\" />";
        String checkDiagnosises = "<Diagnosises DIAGNOSISES=\""+patientAndDoctor.getString("diagnosises")+"\" >\n" +
                "</Diagnosises>\n";
        StringBuffer stringBuffer = new StringBuffer();
        for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:infos){
            stringBuffer.append("<Advice REPEAT=\"1\" DRUG_LO_NAME=\""+wlyyPrescriptionInfoDO.getDrugName()+
                    "\" DRUG_LO_ID=\""+wlyyPrescriptionInfoDO.getHisCode()+
                    "\" ADMINISTRATION=\""+wlyyPrescriptionInfoDO.getYpyf()+
                    "\" DOSAGE=\""+wlyyPrescriptionInfoDO.getQuantity()+
                    "\" DOSAGE_UNIT=\""+wlyyPrescriptionInfoDO.getUnit()+
                    "\" FREQ_COUNT=\""+wlyyPrescriptionInfoDO.getUsageCode()+
                    "\" FREQ_INTERVAL=\"1\" FREQ_INTERVAL_UNIT=\""+wlyyPrescriptionInfoDO.getUsageName()+
                    "\" START_DAY=\""+patientAndDoctor.getString("createDate")+"\" END_DAY=\"\" DEPT_CODE=\""+patientAndDoctor.getString("DEPT_CODE")+
                    "\" DOCTOR_NAME=\""+patientAndDoctor.getString("DOCTOR_NAME")+
                    "\" ORDER_NO=\""+wlyyPrescriptionInfoDO.getFrequency()+
                    "\" ORDER_SUB_NO=\""+wlyyPrescriptionInfoDO.getFrequency()+"\" AUTHORITY_LEVELS=\"\" ALERT_LEVELS=\"\" TITLE=\""+patientAndDoctor.getString("POSITION") +
                    "\" GROUP_ID=\""+wlyyPrescriptionInfoDO.getFrequency()+"\" USER_ID=\""+patientAndDoctor.getString("doctorId")+
                    "\" PRES_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+
                    "\" PRES_DATE=\""+patientAndDoctor.getString("createDate")+
                    "\" PRES_SEQ_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+
                    "\" PK_ORDER_NO=\"\" COURSE=\""+wlyyPrescriptionInfoDO.getDays()+
                    "\" PKG_COUNT=\""+wlyyPrescriptionInfoDO.getPackQuantity()+
                    "\" PKG_UNIT=\""+wlyyPrescriptionInfoDO.getPackUnitName()+"\" BAK_01=\"\" BAK_02=\"\" BAK_03=\""+wlyyPrescriptionInfoDO.getUnitName()+
                    "\" BAK_04=\""+wlyyPrescriptionInfoDO.getSpecification()+
                    "\" BAK_05=\""+wlyyPrescriptionInfoDO.getDrugPlace()+"\"  />");
        }
        String checkInfos = "<Advices>"+stringBuffer.toString()+"</Advices>";
        String postBody = "<CheckInput TAG=\"2\" INPATIENT=\"否\">"+checkDoctor+checkPatient+checkDiagnosises+checkInfos+"</CheckInput>";
        return postBody;
    }
    /*
     *合理用药审核接口
     */
    public String checkPrescription(JSONObject patientAndDoctor,List<WlyyPrescriptionInfoDO> infos) throws Exception{
        String postBody = checkPrescriptionInfoParam(patientAndDoctor,infos);
        logger.info("发送的报文参数:"+postBody);
        String res =  httpClientUtil.sendPost(checkInfosUrl,postBody);
        logger.info("返回的报文参数:"+res);
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        wlyyHttpLogDO.setDoctor(patientAndDoctor.getString("doctorId"));
        wlyyHttpLogDO.setCreateTime(new Date());
        wlyyHttpLogDO.setRequest(postBody);
        wlyyHttpLogDO.setResponse(res);
        wlyyHttpLogDO.setName("checkPrescriptionInEntrance");
        return  res;
    }
    public List<Map<String,Object>> transXmlCommen(String xml){
        Document doc = null;
        List<Map<String,Object>> returnMap= new ArrayList<>();
        try {
            doc = (new Builder()).build(new StringReader(xml));
            Element root = doc.getRootElement();
            Elements elements = root.getChildElements();
            for (int i=0;i<elements.size();i++){
               Map<String,Object> personInfoMap = new HashMap<>();
                Element personInfo = elements.get(i);
                for (int j=0;j<personInfo.getAttributeCount();j++){
                    Attribute attribute = personInfo.getAttribute(j);
                    personInfoMap.put(attribute.getLocalName(),attribute.getValue());
                }
                List<Map<String,Object>> checkInfoMapList= new ArrayList<>();
                if (personInfo.getChildElements().size()>0){
                    Elements checkInfos = personInfo.getChildElements();
                    for(int ci=0;ci<checkInfos.size();ci++){
                        Element checkInfo = checkInfos.get(ci);
                        Map<String,Object> checkInfoMap = new HashMap<>();
                        for (int n = 0;n<checkInfo.getAttributeCount();n++){
                            Attribute attribute2 = checkInfo.getAttribute(n);
                            checkInfoMap.put(attribute2.getLocalName(),attribute2.getValue());
                        }
                        checkInfoMapList.add(checkInfoMap);
                    }
                }
                personInfoMap.put("checkInfoMapList",checkInfoMapList);
                returnMap.add(personInfoMap);
            }
        } catch (ParsingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
      return returnMap;
    }
    public  List<PersonInfoVO>  transXml(String xml) throws  Exception {
        Document doc = (new Builder()).build(new StringReader(xml));
        Element root = doc.getRootElement();
        Elements presInfos = root.getChildElements("PresInfo");
        List<PersonInfoVO> personInfoVOS = new ArrayList<>();
        for (int i=0;i<presInfos.size();i++){
            PersonInfoVO personInfoVO = new PersonInfoVO();
            List<CheckInfoVO> checkInfoVOS = new ArrayList<>();
            Element presInfo  = presInfos.get(i);
            personInfoVO.setDrugLoId(presInfo.getAttributeValue("DRUG_LO_ID"));
            personInfoVO.setDrugLoName(presInfo.getAttributeValue("DRUG_LO_NAME"));
            personInfoVO.setOrderId(presInfo.getAttributeValue("ORDER_ID"));
            personInfoVO.setOrderSubId(presInfo.getAttributeValue("ORDER_SUB_ID"));
            Elements checkinfos  = presInfo.getChildElements();
            if (checkinfos.size()>0){
                for (int j=0;j<checkinfos.size();j++){
                    CheckInfoVO checkInfoVO = new CheckInfoVO();
                    Element checkinfo = checkinfos.get(j);
                    checkInfoVO.setColor(checkinfo.getAttributeValue("COLOR"));
                    checkInfoVO.setName(checkinfo.getAttributeValue("NAME"));
                    checkInfoVO.setRefResource(checkinfo.getAttributeValue("REF_SOURCE"));
                    checkInfoVO.setWarningInfo(checkinfo.getAttributeValue("WARNING_INFO"));
                    checkInfoVO.setWarningLevel(checkinfo.getAttributeValue("WARNING_LEVEL"));
                    checkInfoVOS.add(checkInfoVO);
                }
                personInfoVO.setCheckInfoVOS(checkInfoVOS);
            }
            personInfoVOS.add(personInfoVO);
        }
        return personInfoVOS;
    }
//=====================微信模板消息推送===================================
@ -2400,7 +2543,7 @@ public class XzzxEntranceService{
     * @param spellCode 拼音码或药品名字
     * @return
     */
        public JSONArray selectExamApply(String spellCode) throws Exception {
    public JSONArray selectExamApply(String spellCode) throws Exception {
        String response="";
        String url = entranceUrl+"getExamApply?spellCode="+spellCode;
        response = httpClientUtil.get(url,"GBK");
@ -2461,13 +2604,15 @@ public class XzzxEntranceService{
    }
/**
 * 检查检验项目同步his
 * @param msgBody 拼音码或药品名字
 * @param
 * @return
 */
public Map checkSyncHis(String msgBody) throws Exception {
public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,String ApplyDept,String ApplyDoctor,String wlyyInspectionS) throws Exception {
    String response="";
    Map resultMap=new HashMap();
    String url = entranceUrl+"saveInspectToHospital?msgBody="+msgBody;
    String url = entranceUrl+"saveInspectToHospital?IoFlag="+IoFlag+"&PayCardNo="+PayCardNo+"&NullahNumber="+NullahNumber+
            "&ApplyDept="+ApplyDept+
            "&ApplyDoctor="+ApplyDoctor+"&wlyyInspectionS="+wlyyInspectionS;
    response = httpClientUtil.get(url,"GBK");
    JSONObject object = JSONObject.parseObject(response);
    if(object.getInteger("status")==200){
@ -2729,7 +2874,89 @@ public Map checkSyncHis(String msgBody) throws Exception {
        return map;
    }
    //组装审药参数
    public String checkInputInfo(String doctorId,String patientId,List<WlyyPrescriptionInfoDO> infos,List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS ) throws Exception{
        JSONObject jsonObject = new JSONObject();
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctorId);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
        jsonObject.put("DOCTOR_NAME", baseDoctorDO.getName());
        jsonObject.put("DEPT_CODE", baseDoctorDO.getVisitDept());
        jsonObject.put("DEPT_NAME", baseDoctorDO.getVisitDeptName());
        if (null != doctorMappingDO && null != baseDoctorDO) {
            jsonObject.put("doctorId", doctorMappingDO.getMappingCode());
            jsonObject.put("POSITION", baseDoctorDO.getJobTitleName());
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patientId);
        BasePatientDO basePatientDO = patientDao.findById(patientId);
        jsonObject.put("patientName", basePatientDO.getName());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        if (null != patientMappingDO && null != basePatientDO) {
            jsonObject.put("patientId", patientMappingDO.getMappingCode());
            jsonObject.put("gender", basePatientDO.getSex()==1?"男":"女");
            jsonObject.put("birth", sdf.format(basePatientDO.getBirthday()));
        }
        if (null!=infos&&infos.size()>0) {
            WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO = infos.get(0);
            WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(wlyyPrescriptionInfoDO.getPrescriptionId());
            if (null != prescriptionDO) {
                jsonObject.put("PATIENT_PRES_ID", prescriptionDO.getId());
                jsonObject.put("FEE_TYPE", prescriptionDO.getPayType() == 1 ? "医保" : "自费");
                jsonObject.put("createDate", sdf.format(prescriptionDO.getCreateTime()));
            }
            //组装诊断参数
            if (null != wlyyPrescriptionDiagnosisDOS && wlyyPrescriptionDiagnosisDOS.size() > 0) {
                List diagnosises = new ArrayList();
                for (WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO : wlyyPrescriptionDiagnosisDOS) {
                    diagnosises.add(wlyyPrescriptionDiagnosisDO.getName());
                }
                jsonObject.put("diagnosises", diagnosises.toArray());
            }
            String response = "";
            String returnJson = "";
            String url = entranceUrl + "checkPrescription?infos=" + infos + "&patientAndDoctor=" + jsonObject.toString();
            response = httpClientUtil.get(url, "GBK");
            logger.info("请求checkPrescription:" + response);
            JSONObject object = JSONObject.parseObject(response);
            WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
            if (object.getInteger("status") == 200) {
                wlyyHttpLogDO.setCode("200");
                String obj = object.getString("obj");
                System.out.println("obj:"+obj);
                if (StringUtils.isNotBlank(obj)) {
                    List<Map<String,Object>> returnList = transXmlCommen(obj);
                    returnJson = JSONArray.toJSONString(returnList);
                    logger.info("返回到互联网医院的解析后的结果:"+returnJson);
                    wlyyHttpLogDO.setDoctor(doctorId);
                    wlyyHttpLogDO.setCreateTime(new Date());
                    wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                    wlyyHttpLogDO.setResponse(returnJson);
                    wlyyHttpLogDO.setName("checkPrescription");
                } else {
                    returnJson = "审方返回接口为空请检查参数是否正确";
                    logger.info(returnJson);
                    wlyyHttpLogDO.setCode("error");
                    wlyyHttpLogDO.setDoctor(doctorId);
                    wlyyHttpLogDO.setCreateTime(new Date());
                    wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                    wlyyHttpLogDO.setResponse(returnJson);
                    wlyyHttpLogDO.setName("checkPrescription");
                }
            } else {
                returnJson = "entranceUrl接口调用失败";
                wlyyHttpLogDO.setCode("error");
                wlyyHttpLogDO.setDoctor(doctorId);
                wlyyHttpLogDO.setCreateTime(new Date());
                wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                wlyyHttpLogDO.setResponse(returnJson);
                wlyyHttpLogDO.setName("checkPrescription");
            }
            wlyyHttpLogDao.save(wlyyHttpLogDO);
            return returnJson;
        }else {
            return "药品信息为空";
        }
    }

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

@ -402,6 +402,8 @@ public class BaseHospitalRequestMapping {
        //检查项目查询
        public static final String xzzxSelectExamApply = "/xzzxSelectExamApply";
        public static final String xzzxSelectLisApply = "/xzzxSelectLisApply";
        //合理用药审核接口
        public static final String xzzxCheckInfo = "/xzzxCheckInfo";
        public static final String findDictByName = "/findDictByName";
        public static final String getJcmb="/getJcmb";

+ 61 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/doctor/CheckInfoVO.java

@ -0,0 +1,61 @@
package com.yihu.jw.restmodel.hospital.doctor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "CheckInfoVO", description = "审药返回药品结果实体")
public class CheckInfoVO {
    @ApiModelProperty(value = "颜色", example = "模块1")
    private String color;
    @ApiModelProperty(value = "警示名称,如:用法用量", example = "模块1")
    private String name;
    @ApiModelProperty(value = "警示级别:\n" +
            "慎用\n" +
            "禁忌/禁用\n" +
            "强制阻断\n", example = "模块1")
    private String warningLevel;
    @ApiModelProperty(value = "警示信息", example = "模块1")
    private String warningInfo;
    @ApiModelProperty(value = "文献出处", example = "模块1")
    private String refResource;
    public String getColor() {
        return color;
    }
    public void setColor(String color) {
        this.color = color;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getWarningLevel() {
        return warningLevel;
    }
    public void setWarningLevel(String warningLevel) {
        this.warningLevel = warningLevel;
    }
    public String getWarningInfo() {
        return warningInfo;
    }
    public void setWarningInfo(String warningInfo) {
        this.warningInfo = warningInfo;
    }
    public String getRefResource() {
        return refResource;
    }
    public void setRefResource(String refResource) {
        this.refResource = refResource;
    }
}

+ 60 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/doctor/PersonInfoVO.java

@ -0,0 +1,60 @@
package com.yihu.jw.restmodel.hospital.doctor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "PersonInfoVO", description = "审药返回接口实体")
public class PersonInfoVO {
    @ApiModelProperty(value = "同处方中每条记录的标识号", example = "模块1")
    private String orderId;
    @ApiModelProperty(value = "同处方中每条记录的子标识号", example = "模块1")
    private String orderSubId;
    @ApiModelProperty(value = "医院药品ID", example = "模块1")
    private String drugLoId;
    @ApiModelProperty(value = "医院药品名称", example = "模块1")
    private String drugLoName;
    @ApiModelProperty(value = "药品信息", example = "模块1")
    private List<CheckInfoVO> checkInfoVOS;
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public String getOrderSubId() {
        return orderSubId;
    }
    public void setOrderSubId(String orderSubId) {
        this.orderSubId = orderSubId;
    }
    public String getDrugLoId() {
        return drugLoId;
    }
    public void setDrugLoId(String drugLoId) {
        this.drugLoId = drugLoId;
    }
    public String getDrugLoName() {
        return drugLoName;
    }
    public void setDrugLoName(String drugLoName) {
        this.drugLoName = drugLoName;
    }
    public List<CheckInfoVO> getCheckInfoVOS() {
        return checkInfoVOS;
    }
    public void setCheckInfoVOS(List<CheckInfoVO> checkInfoVOS) {
        this.checkInfoVOS = checkInfoVOS;
    }
}

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

@ -450,4 +450,24 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
        }
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.saveInspectToHospital(IoFlag,PayCardNo,NullahNumber,ApplyDept,ApplyDoctor,wlyyInspectionS));
    }
    /**
     * 获取检验单据信息
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/checkPrescription")
    @ApiOperation(value = "合理用药审核接口", notes = "合理用药审核接口")
    public ObjEnvelop checkPrescription(@ApiParam(name = "infos", value = "药品信息", required = false)
                                            @RequestParam(value = "infos",required = false)String infos,
                                            @ApiParam(name = "patientAndDoctor", value = "医患信息", required = false)
                                            @RequestParam(value = "patientAndDoctor",required = false) String patientAndDoctor)throws Exception{
        JSONArray jsonArray = JSONArray.parseArray(infos);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = new ArrayList<>();
        for (int i=0;i<jsonArray.size();i++){
            WlyyPrescriptionInfoDO wlyyPrescriptionInfo = toEntity(jsonArray.get(i).toString(),WlyyPrescriptionInfoDO.class);
            wlyyPrescriptionInfoDOS.add(wlyyPrescriptionInfo);
        }
        JSONObject jsonObject = JSONObject.parseObject(patientAndDoctor);
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.checkPrescription(jsonObject,wlyyPrescriptionInfoDOS));
    }
}

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

@ -1038,11 +1038,21 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取检查检验", notes = "获取检查检验")
    public ListEnvelop getInspectionDictionary(@ApiParam(name = "pyKey", value = "拼音码")
                                               @RequestParam(value = "pyKey", required = false)String pyKey,
                                               @ApiParam(name = "winNo", value = "6总部7金榜8夏禾")
                                               @ApiParam(name = "winNo", value = "6总部7金榜8夏禾10检查11检验")
                                               @RequestParam(value = "winNo", required = true)String winNo,
                                               @ApiParam(name = "codes", value = "检查检验收费码codes,用逗号分割")
                                               @RequestParam(value = "codes", required = false)String codes)throws Exception{
        return success(prescriptionService.getInspectionDictionary(pyKey,codes,winNo));
        if("xm_xzzx_wx".equalsIgnoreCase(wxId)){
            if ("10".equalsIgnoreCase(winNo)){
                //检查
                return success(xzzxEntranceService.selectExamApply(pyKey));
            }else {
                //检验
                return success(xzzxEntranceService.selectLisApply(pyKey));
            }
        }else {
            return success(prescriptionService.getInspectionDictionary(pyKey,codes,winNo));
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionLogByPreId)
@ -1060,15 +1070,17 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.xzzxFindByPartsCode)
    @ApiOperation(value = "心脏查询部位字典", notes = "心脏查询部位字典")
    public ListEnvelop xzzxFindByPartsCode(@ApiParam(name = "spellCode", value = "父节点ID,第一层为0")
    public ListEnvelop xzzxFindByPartsCode(@ApiParam(name = "spellCode", value = "拼音首字母")
                                       @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")
                                       @RequestParam(value = "parentCode", required = true)String parentCode)throws Exception{
                                       @RequestParam(value = "parentCode", required = false)String parentCode)throws Exception{
        return success(inspectionService.findByPartsCode(parentCode));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDictByName)
@ -2075,4 +2087,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "spellCode",defaultValue = "") String spellCode) throws Exception {
        return success(xzzxEntranceService.selectLisApply(spellCode));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.xzzxCheckInfo)
    @ApiOperation(value = "合理用药审核接口")
    public Envelop xzzxCheckInfo(
            @ApiParam(name = "prescriptionId", value = "处方id")
            @RequestParam(value = "prescriptionId",defaultValue = "") String prescriptionId) throws Exception {
        return success(prescriptionService.checkPrescriptionTJ(prescriptionId));
    }
}