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

海沧医院门诊处方审核

luofenqiang преди 3 години
родител
ревизия
120d51587e

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

@ -146,7 +146,9 @@ public class HcyyEntranceService {
    public String getYYCheckUrl(){
    public String getYYCheckUrl(){
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("YyCheckUrl");
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("YyCheckUrl");
        if(list == null || list.size() <= 0) {
            return "";
        }
        String url = list.get(0).getDictCode();
        String url = list.get(0).getDictCode();
        return url;
        return url;
    }
    }
@ -2605,18 +2607,196 @@ public class HcyyEntranceService {
    public  String initParams(WlyyOutpatientDO outpatientDO,WlyyPrescriptionDO prescriptionDO,List<WlyyPrescriptionInfoDO> infoDOList) throws Exception {
        if (outpatientDO==null){
            throw new Exception("门诊为空");
    public String initParams(String serviceCode,String hisId,String payType,String patient,String doctor,List<WlyyPrescriptionInfoDO> infos,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception {
        String xml ="";
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if (patientMappingDO == null){
            return "患者信息映射表为空";
        }
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        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);
        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;
            recipeFeeTotal += feeTotal;
        }
        if (patientDO == null){
            return "患者信息表为空";
        }
        if (baseDoctorDO == null){
            return "医生基本信息表为空";
        }
        if (baseDoctorHospitalDOList == null || baseDoctorHospitalDOList.size()==0){
            return "医生执业信息表为空";
        }
        if (StringUtils.isEmpty(hisId)){
            hisId = UUID.randomUUID().toString();
        }
        String sex = "";
        if (patientDO.getSex()!=null){
            if (patientDO.getSex() == 1){
                sex = "男";
            }
            if (patientDO.getSex() == 2){
                sex = "女";
            }
        }
        }
        String base = "<base>  \n" +
                "    <hospital_code><![CDATA[1001]]></hospital_code>  \n" +
                "    <event_no><![CDATA["+outpatientDO.getRegisterNo()+"]]></event_no>  \n" +
                "    <patient_id><![CDATA[002097137200]]></patient_id>  \n" +
        //基础标记
        String base =
                "<base>  \n" +
                "    <hospital_code><![CDATA["+outpatientDO.getHospital()+"]]></hospital_code>  \n" +
                "    <event_no><![CDATA["+outpatientDO.getAdmNo()+"]]></event_no>  \n" +
                "    <patient_id><![CDATA["+patientMappingDO.getMappingCode()+"]]></patient_id>  \n" +
                "    <source><![CDATA[门诊]]></source>  \n" +
                "    <source><![CDATA[门诊]]></source>  \n" +
                "</base>  \n";
                "</base>  \n";
        return null;
        //患者就诊
        String optPatient =
                "<opt_patient>  \n" +
                "           <sex><![CDATA["+sex+"]]></sex>  \n" +
                "           <name><![CDATA["+ patientDO.getName()+"]]></name> \n" +
                "           <id_type><![CDATA[身份证]]></id_type>\n" +
                "           <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" +
                "           <pregnancy><![CDATA[]]></pregnancy>  \n" +
                "           <time_of_preg><![CDATA[]]></time_of_preg>  \n" +
                "           <breast_feeding><![CDATA[]]></breast_feeding>  \n" +
                "           <height><![CDATA[]]></height>  \n" +
                "           <weight><![CDATA[]]></weight>  \n" +
                "           <address><![CDATA["+ patientDO.getAddress()+"]]></address>  \n" +
                "           <phone_no><![CDATA["+ patientDO.getMobile()+"]]></phone_no>  \n" +
                "           <patient_condition><![CDATA[普通病人]]></patient_condition>  \n" +
                "</opt_patient>";
        //处方单
        String prescriptionInfo =
                "       <opt_prescription_info>  \n" +
                "           <recipe_id><![CDATA["+hisId+"]]></recipe_id>  \n" +
                "           <recipe_no><![CDATA["+hisId+"]]></recipe_no>  \n" +
                "           <recipe_source><![CDATA[门诊]]></recipe_source>  \n" +
                "           <recipe_type><![CDATA[西药方]]></recipe_type>  \n" +
                "           <dept_id><![CDATA["+ baseDoctorHospitalDO.getDeptCode()+"]]></dept_id>  \n" +
                "           <dept_name><![CDATA["+ baseDoctorHospitalDO.getDeptName()+"]]></dept_name>  \n" +
                "           <recipe_doc_title><![CDATA["+baseDoctorDO.getJobTitleName()+"]]></recipe_doc_title>  \n" +
                "           <recipe_doc_id><![CDATA["+doctorMappingDO.getMappingCode()+"]]></recipe_doc_id>  \n" +
                "           <recipe_doc_name><![CDATA["+baseDoctorDO.getName()+"]]></recipe_doc_name>  \n" +
                "           <recipe_time><![CDATA["+recipeTime+"]]></recipe_time>  \n" +
                "           <recipe_fee_total><![CDATA["+recipeFeeTotal+"]]></recipe_fee_total>  \n" +
                "           <herb_unit_price><![CDATA[]]></herb_unit_price>  \n" +
                "           <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" +
                "       </opt_prescription_info>";
        //处方明细
        String prescriptionItems="";
        for (int i = 0; i < infos.size(); i++) {
            String prescriptionItem =
                    "        <opt_prescription_item>     \n" +
                    "           <recipe_item_id><![CDATA["+hisId+"]]></recipe_item_id>  \n" +
                    "           <recipe_id><![CDATA["+infos.get(i).getId()+"]]></recipe_id>  \n" +
                    "           <group_no><![CDATA["+infos.get(i).getGroupNo()+"]]></group_no>  \n" +
                    "           <drug_id><![CDATA["+infos.get(i).getDrugNo()+"]]></drug_id>  \n" +
                    "           <drug_name><![CDATA["+infos.get(i).getDrugName()+"]]></drug_name>  \n" +
                    "           <specification><![CDATA["+infos.get(i).getSpecification()+"]]></specification>  \n" +
                    "           <manufacturer_name><![CDATA["+infos.get(i).getDrugPlace()+"]]></manufacturer_name>  \n" +
                    "           <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" +
                    "           <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" +
                    "           <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" +
                    "           <medicare_type><![CDATA[]]></medicare_type>  \n" +
                    "           <ouvas_flag><![CDATA[]]></ouvas_flag>  \n" +
                    "           <skin_test_flag><![CDATA[]]></skin_test_flag>  \n" +
                    "           <duration><![CDATA[]]></duration>  \n" +
                    "           <special_prompt><![CDATA[]]></special_prompt>  \n" +
                    "       </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++) {
            String diagDate = DateUtil.dateToStrLong(diagnosisDOS.get(i).getCreateTime());
            String prescriptionDiagnose =
                    "   <opt_diagnosis>  \n" +
                    "       <diag_id><![CDATA["+diagnosisDOS.get(i).getId()+"]]></diag_id>  \n" +
                    "       <diag_date><![CDATA["+diagDate+"]]></diag_date>  \n" +
                    "       <diag_name><![CDATA["+diagnosisDOS.get(i).getName()+"]]></diag_name>  \n" +
                    "       <diag_code><![CDATA["+diagnosisDOS.get(i).getCode()+"]]></diag_code>  \n" +
                    "       <diag_status><![CDATA[0]]></diag_status>  \n" +
                    "       <diag_doc_name><![CDATA["+baseDoctorDO.getName()+"]]></diag_doc_name>  \n" +
                    "       <diag_type><![CDATA[门诊诊断]]></diag_type>  \n" +
                    "       <diag_code_type><![CDATA[1]]></diag_code_type>  \n" +
                    "   </opt_diagnosis>  ";
            prescriptionDiagnoses += prescriptionDiagnose;
        }
        String cancelPrescription = "<opt_prescriptions>  \n" +
                "       <opt_prescription>  \n" +
                "           <opt_prescription_info>  \n" +
                "               <recipe_id><![CDATA["+hisId+"]]></recipe_id>  \n" +
                "               <recipe_no><![CDATA["+hisId+"]]></recipe_no>  \n" +
                "           </opt_prescription_info>  \n" +
                "       </opt_prescription>  \n" +
                "   </opt_prescriptions>  ";
        String doctors = "<doc_id><![CDATA["+doctorMappingDO.getMappingCode()+"]]></doc_id>  \n" +
                "   <doc_name><![CDATA["+baseDoctorDO.getName()+"]]></doc_name>";
        String diagnoses="<opt_diagnoses>\n" +
                prescriptionDiagnoses  +
                "\n </opt_diagnoses>"  ;
        String prescriptions =
                "<opt_prescriptions>\n" +
                    "<opt_prescription>\n" +
                        prescriptionInfo  +
                        prescriptionItems  +
                    "</opt_prescription>\n" +
                "</opt_prescriptions>";
        if (serviceCode.equals("GY_V4_FLEXIBLE") || serviceCode.equals("GY_SF_V4")){
            xml = "<root>" + base + optPatient + prescriptions + diagnoses + "</root>";
        }
        else if (serviceCode.equals("SF_V4_VALID_FLAG")){
            xml = "<root>" + base + cancelPrescription + "</root>";
        }
        else if (serviceCode.equals("CANCEL_GROUP_DRUG_V4")){
            xml = "<root>" + base + doctors + cancelPrescription + "</root>";
        }
        else if (serviceCode.equals("SF_V4_DOUBLE_SIGN")){
            xml = "<root>" + base + doctors + feedback + "</root>";
        }
        return xml;
    }
    }
    /**
    /**
@ -2647,6 +2827,96 @@ public class HcyyEntranceService {
        return response;
        return response;
    }
    }
    //处方保存前,进行合理用药审查
    public String checkPrescriptions(String outpatient, String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
        if (null == infos || infos.size() == 0) {
            return "药品信息为空";
        }
        if (diagnosisDOS == null || diagnosisDOS.size() == 0){
            return "诊断信息为空";
        }
            String xml = "";
            xml = initParams("GY_V4_FLEXIBLE", hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
            String response = checkPrescription("GY_V4_FLEXIBLE", xml, "合理用药审查");
        return response;
    }
    //处方在医生站系统成功保存后调用
    public String saveCheck(String outpatient, String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
        if (infos == null || infos.size() == 0) {
            return "药品信息为空";
        }
        if (diagnosisDOS == null || diagnosisDOS.size() == 0){
            return "诊断信息为空";
        }
            String xml = null;
            try {
                xml = initParams("GY_SF_V4",hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }
            String response = checkPrescription("GY_SF_V4", xml, "处方成功保存后调用");
            return response;
    }
    //处方保存成功后,发送给审方系统进行人工审方
    public String validCheck(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
        if (infos == null || infos.size() == 0) {
            return "药品信息为空";
        }
        if (diagnosisDOS == null || diagnosisDOS.size() == 0){
            return "诊断信息为空";
        }
            String xml = null;
            try {
                xml = initParams("SF_V4_VALID_FLAG", hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }
            String response = checkPrescription("SF_V4_VALID_FLAG", xml, "人工审方");
            return response;
    }
    //删除已保存处方时调用
    public String deletePrescription(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
        if (infos == null || infos.size() == 0) {
            return "药品信息为空";
        }
        if (diagnosisDOS == null || diagnosisDOS.size() == 0){
            return "诊断信息为空";
        }
            String xml = null;
            try {
                xml = initParams("CANCEL_GROUP_DRUG_V4", hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }
            String response = checkPrescription("CANCEL_GROUP_DRUG_V4", xml, "删除已保存处方时调用");
            return response;
    }
    //医生在对药师打回的处方进行双签处理后,医生站将双签信息推送给审方系统
    public String doubleSign(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
        if (infos == null || infos.size() == 0) {
            return "药品信息为空";
        }
        if (diagnosisDOS == null || diagnosisDOS.size() == 0){
            return "诊断信息为空";
        }
            String xml = null;
            try {
                xml = initParams("SF_V4_DOUBLE_SIGN",  hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }
            String response = checkPrescription("SF_V4_DOUBLE_SIGN", xml, "处方双签");
            return response;
    }
    //===========================杭州逸曜合理用药======================================
    //===========================杭州逸曜合理用药======================================
    //===========================CA签名================================
    //===========================CA签名================================

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

@ -12,6 +12,7 @@ import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
@ -632,4 +633,208 @@ public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
        return ObjEnvelop.getSuccess("ok",hcyyEntranceService.BrowseSingleEMR(bstrEmrID));
        return ObjEnvelop.getSuccess("ok",hcyyEntranceService.BrowseSingleEMR(bstrEmrID));
    }
    }
    /**
     * 合理用药审核
     * @param patient 病人id
     * @param doctor 医生id
     * @param diagnosisDOS 诊断json
     * @param infos  药品json
     * @return
     * @throws Exception
     */
    @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医保")
            @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(hcyyEntranceService.checkPrescriptions(outpatient,prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS));
    }
    /**
     * 处方在医生站系统成功保存后调用
     * @param patient 病人id
     * @param doctor 医生id
     * @param diagnosisDOS 诊断json
     * @param infos  药品json
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/hcyySaveCheckInfo")
    @ApiOperation(value = "处方在医生站系统成功保存后调用")
    public Envelop hcyySaveCheckInfo(
            @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医保")
            @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(hcyyEntranceService.saveCheck(outpatient,prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS));
    }
    /**
     * 处方保存成功后,发送给审方系统进行人工审方
     * @param patient 病人id
     * @param doctor 医生id
     * @param diagnosisDOS 诊断json
     * @param infos  药品json
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/hcyyValidCheckInfo")
    @ApiOperation(value = "人工审方")
    public Envelop hcyyValidCheckInfo(
            @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医保")
            @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(hcyyEntranceService.validCheck(outpatient,prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS));
    }
    /**
     * 删除已保存处方
     * @param patient 病人id
     * @param doctor 医生id
     * @param diagnosisDOS 诊断json
     * @param infos  药品json
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/hcyyDeleteInfo")
    @ApiOperation(value = "删除已保存处方时调用")
    public Envelop hcyyDeleteInfo(
            @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医保")
            @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(hcyyEntranceService.deletePrescription(outpatient,prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS));
    }
    /**
     * 医生在对药师打回的处方进行双签处理后,医生站将双签信息推送给审方系统
     * @param patient 病人id
     * @param doctor 医生id
     * @param diagnosisDOS 诊断json
     * @param infos  药品json
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/hcyyDoubleSign")
    @ApiOperation(value = "医生在对药师打回的处方进行双签处理后,医生站将双签信息推送给审方系统")
    public Envelop hcyyDoubleSign(
            @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医保")
            @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(hcyyEntranceService.doubleSign(outpatient,prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS));
    }
}
}