Parcourir la source

监管平台数据上报服务

hill9868 il y a 5 ans
Parent
commit
3395a48237

+ 110 - 60
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetService.java

@ -364,7 +364,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
            String[] dept = depToSubject(info.get("dept").toString());
            JSONObject jb = new JSONObject();
            jb.put("id", info.get("id"));
            jb.put("id", orgCode + info.get("id"));
            jb.put("cd_org", orgCode);
            jb.put("cd_area", orgArea);
            jb.put("cd_orgSub", orgSub);
@ -475,8 +475,8 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
            String[] dept = depToSubject(info.get("dept_code").toString());
            JSONObject jb = new JSONObject();
            jb.put("id", info.get("id") == null ? "": info.get("id"));
            jb.put("id_doctor",interId == null ? "0_0":interId);
            jb.put("id",orgCode + info.get("id"));
            jb.put("id_doctor",interId == null ? "0":interId);
            jb.put("organ_code",orgCode);
            jb.put("organ_name", orgName);
            jb.put("net_service", dept[0].toString());
@ -536,7 +536,10 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
        for(int i=0; i<total; i++) {
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
            //基于科室转换成国家诊疗科目代码
            String[] dept = depToSubject(info.get("dept_code").toString());
            // 获取监管平台唯一标识
            String visitDocCode = achNsDoctorRecord(info.get("docId").toString());
            JSONObject jb = new JSONObject();
            jb.put("id_online_ask", info.get("id"));
@ -549,7 +552,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
            jb.put("cd_area", orgArea);
            jb.put("visit_doc_name",  info.get("docName")== null? "0":info.get("docName"));
            jb.put("visit_doc_id_no",  info.get("docIdCard")== null? "0":info.get("docIdCard"));
            jb.put("visit_doc_code",  info.get("docId")== null? "0":info.get("docId"));
            jb.put("visit_doc_code",  visitDocCode);
            jb.put("visit_dept_code", dept[0].toString());
            jb.put("visit_dept_name", dept[1].toString());
            jb.put("pt_no", info.get("patientName")== null? "0":info.get("patientName"));
@ -586,56 +589,99 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
        return resInfo;
    }
    // 9 网络诊疗服务信息 	micc.upNsOnlineMed  --- 无该业务,不对应
    public String upNsOnlineMed() throws Exception {
    // 9 网络诊疗服务信息 	micc.upNsOnlineMed  ---
    public String upNsOnlineMed(String startDate, String endDate) throws Exception {
        String api = "micc.upNsOnlineMed";
        String res = "";
        int total = 0;
        int success = 0;
        int error = 0;
        String token = upNsUserToken();
        JSONObject jb = new JSONObject();
        jb.put("id_online_med", "");
        jb.put("net_service_code", "");
        jb.put("med_class_code", "");
        jb.put("org_name", "");
        jb.put("org_code", "");
        jb.put("cd_orgSub", "");
        jb.put("cd_area", "");
        jb.put("visit_doc_name", "");
        jb.put("visit_doc_id_no", "");
        jb.put("visit_doc_code", "");
        jb.put("visit_subject_code", "");
        jb.put("visit_ subject _name", "");
        jb.put("visit_dept_code", "");
        jb.put("visit_dept_name", "");
        jb.put("pt_no", "");
        jb.put("pt_age", "");
        jb.put("cost_type", "");
        jb.put("pt_birthdate", "");
        jb.put("ge_code", "");
        jb.put("pt_tel", "");
        jb.put("card_type", "");
        jb.put("id_no", "");
        jb.put("pt_district", "");
        jb.put("pt_card_type", "");
        jb.put("pt_card_no", "");
        jb.put("apply_time", "");
        jb.put("visit_time", "");
        jb.put("visit_finish_time", "");
        jb.put("old_diag_code", "");
        jb.put("old_diag_name", "");
        jb.put("diag_code", "");
        jb.put("diag_name", "");
        jb.put("diseases_type", "");
        jb.put("complaint_content", "");
        jb.put("proc_file", "");
        jb.put("price", "");
        jb.put("fg_reply", "");
        jb.put("crt_time", "");
        JSONArray jsonArray = new JSONArray();
        jsonArray.add(jb);
        String res = postToInter(token,api, jsonArray);
        String sql = "select a.id,a.register_no, a.type, b.id as docId, a.doctor_name, b.idcard as docIdCard\n" +
                "     , a.dept, a.dept_name, c.name, c.idcard as paId, c.sex,c.mobile,a.create_time,b.charge_type\n" +
                "     ,a.register_date, a.end_time,a.icd10,a.icd10_name,a.origin_adm_no, a.description ,d.req_fee\n" +
                "  from wlyy_outpatient a \n" +
                "         left join base_doctor b on b.id = a.doctor\n" +
                "         left join wlyy_charge_dict d on d.charge_type = b.charge_type\n" +
                "         left join base_patient c on c.id = a.patient\n" +
                " where a.register_no != ''" ;
        return res;
        if(startDate.length() > 0){
            sql =  sql + "  and a.create_time >=  '" + startDate + "' ";
        }
        if(endDate.length() > 0 ){
            sql =  sql +  "  and a.create_time < '" + endDate + "' ";
        }
        List list = jdbcTemplate.queryForList(sql);
        total = list.size();
        for(int i=0; i<list.size(); i++) {
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
            //基于科室转换成国家诊疗科目代码
            String[] dept = depToSubject(info.get("dept_code").toString());
            // 获取监管平台唯一标识
            String visitDocCode = achNsDoctorRecord(info.get("docId").toString());
            JSONObject jb = new JSONObject();
            jb.put("id_online_med", orgCode + info.get("register_no"));
            jb.put("net_service_code", "4");
            jb.put("med_class_code", info.get("type")== ""?"1":info.get("type"));
            jb.put("org_name", orgName);
            jb.put("org_code", orgCode);
            jb.put("cd_orgSub",orgSub);
            jb.put("cd_area",orgArea);
            jb.put("visit_doc_name",  info.get("doctor_name"));
            jb.put("visit_doc_id_no", info.get("docIdCard"));
            jb.put("visit_doc_code", visitDocCode);
            jb.put("visit_subject_code", dept[0].toString());
            jb.put("visit_ subject _name",dept[1].toString());
            jb.put("visit_dept_code", info.get("dept"));
            jb.put("visit_dept_name", info.get("dept_name"));
            jb.put("pt_no", info.get("paName"));
            jb.put("pt_age",  IdNOToAge(info.get("paId").toString()));
            jb.put("cost_type", info.get("charge_type").toString());
            jb.put("pt_birthdate", "");
            jb.put("ge_code", info.get("sex"));
            jb.put("pt_tel", info.get("moble"));
            jb.put("card_type", "1");
            jb.put("id_no", info.get("paId"));
            jb.put("pt_district", "");
            jb.put("pt_card_type", "");
            jb.put("pt_card_no",info.get("card_no"));
            jb.put("apply_time", info.get("create_time"));
            jb.put("visit_time", info.get("register_date"));
            jb.put("visit_finish_time", info.get("end_time"));
            jb.put("old_diag_code", "");
            jb.put("old_diag_name", "");
            jb.put("diag_code",info.get("icd10"));
            jb.put("diag_name", info.get("icd10_name"));
            jb.put("diseases_type", info.get("origin_adm_no") == null ? "1":"2");
            jb.put("complaint_content", info.get("description"));
            jb.put("proc_file", "");
            jb.put("price", Integer.parseInt(info.get("req_fee").toString())  == 0 ? 0:info.get("req_fee") );
            jb.put("fg_reply", "");
            jb.put("crt_time", DateUtil.dateToStrLong(DateUtil.getNow()));
            JSONArray jsonArray = new JSONArray();
            jsonArray.add(jb);
            res = postToInter(token,api, jsonArray);
            JSONObject resJson = (JSONObject) JSONObject.parse(res);
            if("200".equals(resJson.get("msg").toString())){
                success++;
            }else{
                saveErrorLog("9",info.get("id").toString(),res);
                error++;
            }
        }
        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,失败 : " + error + "条。";
        return resInfo;
    }
    // 10 电子处方表 micc.upPrescription    --- 完成
@ -669,15 +715,19 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
        for(int i=0; i<total; i++) {
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
            // 获取监管平台唯一标识
            String visitDocCode = achNsDoctorRecord(info.get("docIdcard").toString());
            JSONObject jb = new JSONObject();
            jb.put("id_prescription", info.get("id"));
            jb.put("id_prescription", orgCode + info.get("id"));
            jb.put("pres_no",info.get("real_order")== null?"0":info.get("real_order"));
            jb.put("pres_class_code", "0");
            jb.put("pres_class_name", "0");
            jb.put("pres_class_code", "1");
            jb.put("pres_class_name", "西药");
            jb.put("pt_id", info.get("patient_code"));
            jb.put("med_rd_no", info.get("outpatient_id"));
            jb.put("med_class_code", "0");
            jb.put("med_class_name", "0");
            jb.put("med_class_code", "4");
            jb.put("med_class_name", "在线复诊");
            jb.put("pt_no", info.get("patient_name"));
            jb.put("ge_code", info.get("sex")== null?"0": info.get("sex"));
            jb.put("pt_age",IdNOToAge( info.get("idcard").toString()));
@ -692,14 +742,14 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
            jb.put("cost_type", "");
            jb.put("ins_class_code", "");
            jb.put("ins_class_name", "");
            jb.put("org_code", "350211A1002");
            jb.put("org_name","厦门大学附属中山医院");
            jb.put("org_code", orgCode);
            jb.put("org_name",orgName);
            jb.put("pres_subject_code", "0");
            jb.put("pres_subject_name", "0");
            jb.put("pres_dept_code", info.get("dept")== null?"0":info.get("dept"));
            jb.put("pres_dept_name",info.get("dept_name")== null?"0":info.get("dept_name"));
            jb.put("pres_time", info.get("create_time")== null?"1900-01-01 00:00:00":DateUtil.dateToStrLong((Date)info.get("create_time")));
            jb.put("pres_doc_code", info.get("doctor")== null?"0":info.get("doctor"));
            jb.put("pres_doc_code", visitDocCode);
            jb.put("pres_doc_name", info.get("doctor_name")== null?"0":info.get("doctor_name"));
            jb.put("pres_doc_id_no", info.get("docIdcard")== null?"0":info.get("docIdcard"));
            jb.put("trial_doc_code", "0");
@ -747,7 +797,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
                "      ,a.unit,a.quantity,a.pack_unit,a.usage_code,a.supply_code\n" +
                "      ,a.specification,a.pack_retprice,a.quantity*a.pack_retprice as drug_total_price\n" +
                "  from wlyy_prescription_info a \n" +
                "\t\t\tLEFT JOIN wlyy_prescription b \n" +
                "     LEFT JOIN wlyy_prescription b \n" +
                "             on b.id = a.prescription_id\n" +
                " where  ";
        if(startDate.length() > 0){
@ -763,9 +813,9 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
        for(int i=0; i<total; i++) {
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
            JSONObject jb = new JSONObject();
            jb.put("id_prescription_drug", info.get("id") == null? "0": info.get("id"));
            jb.put("id_prescription_drug",orgCode + info.get("id"));
            jb.put("pres_no", info.get("prescription_id") == null? "0": info.get("prescription_id"));
            jb.put("org_code","350211A1002");
            jb.put("org_code",orgCode);
            jb.put("appr_drug_code", info.get("drug_no") == null? "0": info.get("drug_no"));
            jb.put("appr_drug_name", info.get("drug_name") == null? "0": info.get("drug_name"));
            jb.put("drug_code", "");