Search in sources :

Example 1 with SuperviseContentGsonBean

use of com.mtm.mrecord.mvp.model.entity.SuperviseContentGsonBean in project Mvp-Rxjava-Retrofit-dagger2 by pengMaster.

the class SuperviseBaseInfoFragment method getViewMap.

/**
 * 布局数据塞值
 *
 * @param superviseContentGsonBean
 */
private List<TestBean> getViewMap(SuperviseContentGsonBean superviseContentGsonBean) {
    SuperviseContentGsonBean.SuperviseFormBean superviseForm = superviseContentGsonBean.getSuperviseForm();
    List<SuperviseContentGsonBean.SpecListBean> SpecialtyFormList = superviseContentGsonBean.getSpecList();
    List<DictSupervisionCont> supervisionContList = superviseContentGsonBean.getSupervisionContList();
    List<SupervisionCont> ansList = superviseContentGsonBean.getAnsList();
    List<RadiationEqui> radiList = superviseContentGsonBean.getRadiList();
    String s1 = superviseForm.getSupervSpecCodeSub();
    String[] s2 = s1.split(",");
    String speCode2 = "";
    int lent = 0;
    int s2lent = 0;
    if ("01".equals(superviseForm.getSpecCode())) {
        s2lent = 1;
    } else {
        s2lent = s2.length;
    }
    result = superviseForm.getResult();
    for (int i = 0; i < s2lent; i++) {
        lent = lent + 1;
        if ("04".equals(superviseForm.getSpecCode())) {
            if ("1".equals(superviseForm.getIsWzdw())) {
                subSpeName1 = "放射诊疗";
                speCode2 = "040101";
            } else {
                for (int k = 0; k < radiList.size(); k++) {
                    RadiationEqui ss = radiList.get(k);
                    String speCode1 = ss.getTypeCode();
                    if (speCode1.equals(s2[i].trim())) {
                        subSpeName1 = ss.getTypeName();
                        speCode2 = ss.getTypeCode();
                        break;
                    }
                }
            }
        } else if (superviseForm.getSpecCode().equals("01")) {
            for (int j = 0; j < SpecialtyFormList.size(); j++) {
                SuperviseContentGsonBean.SpecListBean specialtyForm = SpecialtyFormList.get(j);
                String speCode1 = specialtyForm.getSpeCode();
                for (int k2 = 0; k2 < s2.length; k2++) {
                    if (speCode1.equals(s2[k2].trim())) {
                        subSpeName1 = subSpeName1 + specialtyForm.getSpeName();
                        speCode2 = specialtyForm.getSpeCode();
                    }
                }
            }
            if (speCode2.substring(0, 2) == "01") {
                speCode2 = "01";
            }
        } else {
            for (int j = 0; j < SpecialtyFormList.size(); j++) {
                SuperviseContentGsonBean.SpecListBean specialtyForm = SpecialtyFormList.get(j);
                String speCode1 = specialtyForm.getSpeCode();
                if (speCode1.equals(s2[i].trim())) {
                    subSpeName1 = specialtyForm.getSpeName() + "   ";
                    speCode2 = specialtyForm.getSpeCode();
                    break;
                }
            }
        }
        if (supervisionContList != null && supervisionContList.size() > 0 && ansList != null && ansList.size() > 0) {
            // "监督专业名称"  subSpeName
            int i1 = 0;
            String an = "";
            String an1 = "";
            String an2 = "";
            String an3 = "";
            // 过去监督内容
            String questionValue = null;
            String contText;
            List<TestBean> mapResult = new ArrayList<>();
            for (int a = 0; a < supervisionContList.size(); a++) {
                DictSupervisionCont supervisionCont = supervisionContList.get(a);
                if (superviseForm.getSpecCode().equals("01")) {
                    if (speCode2.substring(0, 2).equals("01") && supervisionCont.getContNo().substring(0, 2).equals("01")) {
                        // 公共场所---循环选项
                        if (lent == 1) {
                            contText = supervisionCont.getContText();
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId())) {
                                    an = qa.getContResult().toString();
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    }
                    if ((speCode2.substring(0, 2).equals("07") && supervisionCont.getContNo().substring(0, 2).equals("07"))) {
                        if (((supervisionCont.getContNo().substring(0, 4)).equals("0701"))) {
                            if ((supervisionCont.getContNo().substring(0, 6)).equals("070103")) {
                                contText = supervisionCont.getContText();
                                for (int ds = 0; ds < ansList.size(); ds++) {
                                    // 循环答案选项
                                    SupervisionCont qa = ansList.get(ds);
                                    if ((supervisionCont.getId()).equals(qa.getContId()) && qa.getSupervSpecCode().indexOf(speCode2) != -1) {
                                        an = qa.getContResult().toString();
                                        an1 = String.valueOf(qa.getVal1());
                                        an2 = String.valueOf(qa.getVal2());
                                        an3 = String.valueOf(qa.getVal3());
                                        break;
                                    }
                                }
                                String isBig = supervisionCont.getIsBig() + "";
                                String contNo = supervisionCont.getContNo();
                                questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                                i1++;
                                mapResult.add(new TestBean(isBig, contText + "", questionValue));
                            }
                        }
                    }
                } else if (superviseForm.getSpecCode().equals("02")) {
                    if (((speCode2.substring(0, 2).equals("02") && supervisionCont.getContNo().substring(0, 2).equals("02")))) {
                        if (speCode2.substring(0, 4).equals("0201") || speCode2.substring(0, 4).equals("0202")) {
                            if (((supervisionCont.getContNo().substring(0, 4)).equals("0201"))) {
                                if (superviseForm.getCompType().substring(0, 4).equals("0202")) {
                                    // 020104   020106针对集中式供水
                                    if (supervisionCont.getContNo().equals("020104") || supervisionCont.getContNo().equals("020106")) {
                                        continue;
                                    }
                                } else {
                                    if (supervisionCont.getContNo().equals("020108") || supervisionCont.getContNo().equals("020109")) {
                                        continue;
                                    }
                                }
                                contText = supervisionCont.getContText();
                                for (int ds = 0; ds < ansList.size(); ds++) {
                                    // 循环答案选项
                                    SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                    if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                        an = qa.getContResult().toString();
                                        break;
                                    }
                                }
                                String isBig = supervisionCont.getIsBig() + "";
                                String contNo = supervisionCont.getContNo();
                                questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                                i1++;
                                mapResult.add(new TestBean(isBig, contText + "", questionValue));
                            }
                        }
                    }
                    if (speCode2.substring(0, 4).equals("0203") || speCode2.substring(0, 4).equals("0204")) {
                        if (((supervisionCont.getContNo().substring(0, 4)).equals("0202")) || ((supervisionCont.getContNo().substring(0, 4)).equals("0203"))) {
                            if (superviseForm.getCompType().substring(0, 4).equals("0203")) {
                                if (!(supervisionCont.getContNo().substring(0, 4)).equals("0202")) {
                                    continue;
                                }
                            } else {
                                if (!(supervisionCont.getContNo().substring(0, 4)).equals("0203")) {
                                    continue;
                                }
                            }
                            contText = supervisionCont.getContText();
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    }
                    if (((speCode2.substring(0, 2).equals("07") && supervisionCont.getContNo().substring(0, 2).equals("07")))) {
                        if (((supervisionCont.getContNo().substring(0, 4)).equals("0701"))) {
                            if ((supervisionCont.getContNo().substring(0, 6)).equals("070103")) {
                                contText = supervisionCont.getContText();
                                for (int ds = 0; ds < ansList.size(); ds++) {
                                    // 循环答案选项
                                    SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                    if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                        an = qa.getContResult().toString();
                                        an1 = String.valueOf(qa.getVal1());
                                        an2 = String.valueOf(qa.getVal2());
                                        an3 = String.valueOf(qa.getVal3());
                                        break;
                                    }
                                }
                                String isBig = supervisionCont.getIsBig() + "";
                                String contNo = supervisionCont.getContNo();
                                questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                                i1++;
                                mapResult.add(new TestBean(isBig, contText + "", questionValue));
                            }
                        }
                    }
                } else if (superviseForm.getSpecCode().equals("03")) {
                    // /////职业卫生
                    if (speCode2.substring(0, 2).equals("03")) {
                        if ((supervisionCont.getContNo().substring(0, 2)).equals("03")) {
                            if (superviseForm.getSupervSpecCodeSub().substring(0, 4).equals("0302")) {
                                if (supervisionCont.getContNo().equals("0301") || supervisionCont.getContNo().equals("0302")) {
                                    continue;
                                }
                            } else if (superviseForm.getSupervSpecCodeSub().substring(0, 4).equals("0399")) {
                                if (supervisionCont.getContNo().equals("0303") || supervisionCont.getContNo().equals("0304") || supervisionCont.getContNo().equals("0305") || supervisionCont.getContNo().equals("0306") || supervisionCont.getContNo().equals("0307")) {
                                    continue;
                                }
                            }
                            contText = supervisionCont.getContText();
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    }
                } else if (superviseForm.getSpecCode().equals("04")) {
                    // /////放射卫生
                    if (speCode2.substring(0, 2).equals("04")) {
                        if ((supervisionCont.getContNo().substring(0, 2)).equals("04")) {
                            contText = supervisionCont.getContText();
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    }
                } else if (superviseForm.getSpecCode().equals("05")) {
                    // /////学校卫生
                    if (speCode2.substring(0, 2).equals("05")) {
                        if ((supervisionCont.getContNo().substring(0, 2)).equals("05")) {
                            contText = supervisionCont.getContText();
                            String daan = "";
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                        daan = qa.getVal1().toString();
                                    }
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    }
                    if (((speCode2.substring(0, 2).equals("07") && supervisionCont.getContNo().substring(0, 2).equals("07")))) {
                        if (((supervisionCont.getContNo().substring(0, 4)).equals("0701"))) {
                            if ((supervisionCont.getContNo().substring(0, 6)).equals("070103")) {
                                contText = supervisionCont.getContText();
                                for (int ds = 0; ds < ansList.size(); ds++) {
                                    // 循环答案选项
                                    SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                    if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                        an = qa.getContResult().toString();
                                        an1 = String.valueOf(qa.getVal1());
                                        an2 = String.valueOf(qa.getVal2());
                                        an3 = String.valueOf(qa.getVal3());
                                        break;
                                    }
                                }
                                String isBig = supervisionCont.getIsBig() + "";
                                String contNo = supervisionCont.getContNo();
                                questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                                i1++;
                                mapResult.add(new TestBean(isBig, contText + "", questionValue));
                            }
                        }
                    }
                } else if (superviseForm.getSpecCode().equals("06")) {
                    if (speCode2.substring(0, 2).equals("06")) {
                        if ((supervisionCont.getContNo().substring(0, 2)).equals("06")) {
                            contText = supervisionCont.getContText();
                            String daan = "";
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                        daan = qa.getVal1().toString();
                                    }
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    }
                } else if (speCode2.substring(0, 2).equals("08")) {
                    if ((supervisionCont.getContNo().substring(0, 2)).equals("08") && (!supervisionCont.getContNo().equals("0808") && !supervisionCont.getContNo().equals("0809") && !supervisionCont.getContNo().equals("0810") && !supervisionCont.getContNo().equals("0811") && !supervisionCont.getContNo().equals("0812") && !supervisionCont.getContNo().equals("0814") && !supervisionCont.getContNo().equals("0815") && !supervisionCont.getContNo().equals("0816") && !supervisionCont.getContNo().equals("0817") && !supervisionCont.getContNo().equals("0818"))) {
                        // /医疗卫生----血液安全
                        contText = supervisionCont.getContText();
                        String daan = "";
                        for (int ds = 0; ds < ansList.size(); ds++) {
                            // 循环答案选项
                            SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                            if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                an = qa.getContResult().toString();
                                if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                    daan = qa.getVal1().toString();
                                }
                                break;
                            }
                        }
                        String isBig = supervisionCont.getIsBig() + "";
                        String contNo = supervisionCont.getContNo();
                        questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                        i1++;
                        mapResult.add(new TestBean(isBig, contText + "", questionValue));
                    }
                } else if (superviseForm.getSpecCode().equals("0703") || superviseForm.getSpecCode().equals("0704") || superviseForm.getSpecCode().equals("0701")) {
                    if (superviseForm.getCompType().substring(0, 4).equals("0701")) {
                        if (superviseForm.getCompType().substring(0, 6).equals("070101")) {
                            // speCode2.substring(0,6).equals("070101")
                            if ((supervisionCont.getContNo().substring(0, 4)).equals("0701")) {
                                if ((supervisionCont.getContNo().substring(0, 6)).equals("070101")) {
                                    if (supervisionCont.getContNo().equals("07010110")) {
                                    }
                                    if (supervisionCont.getContNo().equals("07010111")) {
                                    }
                                    contText = supervisionCont.getContText();
                                    String daan = "";
                                    for (int ds = 0; ds < ansList.size(); ds++) {
                                        // 循环答案选项
                                        SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                        if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                            an = qa.getContResult().toString();
                                            an1 = String.valueOf(qa.getVal1());
                                            an2 = String.valueOf(qa.getVal2());
                                            an3 = String.valueOf(qa.getVal3());
                                            if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                                daan = qa.getVal1().toString();
                                            }
                                            break;
                                        }
                                    }
                                    String isBig = supervisionCont.getIsBig() + "";
                                    String contNo = supervisionCont.getContNo();
                                    questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "1");
                                    i1++;
                                    mapResult.add(new TestBean(isBig, contText + "", questionValue));
                                }
                            }
                        }
                    } else if (superviseForm.getCompType().length() >= 6 && superviseForm.getCompType().substring(0, 5).equals("070102")) {
                        if ((supervisionCont.getContNo().substring(0, 4)).equals("0701")) {
                            if ((supervisionCont.getContNo().substring(0, 6)).equals("070102")) {
                                if (supervisionCont.getContNo().equals("07010202")) {
                                }
                                if (supervisionCont.getContNo().equals("07010203")) {
                                }
                                contText = supervisionCont.getContText();
                                String daan = "";
                                for (int ds = 0; ds < ansList.size(); ds++) {
                                    // 循环答案选项
                                    SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                    if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                        an = qa.getContResult().toString();
                                        an1 = String.valueOf(qa.getVal1());
                                        an2 = String.valueOf(qa.getVal2());
                                        an3 = String.valueOf(qa.getVal3());
                                        if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                            daan = qa.getVal1().toString();
                                        }
                                        break;
                                    }
                                }
                                String isBig = supervisionCont.getIsBig() + "";
                                String contNo = supervisionCont.getContNo();
                                questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "1");
                                i1++;
                                mapResult.add(new TestBean(isBig, contText + "", questionValue));
                            }
                        }
                    } else if (superviseForm.getCompType().length() >= 6 && superviseForm.getCompType().substring(0, 5).equals("070103")) {
                        if ((supervisionCont.getContNo().substring(0, 4)).equals("0701")) {
                            if ((supervisionCont.getContNo().substring(0, 6)).equals("070103")) {
                                contText = supervisionCont.getContText();
                                String daan = "";
                                for (int ds = 0; ds < ansList.size(); ds++) {
                                    // 循环答案选项
                                    SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                    if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                        an = qa.getContResult().toString();
                                        an1 = String.valueOf(qa.getVal1());
                                        an2 = String.valueOf(qa.getVal2());
                                        an3 = String.valueOf(qa.getVal3());
                                        if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                            daan = qa.getVal1().toString();
                                        }
                                        break;
                                    }
                                }
                                String isBig = supervisionCont.getIsBig() + "";
                                String contNo = supervisionCont.getContNo();
                                questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                                i1++;
                                mapResult.add(new TestBean(isBig, contText + "", questionValue));
                            }
                        }
                    } else if (superviseForm.getCompType().substring(0, 4).equals("0704")) {
                        if ((supervisionCont.getContNo().substring(0, 4)).equals("0704")) {
                            contText = supervisionCont.getContText();
                            String daan = "";
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                        daan = qa.getVal1().toString();
                                    }
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    } else if (superviseForm.getCompType().equals("070301")) {
                        if ((supervisionCont.getContNo().substring(0, 4)).equals("0703") && (!supervisionCont.getContNo().equals("07030101")) && (!supervisionCont.getContNo().equals("07030102")) && (!supervisionCont.getContNo().equals("07030104")) && (!supervisionCont.getContNo().equals("07030105")) && (!supervisionCont.getContNo().equals("07030301")) && (!supervisionCont.getContNo().equals("07030302"))) {
                            contText = supervisionCont.getContText();
                            String daan = "";
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                        daan = qa.getVal1().toString();
                                    }
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    } else if (superviseForm.getCompType().equals("070399")) {
                        if ((supervisionCont.getContNo().substring(0, 4)).equals("0703") && (!supervisionCont.getContNo().substring(0, 6).equals("070301")) && (!supervisionCont.getContNo().substring(0, 6).equals("070303")) && (!supervisionCont.getContNo().equals("07030405")) && (!(supervisionCont.getContNo().substring(0, 6).equals("070305")))) {
                            contText = supervisionCont.getContText();
                            String daan = "";
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                        daan = qa.getVal1().toString();
                                    }
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    } else if (superviseForm.getCompType().substring(0, 2).equals("06")) {
                        if ((supervisionCont.getContNo().substring(0, 4)).equals("0703") && (!supervisionCont.getContNo().equals("07030305")) && (!supervisionCont.getContNo().equals("07030306"))) {
                            contText = supervisionCont.getContText();
                            String daan = "";
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                        daan = qa.getVal1().toString();
                                    }
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    } else if (superviseForm.getCompType().substring(0, 2).equals("08")) {
                        if ((supervisionCont.getContNo().substring(0, 4)).equals("0703") && (!supervisionCont.getContNo().substring(0, 6).equals("070301")) && (!supervisionCont.getContNo().substring(0, 6).equals("070303"))) {
                            contText = supervisionCont.getContText();
                            String daan = "";
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                        daan = qa.getVal1().toString();
                                    }
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    }
                } else if (superviseForm.getSpecCode().equals("08")) {
                    if (speCode2.substring(0, 2).equals("08")) {
                        if ((supervisionCont.getContNo().substring(0, 2)).equals("08")) {
                            contText = supervisionCont.getContText();
                            String daan = "";
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                        daan = qa.getVal1().toString();
                                    }
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    }
                } else if (superviseForm.getSpecCode().equals("09")) {
                    if (speCode2.substring(0, 2).equals("09")) {
                        if ((supervisionCont.getContNo().substring(0, 2)).equals("09")) {
                            contText = supervisionCont.getContText();
                            String daan = "";
                            for (int ds = 0; ds < ansList.size(); ds++) {
                                // 循环答案选项
                                SupervisionCont qa = (SupervisionCont) ansList.get(ds);
                                if ((supervisionCont.getId()).equals(qa.getContId()) && speCode2.equals(qa.getSupervSpecCode())) {
                                    an = qa.getContResult().toString();
                                    if (qa.getVal1() != null && qa.getVal1().toString() != "") {
                                        daan = qa.getVal1().toString();
                                    }
                                    break;
                                }
                            }
                            String isBig = supervisionCont.getIsBig() + "";
                            String contNo = supervisionCont.getContNo();
                            questionValue = keyToValue(an.trim(), isBig, an1, an2, an3, contNo, "");
                            i1++;
                            mapResult.add(new TestBean(isBig, contText + "", questionValue));
                        }
                    }
                }
                String types = superviseForm.getChecktabletype() + "";
                String tab = superviseForm.getCheckTableId() + "";
                String sstr = "";
                if (types != null && tab != null) {
                    if (types.length() > 0 && tab.length() > 0) {
                        String[] typeNums = types.split(",");
                        String[] tabs = tab.split(",");
                        for (int i0 = 0; i0 < typeNums.length; i0++) {
                            if (speCode2.equals(typeNums[i0])) {
                                sstr = sstr + tabs[i0] + ",";
                            } else if (typeNums[i0].substring(0, 2).equals("01")) {
                                sstr = sstr + tabs[i0] + ",";
                            }
                        }
                    }
                }
                if (sstr.length() > 0) {
                    LogUtils.warnInfo(new Gson().toJson(sstr));
                }
            }
            String s = new Gson().toJson(mapResult);
            LogUtils.warnInfo(s);
            return mapResult;
        }
    }
    return null;
}
Also used : DictSupervisionCont(com.mtm.mrecord.mvp.model.entity.DictSupervisionCont) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) SuperviseContentGsonBean(com.mtm.mrecord.mvp.model.entity.SuperviseContentGsonBean) DictSupervisionCont(com.mtm.mrecord.mvp.model.entity.DictSupervisionCont) SupervisionCont(com.mtm.mrecord.mvp.model.entity.SupervisionCont) TestBean(com.mtm.mrecord.mvp.model.entity.TestBean) RadiationEqui(com.mtm.mrecord.mvp.model.entity.RadiationEqui)

Example 2 with SuperviseContentGsonBean

use of com.mtm.mrecord.mvp.model.entity.SuperviseContentGsonBean in project Mvp-Rxjava-Retrofit-dagger2 by pengMaster.

the class RecordSuperviseListPresenter method downLoadSuperviseRecordBaseInfo.

/**
 * 下载监督记录基本信息
 *
 * @param id
 */
public void downLoadSuperviseRecordBaseInfo(final String id) {
    Observable<SuperviseContentGsonBean> superviseContent = mModel.getSuperviseContentNet(id);
    Observable<superviseForm> recordBaseInfo = mModel.getRecordBaseInfo(id);
    Observable<LawDocumentGsonBean> lawFileNet = mModel.getLawFileNet(id);
    Observable.zip(recordBaseInfo, superviseContent, lawFileNet, new Function3<superviseForm, SuperviseContentGsonBean, LawDocumentGsonBean, RecordBaseGsonBean>() {

        @Override
        public RecordBaseGsonBean apply(@NonNull superviseForm superviseForm, @NonNull SuperviseContentGsonBean categoryResult, @NonNull LawDocumentGsonBean lawDocumentGsonBean) throws Exception {
            // 合并两次请求的结果
            RecordBaseGsonBean baseGsonBean = new RecordBaseGsonBean();
            baseGsonBean.setSuperviseForm(superviseForm);
            baseGsonBean.setCategoryResult(categoryResult);
            baseGsonBean.setLawDocumentGsonBean(lawDocumentGsonBean);
            baseGsonBean.setId(id);
            return baseGsonBean;
        }
    }).subscribeOn(Schedulers.io()).doOnSubscribe(new // 在执行任务前,做准备操作
    Consumer<Disposable>() {

        @Override
        public void accept(Disposable disposable) throws Exception {
            // 在执行任务之前 do some thing ...
            mRootView.showLoading();
        }
    }).observeOn(AndroidSchedulers.mainThread()).doFinally(new // 任务结束 do some thing ...
    Action() {

        @Override
        public void run() throws Exception {
            mRootView.hideLoading();
        }
    }).subscribe(new Consumer<RecordBaseGsonBean>() {

        @Override
        public void accept(@NonNull RecordBaseGsonBean recordBaseGsonBean) throws Exception {
            mRootView.hideLoading();
            mRootView.startActivity(recordBaseGsonBean);
        }
    }, new Consumer<Throwable>() {

        @Override
        public void accept(@NonNull Throwable throwable) throws Exception {
            ToastUtils.showShort(throwable.getMessage());
        }
    });
}
Also used : Disposable(io.reactivex.disposables.Disposable) Action(io.reactivex.functions.Action) Function3(io.reactivex.functions.Function3) SuperviseContentGsonBean(com.mtm.mrecord.mvp.model.entity.SuperviseContentGsonBean) com.mtm.mrecord.mvp.model.entity.superviseForm(com.mtm.mrecord.mvp.model.entity.superviseForm) Consumer(io.reactivex.functions.Consumer) NonNull(io.reactivex.annotations.NonNull) LawDocumentGsonBean(com.mtm.mrecord.mvp.model.entity.LawDocumentGsonBean) RecordBaseGsonBean(com.mtm.mrecord.mvp.model.entity.RecordBaseGsonBean)

Aggregations

SuperviseContentGsonBean (com.mtm.mrecord.mvp.model.entity.SuperviseContentGsonBean)2 Gson (com.google.gson.Gson)1 DictSupervisionCont (com.mtm.mrecord.mvp.model.entity.DictSupervisionCont)1 LawDocumentGsonBean (com.mtm.mrecord.mvp.model.entity.LawDocumentGsonBean)1 RadiationEqui (com.mtm.mrecord.mvp.model.entity.RadiationEqui)1 RecordBaseGsonBean (com.mtm.mrecord.mvp.model.entity.RecordBaseGsonBean)1 SupervisionCont (com.mtm.mrecord.mvp.model.entity.SupervisionCont)1 TestBean (com.mtm.mrecord.mvp.model.entity.TestBean)1 com.mtm.mrecord.mvp.model.entity.superviseForm (com.mtm.mrecord.mvp.model.entity.superviseForm)1 NonNull (io.reactivex.annotations.NonNull)1 Disposable (io.reactivex.disposables.Disposable)1 Action (io.reactivex.functions.Action)1 Consumer (io.reactivex.functions.Consumer)1 Function3 (io.reactivex.functions.Function3)1 ArrayList (java.util.ArrayList)1