Package clips.delegate.directory.simple.insurer

Examples of clips.delegate.directory.simple.insurer.DirectoryInsurerItem


            PanelUserSearch panel = new PanelUserSearch(dialog, PanelUserSearch.MODE_MULTISELECT);
            dialog.addNewPage((PageGeneric) panel, null);
            dialog.setVisible(true);
            if(dialog.getDlgResult() == ModalDialog.DLG_OK) {
                ArrayList<ClientLocal> clientList = panel.getSelectedClientList();
                DirectoryInsurerItem insItem;
                if (polisList.size() > 0) {
                    insItem = polisList.get(0).getInsurer();
                }
                else {
                    insItem = UserInfo.get().getCollaborator().getLpu().getDefaultInsurer();
View Full Code Here


        try {
            PolisData polisData = polisList.get(r);
            switch (c) {
                case COL_INSURER: {
                    //страховая компания
                    DirectoryInsurerItem insurer = polisData.getInsurer();
                    if (insurer != null) {
                        return insurer;
                    } else {
                        return "";
                    }
View Full Code Here

                if (dbfDop.deleted()) {
                    continue;
                }
                Integer lnumber = Integer.parseInt(fieldsDop.get(ColDop.LNUMBER).get().trim());
                String insOrg = fieldsDop.get(ColDop.INSUR_ORG).get().trim();
                DirectoryInsurerItem item = dirInsurer.getItemFromTitle(insOrg);
                if (insOrg.isEmpty()) {
                    out.println("Предупреждение : Дополнительный полис не принят " + dbfDop.getName() +
                            " строка " + counter + " причина : insOrg.isEmpty");
                    counter ++;
                    continue;
                }
                if (item == null) {
                    DirectoryItemDetails d = new DirectoryItemDetails(insOrg);
                    d.dirty = true;
                    item = new DirectoryInsurerItem(d);
                    dirInsurer.getItems().append(item);
                }
                dopIns.put(lnumber, item);
            } catch (IOException ex) {
                closeDBF(dbfDop);
                throw new ClipsException("Ошибка при чтении данных из файла " + dbfDop.getName() + " (строка " + i + ")", ex);
            } catch (xBaseJException ex) {
                closeDBF(dbfDop);
                throw new ClipsException("Ошибка при чтении данных из файла " + dbfDop.getName() + " (строка " + i + ")", ex);
            }
            counter ++;
        }
        closeDBF(dbfDop);
        System.out.println("Прочитано " + dopIns.size() + " дополнительных полисов");
        out.println("Прочитано " + dopIns.size() + " дополнительных полисов");





        //Чтение мест работы
        File fileJob = new File(cfg.getLastDBFImportPath(), "S_WORK.DBF");
        DBF dbfJob = createDBF(fileJob);
        System.out.println("Чтение мест работы");
        out.println("Чтение мест работы");
        //хеш ID, NAME организации
        HashMap<String, String> jobMap = new HashMap<String, String>();
        HashMap<ColJob, Field> fieldsJob = new HashMap<ColJob, Field>();
        try {
            for (int i = 0; i < ColJob.values().length; i++) {
                ColJob col = ColJob.values()[i];
                fieldsJob.put(col, dbfJob.getField(col.toString()));
            }
        } catch (xBaseJException ex) {
            throw new ClipsException("Ошибка при чтении данных из файла " + dbfJob.getName(), ex);
        }
        recordCount = dbfJob.getRecordCount();
        counter = 0;
        for (int i = 0; i < recordCount; i++) {
            try {
                dbfJob.read();
                if (dbfJob.deleted()) {
                    continue;
                }
                String id = fieldsJob.get(ColJob.ID).get().trim();
                String name = fieldsJob.get(ColJob.NAME).get().trim();
                if (name.isEmpty()) {
                    out.println("Предупреждение : место работы не принято " + dbfJob.getName() +
                            " ID " + id + " причина : NAME.isEmpty");
                    counter ++;
                    continue;
                }
                jobMap.put(id, name);
            } catch (IOException ex) {
                closeDBF(dbfJob);
                throw new ClipsException("Ошибка при чтении данных из файла " + dbfJob.getName() + " (строка " + i + ")", ex);
            } catch (xBaseJException ex) {
                closeDBF(dbfJob);
                throw new ClipsException("Ошибка при чтении данных из файла " + dbfJob.getName() + " (строка " + i + ")", ex);
            }
            counter ++;
        }
        closeDBF(dbfJob);
        System.out.println("Прочитано " + jobMap.size() + " мест работы");
        out.println("Прочитано " + jobMap.size() + " мест работы");


        //Чтение статталонов - составление белого списка
        System.out.println("Чтение статталонов - составление белого списка пациентов");
        out.println("Чтение статталонов - составление белого списка пациентов");
        File fileSST = new File(cfg.getLastDBFImportPath(), "stat_tal.dbf");
        DBF dbfSST = createDBF(fileSST);
        HashMap<ColSst, Field> fieldsSst = new HashMap<ColSst, Field>();
        try {
            for (int i = 0; i < ColSst.values().length; i++) {
                ColSst col = ColSst.values()[i];
                fieldsSst.put(col, dbfSST.getField(col.toString()));
            }
        } catch (xBaseJException ex) {
            throw new ClipsException("Ошибка при чтении данных из файла " + dbfSST.getName(), ex);
        }
        int counterSst = 0;
        HashSet<Integer> whiteList = new HashSet<Integer>();
        recordCount = dbfSST.getRecordCount();
        for (int i = 0; i < recordCount; i++) {
            try {
                dbfSST.read();
                if (dbfSST.deleted()) {
                    continue;
                }
                if (fieldsSst.get(ColSst.LNUMBER).get().trim().isEmpty()) {
                    counterSst ++;
                    continue;
                }
                whiteList.add(Integer.parseInt(fieldsSst.get(ColSst.LNUMBER).get().trim()));
            } catch (IOException ex) {
                closeDBF(dbfSST);
                throw new ClipsException("Ошибка при чтении данных из файла " + dbfSST.getName() + " (строка " + counterSst + ")", ex);
            } catch (xBaseJException ex) {
                closeDBF(dbfSST);
                throw new ClipsException("Ошибка при чтении данных из файла " + dbfSST.getName() + " (строка " + counterSst + ")", ex);
            } catch (NumberFormatException ex) {
                closeDBF(dbfSST);
                throw new ClipsException("Ошибка при чтении данных из файла " + dbfSST.getName() + " (строка " + counterSst + ")", ex);
            }
        }
        System.out.println("Чтение статталонов - завершено");

        //Чтение основных данных
        File file = new File(cfg.getLastDBFImportPath(),getFilename());
        DBF dbf = createDBF(file);
        HashMap<Col, Field> fields = new HashMap<Col, Field>();
        try {
            for (int i = 0; i < Col.values().length; i++) {
                Col col = Col.values()[i];
                fields.put(col, dbf.getField(col.toString()));
            }
        } catch (xBaseJException ex) {
            throw new ClipsException("Ошибка при чтении данных из файла " + dbf.getName(), ex);
        }
        recordCount = dbf.getRecordCount();

        System.out.println("Загрузка фамилий, имен, отчеств, профессий и терапевтических участков");
        out.println("Загрузка фамилий, имен, отчеств, профессий и терапевтических участков");
        HashSet<String> famList = new HashSet<String>(recordCount);
        HashSet<String> namList = new HashSet<String>(recordCount);
        HashSet<String> patronList = new HashSet<String>(recordCount);
        HashSet<String> profList = new HashSet<String>();
        HashSet<String> districtList = new HashSet<String>();
        for (int i = 0; i < recordCount; i++) {
            try {
                dbf.read();
                famList.add(Converter.firstUpper(fields.get(Col.FAMILY).get().trim(), true));
                namList.add(Converter.firstUpper(fields.get(Col.NAME).get().trim(), true));
                patronList.add(Converter.firstUpper(fields.get(Col.FATHER).get().trim(), true));
                profList.add(Converter.firstUpper(fields.get(Col.PROF).get().trim(), false));
                String uch = fields.get(Col.UCH).get().trim();
                if (!uch.isEmpty() && !uch.equals("0")) {
                    districtList.add(fields.get(Col.UCH).get().trim());
                }
            } catch (IOException ex) {
                closeDBF(dbf);
                throw new ClipsException("Ошибка при чтении данных из файла " + dbf.getName() + " (строка " + i + ")", ex);
            } catch (xBaseJException ex) {
                closeDBF(dbf);
                throw new ClipsException("Ошибка при чтении данных из файла " + dbf.getName() + " (строка " + i + ")", ex);
            }
        }
        bean.get().updateSurnames(famList);
        dirSurname = DirectoryLocator.getDirectory(DirectorySurname.class, true);
        System.out.println("Фамилии загружены");
        out.println("Фамилии загружены");
        bean.get().updateNames(namList);
        dirName = DirectoryLocator.getDirectory(DirectoryName.class, true);
        System.out.println("Имена загружены");
        out.println("Имена загружены");
        bean.get().updatePatrons(patronList);
        dirPathron = DirectoryLocator.getDirectory(DirectoryPathron.class, true);
        System.out.println("Отчества загружены");
        out.println("Отчества загружены");
        bean.get().updateAppointments(profList);
        dirApp = DirectoryLocator.getDirectory(DirectoryAppointment.class, true);
        System.out.println("Профессии загружены");
        out.println("Профессии загружены");
        bean.get().updateDistricts(districtList);
        dirDistrict = DirectoryLocator.getDirectory(DirectoryDistrict.class, true);
        System.out.println("Терапевтические участки загружены");
        out.println("Терапевтические участки загружены");

        dirRegionIdCode = DirectoryLocator.getDirectory(DirectoryRegionIdCode.class, true);
        dirSocialStatus = DirectoryLocator.getDirectory(DirectorySocialStatus.class, true);
        dirDocumentType = DirectoryLocator.getDirectory(DirectoryDocumentType.class, true);
        dirKladr = DirectoryLocator.getDirectory(DirectoryKladr.class);
        dirKladrType= DirectoryLocator.getDirectory(DirectoryKladrType.class);
        STREET = dirKladrType.getItemFromTitle("Улица");
        PER = dirKladrType.getItemFromTitle("Переулок");

        GregorianCalendar gc1 = new GregorianCalendar();
        try {
            dbf.startTop();
        } catch (IOException ex) {
            throw new ClipsException("Ошибка при чтении данных из файла " + dbf.getName(), ex);
        } catch (xBaseJException ex) {
            throw new ClipsException("Ошибка при чтении данных из файла " + dbf.getName(), ex);
        }
        HashSet<String> setNumAmbk = new HashSet<String>();
        bean.get().setUseStaticMap(true);
        counter = 0;
        ArrayList<ClientChunk> clientChunks = new ArrayList<ClientChunk>(recordCount);
        for (int i = 0; i < recordCount; i++) {
            try {
                dbf.read();
                if ((i%1000) == 0) {
                    System.out.println("Обновление пациентов : " +  i/((float)recordCount)*100 + "% (" + i + ") запись");
                    GregorianCalendar gc2 = new GregorianCalendar();
                    long mc = gc2.getTimeInMillis() - gc1.getTimeInMillis();
                    System.out.println("Work time: " + mc + " ms");
                }
                if (dbf.deleted()) {
                    continue;
                }
                ClientChunk c = new ClientChunk();
                c.lnumber = Integer.parseInt(fields.get(Col.LNUMBER).get().trim());
                c.numambk = fields.get(Col.NUM_AMB_K).get().trim();
                //Уникальность номеров карт
                if (!c.numambk.isEmpty() && setNumAmbk.contains(c.numambk)) {
                    char ch = 'А';
                    while (setNumAmbk.contains(c.numambk + ch)) {
                        ch++;
                    }
                    c.numambk = c.numambk + ch;
                }
                /*if (!dopIns.containsKey(c.lnumber)) { всосал только некоторых для тестирования
                    continue;
                }*/
                /*if (c.lnumber != 50421) {
                    continue;
                }*/

                c.errDat = fields.get(Col.ERR_DAT).get().trim();
                c.famID = dirSurname.getItemFromTitle(Converter.firstUpper(fields.get(Col.FAMILY).get().trim(), true)).getID();
                c.nameID = dirName.getItemFromTitle(Converter.firstUpper(fields.get(Col.NAME).get().trim(), true)).getID();
                c.patronID = dirPathron.getItemFromTitle(Converter.firstUpper(fields.get(Col.FATHER).get().trim(), true)).getID();
                String sex = fields.get(Col.SEX).get().trim();
                if (sex.toUpperCase().equals("М")) {
                    c.sexID = Sex.CLIENT_SEX_MALE;
                } else if (sex.toUpperCase().equals("Ж")) {
                    c.sexID = Sex.CLIENT_SEX_FEMALE;
                } else {
                    System.out.println("У пациента неопределен пол. " + dbf.getName() + " lnum=(" + c.lnumber + ")");
                    out.println("Предупреждение : У пациента неопределен пол. " + dbf.getName() + " lnum=(" + c.lnumber + ")");
                    c.sexID = Sex.CLIENT_SEX_MALE;
                    String fam = fields.get(Col.FAMILY).get().trim();
                    if (fam.endsWith("а")) {
                        c.sexID = Sex.CLIENT_SEX_FEMALE;
                    } else {
                        String nam = fields.get(Col.FAMILY).get().trim();
                        if (nam.endsWith("а") || nam.endsWith("я")) {
                            c.sexID = Sex.CLIENT_SEX_FEMALE;
                        }
                    }
                    out.println("Пол выставлен : " + (c.sexID == Sex.CLIENT_SEX_MALE ? "Муж." : "Жен."));
                }
                c.dateBorn = null;
                try {
                    Calendar bornDate = ((DateField)fields.get(Col.BITHDATE)).getCalendar();
                    bornDate.set(Calendar.HOUR_OF_DAY, 0);
                    bornDate.set(Calendar.MINUTE, 0);
                    bornDate.set(Calendar.SECOND, 0);
                    bornDate.set(Calendar.MILLISECOND, 0);
                    c.dateBorn = bornDate.getTime();
                } catch (NumberFormatException ex) {
                    System.out.println("Предупреждение : Дата рождения пациента некорректна " + dbf.getName() + " lnum=(" + c.lnumber + ")");
                    out.println("Предупреждение : Дата рождения пациента некорректна " + dbf.getName() + " lnum=(" + c.lnumber + ")");
                }
                String insurAreaExtKey = fields.get(Col.INSUR_AREA).get().trim();
                DirectorySimpleItem area = dirRegionIdCode.getItemFromExtKey(insurAreaExtKey);
                c.insurAreaID = area == null ? 0 : area.getID();

                /* Если страховая компания местная то приоритетным полем
                 является INSUR_ORG, если не местная то приоритетной
                 является запись в KADR_DOP */
                DirectoryInsurerItem insPrior;
                DirectoryInsurerItem ins;
                if (insurAreaExtKey.equals("61")) {
                    insPrior = dirInsurer.getItemFromExtKey(fields.get(Col.INSUR_ORG).get().trim());
                    ins = dopIns.get(c.lnumber);
                } else {
                    ins = dirInsurer.getItemFromExtKey(fields.get(Col.INSUR_ORG).get().trim());
                    insPrior = dopIns.get(c.lnumber);
                }
                if (insPrior != null) {
                    c.insurOrgID = insPrior.getID();
                } else if (ins != null) {
                    c.insurOrgID = ins.getID();
                } else {
                    c.insurOrgID = 0;
                }
                String klRegion = fields.get(Col.KLREGION).get().trim();
                String klItem = fields.get(Col.KLITEM).get().trim();
View Full Code Here

    public CertTagPolisInsurer(CertificateLocal certificateLocal, ReportParam reportParam, DiseaseLocal diseaseLocal) throws ClipsException {
        super(certificateLocal, reportParam, diseaseLocal);
        if (certificateLocal.isNewlyCreated()) {
            PolisData polisOMS = certificateLocal.getClientLocal().getPolisOMS();
            if (polisOMS != null) {
               DirectoryInsurerItem ins = polisOMS.getInsurer();
               if (ins != null && ins.getID() != 0) {
                   setText(ins.getTitle(), true);
               }
               else {
                   setText("", true);
               }
            }
View Full Code Here

            }

        };
        PolisData polisOMS = emc.getClient().getPolisOMS();

        DirectoryInsurerItem insurer = null;
        String polis = "";
        if (polisOMS != null) {
            insurer = polisOMS.getInsurer();
            if (polisOMS.getSeries() != null) {
                polis += polisOMS.getSeries() + " ";
            }
            if (polisOMS.getNumber() != null) {
                polis += polisOMS.getNumber();
            }
        }
        String insurerT = "";
        if (insurer != null && insurer.getID() != 0) {
            insurerT = insurer.getTitle();
        }
        String polisInfo = polis + " " + insurerT;
        if (polisOMS != null) {
            if (polisOMS.getTillDate() == null) {
                jLabelPolis.setText(polisInfo + " (Не указан срок действия)");
View Full Code Here

                    }
                }

                //INS_ORG
                String arExtKey = dirRegCode.getItemFromID(data.ins_id_ar).getExtKey();
                DirectoryInsurerItem insurer = dirInsurer.getItemFromID(data.id_ins_org);
                if (!arExtKey.equals(RegisterBean.REGION_CODE) && !insurer.getExtKey().isEmpty()) {
                    lf.ins_org.put(id, target, "");
                } else if (data.pol_num.isEmpty() && insurer.getExtKey() != null && !insurer.getExtKey().isEmpty()) {
                    lf.ins_org.put(id, target, "");
                } else {
                    lf.ins_org.put(id, target, insurer.getTitle());
                }

                if (!arExtKey.equals(RegisterBean.REGION_CODE)
                        && lf.ins_org.get().trim().isEmpty()) {
                    target.add(id, "Для инотерриториального больного не указан филиал ФОМС", ErrorList.CLIENT_ERROR);
                }

                //INS_ID
                try {
                    String extKey = insurer.getExtKey();
                    if (!arExtKey.equals(RegisterBean.REGION_CODE) && !insurer.getExtKey().isEmpty()) {
                        lf.ins_id.put("");
                    } else if (data.pol_num.isEmpty() && extKey != null && !extKey.isEmpty()) {
                        lf.ins_id.put("0");
                    } else if (extKey == null || extKey.isEmpty()) {
                        lf.ins_id.put("");
View Full Code Here

    }

    @Override
    boolean needWrite(RegisterData data) {
        try {
            DirectoryInsurerItem insurer = dirInsurer.getItemFromID(data.id_ins_org);
            return insurer.getID() == 0;
        } catch (DirectoryItemNotFoundException ex) {
            return false;
        }
    }
View Full Code Here

    }

    @Override
    boolean needWrite(RegisterData data) {
        try {
            DirectoryInsurerItem insurer = dirInsurer.getItemFromID(data.id_ins_org);
            return insurer.getExtKey().equals(codes);
        } catch (DirectoryItemNotFoundException ex) {
            return false;
        }
    }
View Full Code Here

    }

    @Override
    public String getSmoName() throws ClipsException {
            dirInsurer = DirectoryLocator.getDirectory(DirectoryInsurer.class);
            DirectoryInsurerItem item = dirInsurer.getItemFromExtKey(codes);
            if (item != null) {
                return item.getTitle();
            } else {
                throw new ClipsException("Неизвестная страховая компания: code = " + code);
            }
    }
View Full Code Here

        dispose();
    }//GEN-LAST:event_btUpdateActionPerformed

    private void btFormalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btFormalActionPerformed
        try {
            DirectoryInsurerItem defaultInsurer = UserInfo.get().getCollaborator().getLpu().getDefaultInsurer();
            DirectoryRegionIdCodeItem configRegionCode = ConfigLocal.getInstance().getConfigRegionCode();
            cbInsurer.setSelectedItem(defaultInsurer);
            cbRegion.setSelectedItem(configRegionCode);
            tfSeries.setText("");
            tfNumber.setText(Polis.FICTIVE_POLIS_NUMBER);
View Full Code Here

TOP

Related Classes of clips.delegate.directory.simple.insurer.DirectoryInsurerItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.