Quellcode durchsuchen

合理用药审核接口

wangjun vor 4 Jahren
Ursprung
Commit
a61c6e172c

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

@ -2873,22 +2873,13 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
        }
        return map;
    }
    //组装审药参数并发送到entrance
    public String checkInputInfo(String prescriptionId) throws Exception{
    public String checkInputInfo(String payType,String doctor,String patient,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,List<WlyyPrescriptionInfoDO> infos) throws Exception{
        JSONObject jsonObject = new JSONObject();
        //药品信息
        List<WlyyPrescriptionInfoDO> infos = new ArrayList<>();
        //诊断信息
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = new ArrayList<>();
        String tjPrescriptionId = UUID.randomUUID().toString();
        //先查询处方获得支付方式
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
        if (null!=prescriptionDO){
            infos = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
            diagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId,1);
        }
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(prescriptionDO.getDoctor());
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
        jsonObject.put("DOCTOR_NAME", baseDoctorDO.getName());
        jsonObject.put("DEPT_CODE", baseDoctorDO.getVisitDept());
        jsonObject.put("DEPT_NAME", baseDoctorDO.getVisitDeptName());
@ -2896,8 +2887,8 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
            jsonObject.put("doctorId", doctorMappingDO.getMappingCode());
            jsonObject.put("POSITION", baseDoctorDO.getJobTitleName());
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(prescriptionDO.getPatientCode());
        BasePatientDO basePatientDO = patientDao.findById(prescriptionDO.getPatientCode());
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        BasePatientDO basePatientDO = patientDao.findById(patient);
        jsonObject.put("patientName", basePatientDO.getName());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        if (null != patientMappingDO && null != basePatientDO) {
@ -2906,23 +2897,25 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
            jsonObject.put("birth", sdf.format(basePatientDO.getBirthday()));
        }
        if (null!=infos&&infos.size()>0) {
            if (null != prescriptionDO) {
                jsonObject.put("PATIENT_PRES_ID", prescriptionDO.getId());
                jsonObject.put("FEE_TYPE", prescriptionDO.getPayType() == 1 ? "医保" : "自费");
                jsonObject.put("createDate", sdf.format(prescriptionDO.getCreateTime()));
            }
            jsonObject.put("PATIENT_PRES_ID", tjPrescriptionId);
            jsonObject.put("FEE_TYPE", "1".equalsIgnoreCase(payType) ? "医保" : "自费");
            jsonObject.put("createDate", sdf.format(new Date()));
            //组装诊断参数
            if (null != diagnosisDOS && diagnosisDOS.size() > 0) {
                List diagnosises = new ArrayList();
                for (WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO : diagnosisDOS) {
                    diagnosises.add(wlyyPrescriptionDiagnosisDO.getName());
                }
                jsonObject.put("diagnosises", diagnosises.toArray());
                jsonObject.put("diagnosises", StringUtils.strip(diagnosises.toString(),"[]"));
            }
            String response = "";
            String returnJson = "";
            String url = entranceUrl + "checkPrescription?infos=" + infos + "&patientAndDoctor=" + jsonObject.toString();
            response = httpClientUtil.get(url, "GBK");
            JSONArray array = new JSONArray();
            for (WlyyPrescriptionInfoDO infoDO:infos){
                array.add(infoDO);
            }
            String url = entranceUrl + "checkPrescription?infos=" + array.toJSONString() + "&patientAndDoctor=" + jsonObject.toString();
            response = httpClientUtil.sendPost(url, "GBK");
            logger.info("请求checkPrescription:" + response);
            JSONObject object = JSONObject.parseObject(response);
            WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
@ -2934,7 +2927,7 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
                    List<Map<String,Object>> returnList = transXmlCommen(obj);
                    returnJson = JSONArray.toJSONString(returnList);
                    logger.info("返回到互联网医院的解析后的结果:"+returnJson);
                    wlyyHttpLogDO.setDoctor(prescriptionDO.getDoctor());
                    wlyyHttpLogDO.setDoctor(doctor);
                    wlyyHttpLogDO.setCreateTime(new Date());
                    wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                    wlyyHttpLogDO.setResponse(returnJson);
@ -2943,7 +2936,7 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
                    returnJson = "审方返回接口为空请检查参数是否正确";
                    logger.info(returnJson);
                    wlyyHttpLogDO.setCode("error");
                    wlyyHttpLogDO.setDoctor(prescriptionDO.getDoctor());
                    wlyyHttpLogDO.setDoctor(doctor);
                    wlyyHttpLogDO.setCreateTime(new Date());
                    wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                    wlyyHttpLogDO.setResponse(returnJson);
@ -2952,7 +2945,7 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
            } else {
                returnJson = "entranceUrl接口调用失败";
                wlyyHttpLogDO.setCode("error");
                wlyyHttpLogDO.setDoctor(prescriptionDO.getDoctor());
                wlyyHttpLogDO.setDoctor(doctor);
                wlyyHttpLogDO.setCreateTime(new Date());
                wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                wlyyHttpLogDO.setResponse(returnJson);

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

@ -1,5 +1,6 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.area.service.BaseCityService;
import com.yihu.jw.area.service.BaseCommitteeService;
@ -2091,8 +2092,28 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @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(xzzxEntranceService.checkInputInfo(prescriptionId));
            @ApiParam(name = "payType", value = "付款方式0自费;1医保")
            @RequestParam(value = "payType",defaultValue = "") String payType,
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor",defaultValue = "") String doctor,
            @ApiParam(name = "patient", value = "病人id")
            @RequestParam(value = "patient",defaultValue = "") String patient,
            @ApiParam(name = "diagnosisDOS", value = "诊断json")
            @RequestParam(value = "diagnosisDOS",defaultValue = "") String diagnosisDOS,
            @ApiParam(name = "infos", value = "药品json")
            @RequestParam(value = "infos",defaultValue = "") String infos) throws Exception {
        JSONArray druginfos = JSONArray.parseArray(infos);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = new ArrayList<>();
        for (int i=0;i<druginfos.size();i++){
            WlyyPrescriptionInfoDO wlyyPrescriptionInfo = toEntity(druginfos.get(i).toString(),WlyyPrescriptionInfoDO.class);
            wlyyPrescriptionInfoDOS.add(wlyyPrescriptionInfo);
        }
        JSONArray diagnosis = JSONArray.parseArray(diagnosisDOS);
        List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = new ArrayList<>();
        for (int i=0;i<diagnosis.size();i++){
            WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO = toEntity(diagnosis.get(i).toString(),WlyyPrescriptionDiagnosisDO.class);
            wlyyPrescriptionDiagnosisDOS.add(wlyyPrescriptionDiagnosisDO);
        }
        return success(xzzxEntranceService.checkInputInfo(payType,doctor,patient,wlyyPrescriptionDiagnosisDOS,wlyyPrescriptionInfoDOS));
    }
}