Browse Source

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

chenjiasheng 3 years ago
parent
commit
cb36c5d12d

+ 3 - 3
business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java

@ -98,7 +98,7 @@ public class HealthCareService {
    private String ylzConfigSignKey;
    private String ylzConfigOrgCode;
    public static String entranceHealthCareUrl = "http://172.16.100.240:10023/healthCare/";
    public static String entranceHealthCareUrl = "http://127.0.0.1:10023/healthCare/";
    public void initConfig() throws Exception{
@ -811,7 +811,7 @@ public class HealthCareService {
            throw new Exception("患者his信息不存在");
        }
        JSONObject data = new JSONObject();
        data.put("service_id","10000");
        data.put("service_id","100000");
        data.put("name",patientDO.getName());
        data.put("idcard",patientDO.getIdcard());
        data.put("cert_type","01");//TODO
@ -864,7 +864,7 @@ public class HealthCareService {
            throw new Exception("患者his信息不存在");
        }
        JSONObject data = new JSONObject();
        data.put("service_id","10000");
        data.put("service_id","100000");
        data.put("name",patientDO.getName());
        data.put("idcard",patientDO.getIdcard());
        data.put("cert_type","01");//TODO

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

@ -1199,4 +1199,361 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            return str;
        }
    }
    //======================合理用药===========================
    public String getUseDrugUrl(){
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("useDrugUrl");
        String url = list.get(0).getDictCode();
        return url;
    }
    /**
     * 3.1	基础标记
     *
     * @param hospitalCode 医院/院区编码
     * @param eventNo 就诊流水号
     * @param patientId 患者id
     * @param source 请求数据的来源,传入固定值:门诊
     * @return
     */
    public String initBaseParam(String hospitalCode,String eventNo,String patientId,String source){
        String base = "<base> ";
        source = "门诊";
        if (StringUtils.isNoneBlank(hospitalCode)){
            base +=" <hospital_code>"+hospitalCode+"</hospital_code> ";
        }
        if (StringUtils.isNoneBlank(eventNo)){
            base +=" <event_no>"+eventNo+"</event_no> ";
        }
        if (StringUtils.isNoneBlank(patientId)){
            base +=" <patient_id>"+patientId+"</patient_id> ";
        }
        if (StringUtils.isNoneBlank(source)){
            base +=" <source>"+source+"</source> ";
        }
        base+="</base>";
        return base;
    }
    /**
     *3.2	患者就诊
     * @param sex 传入4种值:男/女/M/F
     * @param name
     * @param idType 患者在医院登记的证件类型,如:身份证、户口本等
     * @param idNo 患者在医院登记证件对应的号码
     * @param birthWeight 患者出生时的体重, 必须包含数字和单位,计量单位:g,如3500g
     * @param birthday 患者的出生日期,格式:yyyy-mm-dd
     * @param medCardNo 患者就诊时所使用的医疗卡号
     * @param eventTime 患者到医院的就诊时间,一般为挂号时间,格式:yyyy-mm-dd hh24:mi:ss
     * @param deptId 系统运行核心关联字段,患者挂号的科室id
     * @param deptName 患者挂号的科室名称
     * @param payType 患者付费方式,如:自费、市医保、省医保等
     * @param pregnancy 是否怀孕 1: 是0: 否
     * @param timeOfPreg 孕期 孕妇的妊娠时长,只传数字,默认计量单位:周
     * @param breastFeeding 是否哺乳1: 是0: 否
     * @param height 身高
     * @param weight 体重
     * @param address 联系地址
     * @param phoneNo 联系电话
     * @param dialysis 是否透析 1: 是0: 否
     * @param patientCondition 一些笼统的描述信息,如:普通病人、危重病人
     * @return
     */
    public String initOptPatientParam(String sex,String name,String idType,String idNo,String birthWeight,String birthday,String medCardNo,
                                      String eventTime,String deptId,String deptName,String payType,String pregnancy,String timeOfPreg,String breastFeeding,
                                      String height,String weight,String address,String phoneNo,String dialysis,String patientCondition){
        String optPatient = "<opt_patient> ";
        if (StringUtils.isNoneBlank(sex)){
            optPatient +=" <sex>"+sex+"</sex> ";
        }
        if (StringUtils.isNoneBlank(name)){
            optPatient +=" <name>"+name+"</name> ";
        }
        if (StringUtils.isNoneBlank(idType)){
            optPatient +=" <id_type>"+idType+"</id_type> ";
        }
        if (StringUtils.isNoneBlank(idNo)){
            optPatient +=" <id_no>"+idNo+"</id_no> ";
        }
        if (StringUtils.isNoneBlank(birthWeight)){
            optPatient +=" <birth_weight>"+birthWeight+"</birth_weight> ";
        }
        if (StringUtils.isNoneBlank(birthday)){
            optPatient +=" <birthday>"+birthday+"</birthday> ";
        }
        if (StringUtils.isNoneBlank(medCardNo)){
            optPatient +=" <med_card_no>"+medCardNo+"</med_card_no> ";
        }
        if (StringUtils.isNoneBlank(eventTime)){
            optPatient +=" <event_time>"+eventTime+"</event_time> ";
        }
        if (StringUtils.isNoneBlank(deptId)){
            optPatient +=" <dept_id>"+deptId+"</dept_id> ";
        }
        if (StringUtils.isNoneBlank(deptName)){
            optPatient +=" <dept_name>"+deptName+"</dept_name> ";
        }
        if (StringUtils.isNoneBlank(payType)){
            optPatient +=" <pay_type>"+payType+"</pay_type> ";
        }
        if (StringUtils.isNoneBlank(pregnancy)){
            optPatient +=" <pregnancy>"+pregnancy+"</pregnancy> ";
        }
        if (StringUtils.isNoneBlank(timeOfPreg)){
            optPatient +=" <time_of_preg>"+timeOfPreg+"</time_of_preg> ";
        }
        if (StringUtils.isNoneBlank(breastFeeding)){
            optPatient +=" <breast_feeding>"+breastFeeding+"</breast_feeding> ";
        }
        if (StringUtils.isNoneBlank(height)){
            optPatient +=" <height>"+height+"</height> ";
        }
        if (StringUtils.isNoneBlank(weight)){
            optPatient +=" <weight>"+weight+"</weight> ";
        }
        if (StringUtils.isNoneBlank(address)){
            optPatient +=" <address>"+address+"</address> ";
        }
        if (StringUtils.isNoneBlank(phoneNo)){
            optPatient +=" <phone_no>"+phoneNo+"</phone_no> ";
        }
        if (StringUtils.isNoneBlank(dialysis)){
            optPatient +=" <dialysis>"+dialysis+"</dialysis> ";
        }
        if (StringUtils.isNoneBlank(patientCondition)){
            optPatient +=" <patient_condition>"+patientCondition+"</patient_condition> ";
        }
        optPatient+="</opt_patient>";
        return optPatient;
    }
    /**3.3.1	处方单
     *
     * @param recipeId  系统运行核心关联字段,一张处方实体的唯一标记,院内唯一,主键
     * @param recipeNo 如不存在,和处方id传值一样即可
     * @param recipeSource 三种值:门诊,急诊
     * @param recipeType 三种值:西药方,中成药方,草药方
     * @param recipeDocId 系统运行核心关联字段,开方医生工号
     * @param recipeDocName 开方医生姓名
     * @param recipeDocTitle 开方医生的职称,如:主治医师、副主任医师、主任医师等。
     * @param deptId 系统运行核心关联字段,开方医师所属科室id
     * @param deptName 开方医师所属科室名称
     * @param recipeTime 系统运行核心字段,格式:yyyy-mm-dd hh24:mi:ss
     * @param herbUnitPrice 如果是中药饮片处方,此处必填
     * @param herbPacketCount 如果是中药饮片处方,此处必填
     * @param recipeFeeTotal 处方总金额
     * @param recipeStatus 0: 新开或修改处方。数据要求:传入的所有药品明细发药数量值均必须大于0
     * @param originalRecipeId 当Recipe_status为1时表示退药处方时,则必须传入当前退药处方所对应原始处方的处方id
     * @param urgentFlag 用于处方的优先审核 1: 是0: 否
     * @return
     */
    public String initPrescriptionInfoParam(String recipeId,String recipeNo,String recipeSource,String recipeType,String recipeDocId,String recipeDocName,String recipeDocTitle,
                                      String deptId,String deptName,String recipeTime,String herbUnitPrice,String herbPacketCount,String recipeFeeTotal,
                                      String recipeStatus,String originalRecipeId,String urgentFlag){
        String optPatient = "<opt_prescription_info>";
        if (StringUtils.isNoneBlank(recipeId)){
            optPatient +=" <recipe_id>"+recipeId+"</recipe_id> ";
        }
        if (StringUtils.isNoneBlank(recipeNo)){
            optPatient +=" <recipe_no>"+recipeNo+"</recipe_no> ";
        }
        if (StringUtils.isNoneBlank(recipeSource)){
            optPatient +=" <recipe_source>"+recipeSource+"</recipe_source> ";
        }
        if (StringUtils.isNoneBlank(recipeType)){
            optPatient +=" <recipe_type>"+recipeType+"</recipe_type> ";
        }
        if (StringUtils.isNoneBlank(recipeDocId)){
            optPatient +=" <recipe_doc_id>"+recipeDocId+"</recipe_doc_id> ";
        }
        if (StringUtils.isNoneBlank(recipeDocName)){
            optPatient +=" <recipe_doc_name>"+recipeDocName+"</recipe_doc_name> ";
        }
        if (StringUtils.isNoneBlank(recipeDocTitle)){
            optPatient +=" <recipe_doc_title>"+recipeDocTitle+"</recipe_doc_title> ";
        }
        if (StringUtils.isNoneBlank(deptId)){
            optPatient +=" <dept_id>"+deptId+"</dept_id> ";
        }
        if (StringUtils.isNoneBlank(deptName)){
            optPatient +=" <dept_name>"+deptName+"</dept_name> ";
        }
        if (StringUtils.isNoneBlank(recipeTime)){
            optPatient +=" <recipe_time>"+recipeTime+"</recipe_time> ";
        }
        if (StringUtils.isNoneBlank(herbUnitPrice)){
            optPatient +=" <herb_unit_price>"+herbUnitPrice+"</herb_unit_price> ";
        }
        if (StringUtils.isNoneBlank(herbPacketCount)){
            optPatient +=" <herb_packet_count>"+herbPacketCount+"</herb_packet_count> ";
        }
        if (StringUtils.isNoneBlank(recipeFeeTotal)){
            optPatient +=" <recipe_fee_total>"+recipeFeeTotal+"</recipe_fee_total> ";
        }
        if (StringUtils.isNoneBlank(recipeStatus)){
            optPatient +=" <recipe_status>"+recipeStatus+"</recipe_status> ";
        }
        if (StringUtils.isNoneBlank(originalRecipeId)){
            optPatient +=" <original_recipe_id>"+originalRecipeId+"</original_recipe_id> ";
        }
        if (StringUtils.isNoneBlank(urgentFlag)){
            optPatient +=" <urgent_flag>"+urgentFlag+"</urgent_flag> ";
        }
        optPatient+="</opt_prescription_info>";
        return optPatient;
    }
    /**
     * 3.3.2	处方明细
     *
     * @param recipeId 系统运行核心关联字段,一张处方实体的唯一标记,院内唯一,主键
     * @param recipeItemId 系统运行核心关联字段,唯一标记处方中的每一项药物医嘱
     * @param drugId 系统运行核心关联字段,医院药品id,传入约定的药品编码
     * @param drugName 药品的通用名称
     * @param specification 药品规格的描述,如0.5gx24
     * @param preparation 药品剂型名称
     * @param manufacturerName 药品产地名称
     * @param countUnit 如果一盒药品12片,发药单位为片时,包装规格数量为1
     * @param drugDose 医生开立的单次给药剂量,值必须是数字+单位,如:0.5g 、200ml等
     * @param despensingNum 当处方状态为-1(部分药品退费退药)时,这里填写负值,表示具体退多少。
    正常处方状态情况,请填写最终生效值,表示最终的发药数量。
     * @param packUnit  发药单位,和发药数量对应,例如:瓶、盒、片等
     * @param unitPrice 药品的费用单价
     * @param feeTotal 药品的单价*发药数量,计量单位为元 
     * @param groupNo 药物的分组号,同组药物组号一致。
     * @param drugAdminRouteName 传入约定的药品使用途径,如:静脉推注等
     * @param drugUsingFreq 传入约定的药品给药频次,如:qd、bid等,
     * @param drugUsingTimePoint 药品给药时机,如:饭前、饭后、空腹等
     * @param drugUsingAim 药品的用药目的,预防|治疗|其他
     * @param drugUsingArea 药品使用部位
     * @param infusionSpeed 静脉输液药品滴注时长或速度的描述,需同时包含数字和单位,如:1小时、20滴/分钟
     * @param duration 由医生指定的药品使用天数或次数,如:5天,10次等
     * @param specialPrompt 备注信息,如饮片的先煎、后下等
     * @param skinTestFlag 1: 皮试0: 非皮试
     * @param skinTestResult 皮试结果
     * @param ouvasFlag 门诊静配标志
     * @param medicareType 结算方式
     * @param startTime 开始使用时间
     * @param endTime 结束使用时间
     * @return
     */
    public String initPrescriptionItemParam(String recipeId,String recipeItemId,String drugId,String drugName,String specification,String preparation,String manufacturerName,
                                            String countUnit,String drugDose,String despensingNum,String packUnit,String unitPrice,String feeTotal,
                                            String groupNo,String drugAdminRouteName,String drugUsingFreq,String drugUsingTimePoint,String drugUsingAim,String drugUsingArea,
                                            String infusionSpeed,String duration,String specialPrompt,String skinTestFlag,String skinTestResult,String ouvasFlag,
                                            String medicareType,String startTime,String endTime){
        String optPatient = "<opt_prescription_item>";
        if (StringUtils.isNoneBlank(recipeId)){
            optPatient +=" <recipe_id>"+recipeId+"</recipe_id> ";
        }
        if (StringUtils.isNoneBlank(recipeItemId)){
            optPatient +=" <recipe_item_id>"+recipeItemId+"</recipe_item_id> ";
        }
        if (StringUtils.isNoneBlank(drugId)){
            optPatient +=" <drug_id>"+drugId+"</drug_id> ";
        }
        if (StringUtils.isNoneBlank(drugName)){
            optPatient +=" <drug_name>"+drugName+"</drug_name> ";
        }
        if (StringUtils.isNoneBlank(specification)){
            optPatient +=" <specification>"+specification+"</specification> ";
        }
        if (StringUtils.isNoneBlank(preparation)){
            optPatient +=" <preparation>"+preparation+"</preparation> ";
        }
        if (StringUtils.isNoneBlank(manufacturerName)){
            optPatient +=" <manufacturer_name>"+manufacturerName+"</manufacturer_name> ";
        }
        if (StringUtils.isNoneBlank(countUnit)){
            optPatient +=" <count_unit>"+countUnit+"</count_unit> ";
        }
        if (StringUtils.isNoneBlank(drugDose)){
            optPatient +=" <drug_dose>"+drugDose+"</drug_dose> ";
        }
        if (StringUtils.isNoneBlank(despensingNum)){
            optPatient +=" <despensing_num>"+despensingNum+"</despensing_num> ";
        }
        if (StringUtils.isNoneBlank(packUnit)){
            optPatient +=" <pack_unit>"+packUnit+"</pack_unit> ";
        }
        if (StringUtils.isNoneBlank(unitPrice)){
            optPatient +=" <unit_price>"+unitPrice+"</unit_price> ";
        }
        if (StringUtils.isNoneBlank(feeTotal)){
            optPatient +=" <fee_total>"+feeTotal+"</fee_total> ";
        }
        if (StringUtils.isNoneBlank(groupNo)){
            optPatient +=" <group_no>"+groupNo+"</group_no> ";
        }
        if (StringUtils.isNoneBlank(drugAdminRouteName)){
            optPatient +=" <drug_admin_route_name>"+drugAdminRouteName+"</drug_admin_route_name> ";
        }
        if (StringUtils.isNoneBlank(drugUsingFreq)){
            optPatient +=" <drug_using_freq>"+drugUsingFreq+"</drug_using_freq> ";
        }
        if (StringUtils.isNoneBlank(drugUsingTimePoint)){
            optPatient +=" <drug_using_time_point>"+drugUsingTimePoint+"</drug_using_time_point> ";
        }
        if (StringUtils.isNoneBlank(drugUsingAim)){
            optPatient +=" <drug_using_aim>"+drugUsingAim+"</drug_using_aim> ";
        }
        if (StringUtils.isNoneBlank(drugUsingArea)){
            optPatient +=" <drug_using_area>"+drugUsingArea+"</drug_using_area> ";
        }
        if (StringUtils.isNoneBlank(infusionSpeed)){
            optPatient +=" <infusion_speed>"+infusionSpeed+"</infusion_speed> ";
        }
        if (StringUtils.isNoneBlank(duration)){
            optPatient +=" <duration>"+duration+"</duration> ";
        }
        if (StringUtils.isNoneBlank(specialPrompt)){
            optPatient +=" <special_prompt>"+specialPrompt+"</special_prompt> ";
        }
        if (StringUtils.isNoneBlank(skinTestFlag)){
            optPatient +=" <skin_test_flag>"+skinTestFlag+"</skin_test_flag> ";
        }
        if (StringUtils.isNoneBlank(skinTestResult)){
            optPatient +=" <skin_test_result>"+skinTestResult+"</skin_test_result> ";
        }
        if (StringUtils.isNoneBlank(ouvasFlag)){
            optPatient +=" <ouvas_flag>"+ouvasFlag+"</ouvas_flag> ";
        }
        if (StringUtils.isNoneBlank(ouvasFlag)){
            optPatient +=" <ouvas_flag>"+ouvasFlag+"</ouvas_flag> ";
        }
        if (StringUtils.isNoneBlank(medicareType)){
            optPatient +=" <medicare_type>"+medicareType+"</medicare_type> ";
        }
        if (StringUtils.isNoneBlank(startTime)){
            optPatient +=" <start_time>"+startTime+"</start_time> ";
        }
        if (StringUtils.isNoneBlank(endTime)){
            optPatient +=" <end_time>"+endTime+"</end_time> ";
        }
        optPatient+="</opt_prescription_item>";
        return optPatient;
    }
}

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

@ -331,10 +331,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private TasyNatService tasyNatService;
    @Autowired
    private HealthCareService healthCareService;
    @Autowired
    private HcyyPrescriptionService hcyyPrescriptionService;
    public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
    public static String entranceHealthCareUrl = "http://172.16.100.240:10023/healthCare/";
    public static String entranceHealthCareUrl = "http://127.0.0.1:10023/healthCare/";
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -7348,6 +7350,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("cardType",basePatientDO.getCardType());
        rs.put("healthStatus","");
        rs.put("diseaseType","");
        rs.put("medicalState",basePatientDO.getMedicalState());
        if (patientMedicareCardDO != null) {
            rs.put("ssc", patientMedicareCardDO.getCode());
        } else {
@ -9807,6 +9810,104 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        e.printStackTrace();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }else if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
                try {
                    if (prescriptionDiagnosisDOS!=null&&prescriptionDiagnosisDOS.size()!=0){
                        String diagnosisName = prescriptionDiagnosisDOS.get(0).getName();
                        String diagnosisCode = prescriptionDiagnosisDOS.get(0).getCode();
                        //同步诊断
                        com.alibaba.fastjson.JSONObject jsonObject2 = hcyyPrescriptionService.saveDiagnosisToEntrance(outpatientDO.getRegisterNo(),diagnosisName,diagnosisCode);
                        logger.info("上传诊断返回参数"+jsonObject2);
                        //{"msg":"交易成功","code":"0","data":{"PresDetail":{"PresNo":"16151365"}},"success":"True"}
                        if (jsonObject2!=null){
                            if (jsonObject2.getString("code").equalsIgnoreCase("0")){
                                com.alibaba.fastjson.JSONObject jsonObject = jsonObject2.getJSONObject("data");
                                logger.info("上传诊断成功"+jsonObject2);
                            }
                        }
                    }
                    //同步处方
                    String applyDoctor = doctorMappingDO.getDoctorName()+"/"+doctorMappingDO.getMappingCode();
                    com.alibaba.fastjson.JSONObject object = hcyyPrescriptionService.savePrescriptionToEntrance("0",outpatientDO.getCardNo(),outpatientDO.getRegisterNo(),outpatientDO.getDept(),applyDoctor,"50400",infoDOS);
                    logger.info("成功上传处方"+object);
                    //{"msg":"交易成功","code":"0","data":{"PresDetail":{"PresNo":"16151365"}},"success":"True"}
                    if (object!=null){
                        if (object.getString("code").equalsIgnoreCase("0")){
                            com.alibaba.fastjson.JSONObject jsonObject = object.getJSONObject("data");
                            com.alibaba.fastjson.JSONObject jsonObject1 = jsonObject.getJSONObject("PresDetail");
                            String realOrder = jsonObject1.getString("PresNo");
                            wlyyPrescriptionDO.setAdmNo(outpatientDO.getAdmNo());
                            wlyyPrescriptionDO.setSerialNo(outpatientDO.getAdmNo());
                            wlyyPrescriptionDO.setRealOrder(realOrder);
                        }
                    }
                    logger.info("进入处方签名");
                  /*  //处方签名
                    String baseSign=xzyyPrescriptionService.SOF_SignDataWithExtraInfo(wlyyPrescriptionDO);*/
                    //同步电子病历
                    WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionId);
                    try {
                        if (prescriptionEmrDO != null) {
                            logger.info("电子病历同步");
                            hcyyPrescriptionService.saveEmrToEntrance(prescriptionId,null);
                            logger.info("电子病历同步");
                            logger.info("电子病历签名");
                           /* xzyyPrescriptionService.SOF_SignDataWithExtraInfoEmr(wlyyPrescriptionDO);*/
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    try {
                        if (object!=null){
                            if (object.getString("code").equalsIgnoreCase("0")){
                                //  * @param applyDepaName @param applyDoctorName
                                WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
                                String patientCode = outpatientDO.getConsumer();
                                String realerOrder = prescriptionDO.getRealOrder();
                                String recipeTime = DateUtil.dateToStr(prescriptionDO.getCreateTime(), "yyyyMMddHHmmss");
                                List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(prescriptionDO.getDoctor());
                                String applyDepaName = null;
                                if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
                                    applyDepaName = doctorHospitalDOS.get(0).getDeptName();
                                }
                                String voucherNo = outpatientDO.getRegisterNo();
                                String applyDoctorName = prescriptionDO.getDoctorName();
                                BasePatientDO patientDO = basePatientDao.findById(patientCode);
                                String userName = null;
                                String idcard = null;
                                if (patientDO != null) {
                                    userName = patientDO.getName();
                                    idcard = patientDO.getIdcard();
                                }
                                PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patientCode);
                                String userNo = null;
                                if (patientMappingDO != null) {
                                    userNo = patientMappingDO.getMappingCode();
                                }
                                String cardNo = null;
                                if (StringUtils.isNoneBlank(outpatientDO.getCardNo())) {
                                    cardNo = outpatientDO.getCardNo();
                                }
                                logger.info("cardNo:" + cardNo);
                               /* JSONObject jsonObject =entranceService.BS15054(patientMappingDO.getMappingCode(),prescriptionDO.getRealOrder(),demoFlag);
                                net.sf.json.JSONObject res = jsonObject.getJSONObject("resquest");
                                logger.info("获取待结算数据 res: " + res.toString());
                                String rsCode = res.getString("@RESULT");
                                String free= 0+"";
                                if ("0".equals(rsCode)) {
                                    free = res.getString("@total_charge");
                                }*/
                                /*ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, "", "","WX_PUB");
                            */}
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
@ -12424,7 +12525,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //先进行核算检测预约
            String realOrder="";
            String addressNow=provinceName+cityName+townName+streetName+address;
            String result = tasyNatService.initNatParams(HisSeqNo,name.trim(),mediaCard.trim(),addressNow,firstJobCode,secondJobCode);
            String result = tasyNatService.initNatParams(HisSeqNo,name.trim(),mediaCard.trim(),addressNow,firstJobCode,secondJobCode,mobile);
            Boolean flag = false;
            if (StringUtils.isNoneBlank(result)){
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);

+ 47 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/TasyNatService.java

@ -231,6 +231,9 @@ public class TasyNatService {
        if (StringUtils.isNoneBlank(jsonObject.getString("ncp_profession_sub"))){
            condition += "<ncp_profession_sub>"+jsonObject.getString("ncp_profession_sub")+"</ncp_profession_sub>";
        }
        if (StringUtils.isNoneBlank(jsonObject.getString("telephone"))){
            condition += "<telephone>"+jsonObject.getString("telephone")+"</telephone>";
        }
        String itemCoditon="";
        if (StringUtils.isNoneBlank(jsonObject.getString("item"))){
            JSONObject itemObject=jsonObject.getJSONObject("item");
@ -345,7 +348,7 @@ public class TasyNatService {
    }
    //组装核算下单参数
    public String initNatParams(String preNo,String patientName,String icCardNo,String address,String job,String jobChild){
    public String initNatParams(String preNo,String patientName,String icCardNo,String address,String job,String jobChild,String telephone){
        List<WlyyHospitalSysDictDO> natConfigList = wlyyHospitalSysDictDao.findByDictName("natConfigList");
        String deptCode = "0001";
        String staffNo = "0001";
@ -393,6 +396,7 @@ public class TasyNatService {
        jsonObject.put("address_now",address);
        jsonObject.put("ncp_profession",job);
        jsonObject.put("ncp_standing_type",ncpStandingType);
        jsonObject.put("telephone",telephone);
        JSONObject item = new JSONObject();
        item.put("itemCode",itemCode);
        item.put("itemName",itemName);
@ -842,6 +846,20 @@ public class TasyNatService {
                                                    }
                                                    //取消号源
                                                    //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                                                }else if ("作废".equalsIgnoreCase(child.getString("Status"))) {
                                                    logger.info("进入作废订单同步");
                                                    baseNatAppointmentDO.setPayStatus("-1");
                                                    baseNatAppointmentDO.setIsSuccess("-1");
                                                    baseNatAppointmentDO.setCancelReson("患者本人线下作废");
                                                    baseNatAppointmentDO.setCancelTime(new Date());
                                                    baseNatAppointmentDO.setCancelBy(patientId);
                                                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                                                    if (businessOrderDO != null) {
                                                        businessOrderDO.setStatus(-1);
                                                        businessOrderDao.save(businessOrderDO);
                                                    }
                                                    //取消号源
                                                    //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                                                }
                                                baseNatAppointmentDao.save(baseNatAppointmentDO);
                                            }
@ -871,6 +889,20 @@ public class TasyNatService {
                                                }
                                                //取消号源
                                                //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                                            }else if ("作废".equalsIgnoreCase(child.getString("Status"))) {
                                                logger.info("进入作废订单同步");
                                                baseNatAppointmentDO.setPayStatus("-1");
                                                baseNatAppointmentDO.setIsSuccess("-1");
                                                baseNatAppointmentDO.setCancelReson("患者本人线下作废");
                                                baseNatAppointmentDO.setCancelTime(new Date());
                                                baseNatAppointmentDO.setCancelBy(patientId);
                                                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                                                if (businessOrderDO != null) {
                                                    businessOrderDO.setStatus(-1);
                                                    businessOrderDao.save(businessOrderDO);
                                                }
                                                //取消号源
                                                //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                                            }
                                            baseNatAppointmentDO.setVoucherNo(child.getString("ApplyNo"));
                                            baseNatAppointmentDao.save(baseNatAppointmentDO);
@ -901,6 +933,20 @@ public class TasyNatService {
                                    }
                                    //取消号源
                                    //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                                }else if ("作废".equalsIgnoreCase(jsonObject1.getString("Status"))){
                                    logger.info("进入作废订单同步");
                                    baseNatAppointmentDO.setPayStatus("-1");
                                    baseNatAppointmentDO.setIsSuccess("-1");
                                    baseNatAppointmentDO.setCancelReson("患者本人线下作废");
                                    baseNatAppointmentDO.setCancelTime(new Date());
                                    baseNatAppointmentDO.setCancelBy(patientId);
                                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                                    if (businessOrderDO!=null){
                                        businessOrderDO.setStatus(-1);
                                        businessOrderDao.save(businessOrderDO);
                                    }
                                    //取消号源
                                    //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                                }
                                baseNatAppointmentDO.setVoucherNo(jsonObject1.getString("ApplyNo"));
                                baseNatAppointmentDao.save(baseNatAppointmentDO);

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

@ -153,7 +153,7 @@ public class HcyyEntranceService {
    public String getOperateUrl(){
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("xzzxWebOperateService");
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("hcyyWebOperateService");
        String url = list.get(0).getDictCode();
        return url;
@ -161,7 +161,15 @@ public class HcyyEntranceService {
    public String getOperateSmsUrl(){
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("xzzxWebOperateSmsService");
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("hcyyWebOperateSmsService");
        String url = list.get(0).getDictCode();
        return url;
    }
    public String getCaServiceUrl(){
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("hcyyCaService");
        String url = list.get(0).getDictCode();
        return url;
@ -185,6 +193,19 @@ public class HcyyEntranceService {
        return WebserviceUtil.post(url,xzzxNamespace,api,params);
    }
    public String getHcyyCAWebServiceInfo(String api, Map<String,String> params,String url)throws Exception{
        logger.info("url"+url);
        List<WlyyHospitalSysDictDO> xzzxNamespaces =  wlyyHospitalSysDictDao.findByDictName("hcyyCaNamespace");
        String xzzxNamespace = xzzxNamespaces.get(0).getDictCode();
        logger.info("hcyyCaNamespace",xzzxNamespace);
        return WebserviceUtil.post(url,xzzxNamespace,api,params);
    }
    /**
     * 获取部门信息
     * @return
@ -1294,7 +1315,7 @@ public class HcyyEntranceService {
    /**
     *
     *  获取检查单据信息
     *  获取检查项目信息
     * @return
     * @throws Exception
     */
@ -3071,6 +3092,133 @@ public class HcyyEntranceService {
    }
//===========================entrance访问hospital============end=======================
    //===========================CA签名================================
    /**
     * 判断个人实名软证书是否已申请(通过身份证号)
     * @return
     */
    public String XMCAF_SOFT_judgeRealNameSoftCertIsApplied(String idcard)throws Exception{
        String api = "XMCAF_SOFT_judgeRealNameSoftCertIsApplied";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(idcard)){
            condition += "<strUserIdcardNum>"+idcard+"</strUserIdcardNum>";
        }
        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("XMCAF_SOFT_judgeRealNameSoftCertIsApplied params:"+params.toString());
        String xml = getHcyyCAWebServiceInfo("XMCA6_UnifiedCallInterface",params,getCaServiceUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("XMCAF_SOFT_judgeRealNameSoftCertIsApplied json:"+json);
        return json;
    }
    /**
     * 3.2.2 判断个人实名软证调用保护口令是否在暂存期间内(可通过多种方式)
     * @param type 0-通过微信号 openid、1-通过手机号、2-身份证号
     * @param openId 微信号
     * @param mobile 手机号
     * @param idcard 身份证
     * @return
     * @throws Exception
     */
    public String XMCA14_PRNSC_judgeCalledPasswdIsInTempSaveTime(String type,String openId,String mobile,String idcard)throws Exception{
        String api = "XMCA14_PRNSC_judgeCalledPasswdIsInTempSaveTime";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(type)){
            condition += "<strJudgeMode>"+type+"</strJudgeMode>";
        }
        if (StringUtils.isNoneBlank(openId)){
            condition += "<strWxid>"+openId+"</strWxid>";
        }
        if (StringUtils.isNoneBlank(mobile)){
            condition += "<strMobilePhoneNum>"+mobile+"</strMobilePhoneNum>";
        }
        if (StringUtils.isNoneBlank(idcard)){
            condition += "<strUserIdcardNum>"+idcard+"</strUserIdcardNum>";
        }
        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("XMCA14_PRNSC_judgeCalledPasswdIsInTempSaveTime params:"+params.toString());
        String xml = getHcyyCAWebServiceInfo("XMCA6_UnifiedCallInterface",params,getCaServiceUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("XMCA14_PRNSC_judgeCalledPasswdIsInTempSaveTime json:"+json);
        return json;
    }
    /**
     * 3.2.3 通过身份证号,请求个人实名软证书并进行 P1 数字签名(单笔)
     * @param strOriginalData 原文的 MD5 哈希摘要值
     * @param strRealNameSoftCertCalledPasswd 证书被调用保护口令(的大写 32 位 MD5 摘要值)
     * @param idcard 用户身份证号
     * @return
     * @throws Exception
     */
    public String XMCAF_SOFT_requestRealNameSoftCertAndSign(String strOriginalData,String strRealNameSoftCertCalledPasswd,String idcard)throws Exception{
        String api = "XMCAF_SOFT_requestRealNameSoftCertAndSign";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(strOriginalData)){
            condition += "<strOriginalData>"+strOriginalData+"</strOriginalData>";
        }
        condition += "<strRealNameSoftCertCalledPasswd>"+strRealNameSoftCertCalledPasswd+"</strRealNameSoftCertCalledPasswd>";
        if (StringUtils.isNoneBlank(idcard)){
            condition += "<strUserIdcardNum>"+idcard+"</strUserIdcardNum>";
        }
        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("XMCAF_SOFT_requestRealNameSoftCertAndSign params:"+params.toString());
        String xml = getHcyyCAWebServiceInfo("XMCA6_UnifiedCallInterface",params,getCaServiceUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("XMCAF_SOFT_requestRealNameSoftCertAndSign json:"+json);
        return json;
    }
}

+ 10 - 8
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -94,7 +94,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
    public String orgSub ;
    public String imgUrl;
    static String imgPath =File.separator+"data1"+File.separator+"ehr"+File.separator+"svr-internet-hospital-job"+File.separator+"img"+File.separator;
    static String imgPath =File.separator+"data"+File.separator+"hospital"+File.separator+"svr-internet-hospital-job"+File.separator+"img"+File.separator;
    public ObjectMapper objectMapper;
@ -255,9 +255,9 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
        jb.put("protocol_name", superviseDataDict.getProtocolName());
        //其他建设信息
        jb.put("quai_mang_dept", "");
        jb.put("info_mang_dept", "");
        jb.put("medi_service_dept", "");
        jb.put("quai_mang_dept", "0");
        jb.put("info_mang_dept", "0");
        jb.put("medi_service_dept", "1");
        jb.put("server_type", "");
        jb.put("server_total", "");
@ -274,10 +274,10 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
        jb.put("tech_manual", "");
        jb.put("server_manual", "");
        jb.put("emr_level", "");
        jb.put("emr_level", "4");
        jb.put("emr_level_cert", "");
        jb.put("zone_record_share", "");
        jb.put("zone_record_share", "0");
        jb.put("prov_monitor", "");
        jb.put("prov_service", "");
@ -290,6 +290,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
        jb.put("third_compeny_corp_id", "");
        jb.put("third_compeny_prot", "");
        jb.put("green_road","0");
        JSONArray jsonArray = new JSONArray();
@ -361,7 +362,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                jb.put("organ_code", orgCode);
                jb.put("organ_name", orgName);
                jb.put("doc_name", info.get("name")== null ? "0":info.get("name"));
                jb.put("docimg",info.get("photo")==null ?null:getImg("https://hlwyy.xmzsh.com/fastdfs/"+info.get("photo").toString()));
                jb.put("docimg",info.get("photo")==null ?null:getImg("https://hlwyy.xmhcyy.com/hcyy/fastdfs/"+info.get("photo").toString()));
                jb.put("id_card", info.get("idcard")== null ? "0":info.get("idcard"));
                jb.put("sex", info.get("sex")== null ? "0":info.get("sex"));
                jb.put("birthday", info.get("birthday")  == null?"2020-01-01": DateUtil.dateToStrShort((Date)info.get("birthday")));
@ -781,7 +782,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
               "WHERE\n" +
               "\ta.id = b.consult\n" +
               " AND a.symptoms IS NOT NULL AND b.status=1 " +
               "  and c.doctor not in ('402803816babc778016babd0dee21112')";
               "  and c.id not in ('402803816babc778016babd0dee21112')";
        Map<String,Object> params = new HashedMap();
@ -1817,6 +1818,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
        String[] res = new String[2];
        DictDoctorDutyDO doctorDutyDO = dictDoctorDutyDao.findByCode(duty);
        if (doctorDutyDO!=null){
            logger.info("getTitleCode"+doctorDutyDO.getTitleCode()+","+doctorDutyDO.getName());
            res[0]=doctorDutyDO.getTitleCode();
            res[1]=doctorDutyDO.getName();
        }else {

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/utils/ImgUtils.java

@ -61,6 +61,7 @@ public class ImgUtils {
    }
    public static String getImageStr(String imgFile) {
        System.out.print("imgFile==="+imgFile);
        //将图片文件转化为字节数组字符串,并对其进行Base64编码处理
        InputStream in = null;
        byte[] data = null;

+ 45 - 0
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -381,6 +381,51 @@ express:
  sf_check_word: BEWFSCXSyjt4314rz
---
#心脏中心前置机配置
spring:
  profiles: xzprod
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.16.100.240:7306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: jkzl
    password: jkzl@2020
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.16.100.65:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://172.16.100.240:8888/
fast-dfs:
  tracker-server: 172.16.100.240:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_xzzx_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  url: http://172.16.100.37:8090/hospitalPortal-sms/sms/sendMessage
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000061
  sf_check_word: BEWFSCXSyjt4314rz
---
spring:
  profiles: jwystest

+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthCare/HealthCareEndPoint.java

@ -33,7 +33,7 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    private HttpClientUtil httpClientUtil;
    @Value("${wechat.id}")
    private String wechatId;
    public static String entranceHealthCareUrl = "http://172.16.100.240:10023/healthCare/";
    public static String entranceHealthCareUrl = "http://127.0.0.1:10023/healthCare/";
    @GetMapping(value = "doctorAuthentication")
    @ApiOperation(value = "医师身份验证", notes = "医师身份验证")

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

@ -31,7 +31,7 @@ import java.util.Map;
 */
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.HcyyPrescription.PREFIX)
@Api(value = "海沧医院平台服务", description = "心脏中心平台服务", tags = {"心脏中心平台服务"})
@Api(value = "海沧医院平台服务", description = "海沧医院平台服务", tags = {"海沧医院平台服务"})
public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
    @Autowired
@ -383,12 +383,12 @@ public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
    /**
     * 获取检查单据信息
     * 获取检查项目信息
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getExamApply")
    @ApiOperation(value = "获取检查单据信息", notes = "获取检查单据信息")
    @ApiOperation(value = "获取检查项目信息", notes = "获取检查项目信息")
    public ObjEnvelop getExamApply(@ApiParam(name = "spellCode", value = "拼音码", required = false)
                                       @RequestParam(value = "spellCode",required = false)String spellCode)throws Exception{
        return ObjEnvelop.getSuccess("ok",hcyyEntranceService.GetExamApply(spellCode));