Преглед изворни кода

添加工具类判断节假日

wangzhinan пре 2 година
родитељ
комит
fb12d88da5

+ 68 - 50
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/HcyyEntranceService.java

@ -2449,9 +2449,10 @@ public class HcyyEntranceService {
    public String initParams(String serviceCode,String hisId,String payType,String patient,String doctor,List<WlyyPrescriptionInfoDO> infos,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception {
    public String initParams(String serviceCode,String payType,String patient,String doctor,List<WlyyPrescriptionInfoDO> infos,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception {
        String xml ="";
        String hisId = UUID.randomUUID().toString();
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if (patientMappingDO == null){
            return "患者信息映射表为空";
@ -2460,20 +2461,30 @@ public class HcyyEntranceService {
        if (doctorMappingDO == null){
            return "医生信息映射表为空";
        }
        WlyyOutpatientDO outpatientDO =outpatientDao.findById(outpatientId);
        if(outpatientDO==null){
            return "就诊记录为空!";
        }
        String eventTime = DateUtil.dateToStrLong(outpatientDO.getCreateTime());
        String recipeTime = DateUtil.dateToStrLong(new Date());
        List<BaseDoctorHospitalDO> baseDoctorHospitalDOList = baseDoctorHospitalDao.findByDoctorCode(doctor);
        BaseDoctorHospitalDO baseDoctorHospitalDO = baseDoctorHospitalDOList.get(0);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
        BasePatientDO patientDO = patientDao.findById(patient);
        String hospital = "";
        String eventNo="";
        String eventTime = "";
        String dept = "";
        String deptName = "";
        if (infos!=null&&infos.size()!=0){
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
            hospital = outpatientDO.getHospital();
            eventNo = outpatientDO.getRegisterNo();
            eventTime = DateUtil.dateToStrLong(outpatientDO.getRegisterDate());
            dept = outpatientDO.getDept();
            deptName = outpatientDO.getDeptName();
        }
        Double recipeFeeTotal = 0.00;
        for (int i = 0; i < infos.size(); i++) {
            Double packRetprice = infos.get(i).getPackRetprice();
            Double feeTotal=Integer.parseInt(infos.get(i).getQuantity()) * packRetprice;
            Double feeTotal=infos.get(i).getPackQuantity() * packRetprice;
            recipeFeeTotal += feeTotal;
        }
        if (patientDO == null){
@ -2501,8 +2512,8 @@ public class HcyyEntranceService {
        //基础标记
        String base =
                "<base>  \n" +
                "    <hospital_code><![CDATA["+outpatientDO.getHospital()+"]]></hospital_code>  \n" +
                "    <event_no><![CDATA["+outpatientDO.getAdmNo()+"]]></event_no>  \n" +
                "    <hospital_code><![CDATA["+hospital+"]]></hospital_code>  \n" +
                "    <event_no><![CDATA["+eventNo+"]]></event_no>  \n" +
                "    <patient_id><![CDATA["+patientMappingDO.getMappingCode()+"]]></patient_id>  \n" +
                "    <source><![CDATA[门诊]]></source>  \n" +
                "</base>  \n";
@ -2515,9 +2526,9 @@ public class HcyyEntranceService {
                "           <id_no><![CDATA["+ patientDO.getIdcard()+"]]></id_no>  \n" +
                "           <birthday><![CDATA["+ patientDO.getBirthday()+"]]></birthday>  \n" +
                "           <event_time><![CDATA["+eventTime+"]]></event_time>  \n" +
                "           <dept_id><![CDATA["+outpatientDO.getDept()+"]]></dept_id>  \n" +
                "           <dept_name><![CDATA["+outpatientDO.getDeptName()+"]]></dept_name>  \n" +
                "           <pay_type><![CDATA["+("1".equalsIgnoreCase(payType) ? "医保" : "自费")+"]]></pay_type>  \n" +
                "           <dept_id><![CDATA["+dept+"]]></dept_id>  \n" +
                "           <dept_name><![CDATA["+deptName+"]]></dept_name>  \n" +
                "           <pay_type><![CDATA[自费]]></pay_type>  \n" +
                "           <pregnancy><![CDATA[]]></pregnancy>  \n" +
                "           <time_of_preg><![CDATA[]]></time_of_preg>  \n" +
                "           <breast_feeding><![CDATA[]]></breast_feeding>  \n" +
@ -2545,7 +2556,7 @@ public class HcyyEntranceService {
                "           <herb_packet_count><![CDATA[]]></herb_packet_count>  \n" +
                "           <recipe_status><![CDATA[0]]></recipe_status>  \n" +
                "           <comments><![CDATA[]]></comments>  \n" +
                "           <urgent_flag><![CDATA[0]]></urgent_flag>  \n" +
                "           <urgent_flag><![CDATA[1]]></urgent_flag>  \n" +
                "       </opt_prescription_info>";
        //处方明细
        String prescriptionItems="";
@ -2562,11 +2573,11 @@ public class HcyyEntranceService {
                    "           <drug_dose><![CDATA["+infos.get(i).getDosage() + infos.get(i).getUnitName()+"]]></drug_dose>  \n" +
                    "           <drug_admin_route_name><![CDATA["+infos.get(i).getSupplyName()+"]]></drug_admin_route_name>  \n" +
                    "           <drug_using_freq><![CDATA["+infos.get(i).getUsageCode()+"]]></drug_using_freq>  \n" +
                    "           <despensing_num><![CDATA["+infos.get(i).getQuantity()+"]]></despensing_num>  \n" +
                    "           <despensing_num><![CDATA["+infos.get(i).getPackQuantity()+"]]></despensing_num>  \n" +
                    "           <pack_unit><![CDATA["+infos.get(i).getPackUnitName()+"]]></pack_unit>  \n" +
                    "           <count_unit><![CDATA["+infos.get(i).getPackQuantity()+"]]></count_unit>  \n" +
                    "           <unit_price><![CDATA["+infos.get(i).getPackRetprice()+"]]></unit_price>  \n" +
                    "           <fee_total><![CDATA["+Integer.parseInt(infos.get(i).getQuantity()) * infos.get(i).getPackRetprice()+"]]></fee_total>  \n" +
                    "           <fee_total><![CDATA["+infos.get(i).getPackQuantity() * infos.get(i).getPackRetprice()+"]]></fee_total>  \n" +
                    "           <duration><![CDATA["+infos.get(i).getUsageName()+"]]></duration>  \n" +
                    "           <preparation><![CDATA["+infos.get(i).getUnitName()+"]]></preparation>  \n" +
                    "           <approve_no><![CDATA["+infos.get(i).getPzwh()+"]]></approve_no>  \n" +
@ -2578,12 +2589,6 @@ public class HcyyEntranceService {
                    "       </opt_prescription_item>  ";
            prescriptionItems += prescriptionItem;
        }
        //医生反馈信息
        String feedback = "<feed_back>  \n" +
                "       <recipe_id><![CDATA["+hisId+"]]></recipe_id>  \n" +
                "       <message><![CDATA["+outpatientDO.getAdvice()+"]]></message>  \n" +
                "       <status><![CDATA[1]]></status>  \n" +
                "   </feed_back>  ";
        //诊断
        String prescriptionDiagnoses="";
        for (int i = 0; i < diagnosisDOS.size(); i++) {
@ -2634,9 +2639,9 @@ public class HcyyEntranceService {
        else if (serviceCode.equals("CANCEL_GROUP_DRUG_V4")){
            xml = "<root>" + base + doctors + cancelPrescription + "</root>";
        }
        else if (serviceCode.equals("SF_V4_DOUBLE_SIGN")){
     /*   else if (serviceCode.equals("SF_V4_DOUBLE_SIGN")){
            xml = "<root>" + base + doctors + feedback + "</root>";
        }
        }*/
        return xml;
    }
@ -2649,28 +2654,41 @@ public class HcyyEntranceService {
     *                    SF_V4_DOUBLE_SIGN 	医生在对药师打回的处方进行双签处理后,医生站将双签信息推送给审方系统:、
     *                    CANCEL_GROUP_DRUG_V4 	删除已保存处方时调用、
     *                    SF_V4_DISCHARGED 	已保存处方进行数据修改
     * @param xml 入参数
     * @param name 服务名字
     * @param name 服务名字c
     * @return
     */
    public String checkPrescription(String serviceCode,String xml,String name){
        String url = getYYCheckUrl()+serviceCode;
        JSONObject object = new JSONObject();
        object.put("xml",xml);
        String response = httpClientUtil.postBody(url,object);
        WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
        httpLogDO.setCode(serviceCode);
        httpLogDO.setName(name);
        httpLogDO.setRequest(xml);
        httpLogDO.setResponse(response);
        httpLogDO.setStatus("1");
        wlyyHttpLogDao.save(httpLogDO);
        return response;
    public String checkPrescription(String serviceCode,String jsonData,String name) throws Exception {
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+serviceCode+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+caKey+"</certificate> " +
                "</root>";
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                jsonData;
        Map<String,String> params = new HashedMap();
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        wlyyHttpLogDO.setRequest(params.toString());
        logger.info(name+" params:"+params.toString());
        String xml = getHcyyCAWebServiceInfo("CallInterface",params,getYYCheckUrl());
        wlyyHttpLogDO.setResponse(xml);
        wlyyHttpLogDO.setCreateTime(new Date());
        wlyyHttpLogDO.setCode(serviceCode);
        wlyyHttpLogDO.setName(name);
        wlyyHttpLogDao.save(wlyyHttpLogDO);
        logger.info(name+" json:"+xml);
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        return json;
    }
    //处方保存前,进行合理用药审查
    public String checkPrescriptions(String outpatient, String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
    public String checkPrescriptions(String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception {
        if (null == infos || infos.size() == 0) {
            return "药品信息为空";
@ -2679,14 +2697,14 @@ public class HcyyEntranceService {
            return "诊断信息为空";
        }
            String xml = "";
            xml = initParams("GY_V4_FLEXIBLE", hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
            String response = checkPrescription("GY_V4_FLEXIBLE", xml, "合理用药审查");
            xml = initParams("GY_SF_V4",payType, patient, doctor, infos, diagnosisDOS,outpatientId);
            String response = checkPrescription("GY_SF_V4", xml, "合理用药审查");
        return response;
    }
    //处方在医生站系统成功保存后调用
    public String saveCheck(String outpatient, String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
    public String saveCheck(String outpatient, String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
        if (infos == null || infos.size() == 0) {
            return "药品信息为空";
        }
@ -2695,7 +2713,7 @@ public class HcyyEntranceService {
        }
            String xml = null;
            try {
                xml = initParams("GY_SF_V4",hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
                xml = initParams("GY_SF_V4", payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }
@ -2704,7 +2722,7 @@ public class HcyyEntranceService {
    }
    //处方保存成功后,发送给审方系统进行人工审方
    public String validCheck(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
    public String validCheck(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
        if (infos == null || infos.size() == 0) {
            return "药品信息为空";
        }
@ -2713,7 +2731,7 @@ public class HcyyEntranceService {
        }
            String xml = null;
            try {
                xml = initParams("SF_V4_VALID_FLAG", hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
                xml = initParams("SF_V4_VALID_FLAG",payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }
@ -2722,7 +2740,7 @@ public class HcyyEntranceService {
    }
    //删除已保存处方时调用
    public String deletePrescription(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
    public String deletePrescription(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
        if (infos == null || infos.size() == 0) {
            return "药品信息为空";
        }
@ -2731,7 +2749,7 @@ public class HcyyEntranceService {
        }
            String xml = null;
            try {
                xml = initParams("CANCEL_GROUP_DRUG_V4", hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
                xml = initParams("CANCEL_GROUP_DRUG_V4",payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }
@ -2740,7 +2758,7 @@ public class HcyyEntranceService {
    }
    //医生在对药师打回的处方进行双签处理后,医生站将双签信息推送给审方系统
    public String doubleSign(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
    public String doubleSign(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
        if (infos == null || infos.size() == 0) {
            return "药品信息为空";
        }
@ -2749,7 +2767,7 @@ public class HcyyEntranceService {
        }
            String xml = null;
            try {
                xml = initParams("SF_V4_DOUBLE_SIGN",  hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
                xml = initParams("SF_V4_DOUBLE_SIGN",payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }

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

@ -617,8 +617,6 @@ public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
    @PostMapping(value = "/hcyyCheckInfo")
    @ApiOperation(value = "合理用药审核")
    public Envelop hcyyCheckInfo(
            @ApiParam(name = "outpatient", value = "就诊表id")
            @RequestParam(value = "outpatient", defaultValue = "") String outpatient,
            @ApiParam(name = "prescriptionOnly", value = "处方唯一标识")
            @RequestParam(value = "prescriptionOnly", defaultValue = "") String prescriptionOnly,
            @ApiParam(name = "payType", value = "付款方式0自费;1医保")
@ -630,7 +628,9 @@ public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
            @ApiParam(name = "diagnosisDOS", value = "诊断json")
            @RequestParam(value = "diagnosisDOS", defaultValue = "") String diagnosisDOS,
            @ApiParam(name = "infos", value = "药品json")
            @RequestParam(value = "infos", defaultValue = "") String infos) throws Exception {
            @RequestParam(value = "infos", defaultValue = "") String infos,
            @ApiParam(name = "outpatientId",value = "门诊id")
            @RequestParam(value = "outpatientId", defaultValue = "") String outpatientId) throws Exception {
        JSONArray druginfos = JSONArray.parseArray(infos);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = new ArrayList<>();
        for (int i = 0; i < druginfos.size(); i++) {
@ -643,7 +643,7 @@ public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
            WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO = toEntity(diagnosis.get(i).toString(), WlyyPrescriptionDiagnosisDO.class);
            wlyyPrescriptionDiagnosisDOS.add(wlyyPrescriptionDiagnosisDO);
        }
        return success(hcyyEntranceService.checkPrescriptions(outpatient,prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS));
        return success(hcyyEntranceService.checkPrescriptions(prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS,outpatientId));
    }
    /**