/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* DialogQuickInput.java
*
* Created on 15.06.2009, 10:48:45
*/
package clips.doctor;
import beans.service.quickInput.QuickInputBean;
import beans.service.quickInput.QuickInputBeanRemote;
import beans.service.quickInput.QuickInputChunk;
import cli_fmw.delegate.SharedBean;
import cli_fmw.delegate.directory.complex.DirectoryLocator;
import cli_fmw.delegate.utils.TimeLocal;
import cli_fmw.main.ClipsException;
import cli_fmw.main.ContentStateListener;
import cli_fmw.report.panels.model.TextFieldModel;
import cli_fmw.report.panels.model.delegate.DelegateComboboxModel;
import cli_fmw.utils.DefaultColors;
import cli_fmw.utils.MessageBox;
import cli_fmw.utils.ModalDialog;
import cli_fmw.utils.SelectorEditableExceptional;
import cli_fmw.utils.table_config_states.StateSaver;
import clips.delegate.config.ConfigLocal;
import clips.delegate.contract.PolisData;
import clips.delegate.directory.complex.DirectoryCollaboratorFunctions;
import clips.delegate.directory.complex.DirectoryCollaboratorFunctionsItem;
import clips.delegate.directory.complex.DirectoryMKB10;
import clips.delegate.directory.filtered.DirectoryService;
import clips.delegate.directory.filtered.DirectoryServiceItem;
import clips.delegate.directory.ro.DirectoryCollaborator;
import clips.delegate.directory.ro.DirectoryCollaboratorItem;
import clips.delegate.directory.ro.DirectoryLpuItem;
import clips.delegate.directory.simple.diagnosisEncounter.DirectoryDiagnosisEncounter;
import clips.delegate.directory.simple.diagnosisEncounter.DirectoryDiagnosisEncounterItem;
import clips.delegate.directory.simple.diagnosisType.DirectoryDiagnosisType;
import clips.delegate.directory.simple.diagnosisType.DirectoryDiagnosisTypeItem;
import clips.delegate.directory.simple.diseaseResult.DirectoryDiseaseResult;
import clips.delegate.directory.simple.diseaseResult.DirectoryDiseaseResultItem;
import clips.delegate.directory.simple.insurer.DirectoryInsurerItem;
import clips.delegate.directory.simple.servicingPlace.DirectoryServicingPlace;
import clips.delegate.directory.simple.servicingPlace.DirectoryServicingPlaceItem;
import clips.delegate.directory.simple.visitingPurpose.DirectoryVisitingPurpose;
import clips.delegate.directory.simple.visitingPurpose.DirectoryVisitingPurposeItem;
import clips.delegate.doctor.DiseaseLocal;
import clips.delegate.doctor.EmcLocal;
import clips.delegate.doctor.diagnosis.DiagnosisLocal;
import clips.login.UserInfo;
import beans.directory.service.entity.ServiceGroup;
import beans.service.quickInput.DiagnosChunk;
import beans.service.quickInput.DisSerDiagAuditChunk;
import cli_fmw.main.CheckableDocListener;
import cli_fmw.main.audit.AuditManager;
import clips.delegate.directory.simple.traumaType.DirectoryTraumaType;
import clips.delegate.directory.simple.traumaType.DirectoryTraumaTypeItem;
import framework.utils.FormatChecker;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import org.infotechservice.ICalendar.DateEvent;
import org.infotechservice.ICalendar.DateListener;
/**
*
* @author vip
*/
public class DialogQuickInput extends ModalDialog {
private SharedBean<QuickInputBeanRemote> bean =
new SharedBean<QuickInputBeanRemote>(QuickInputBean.class.getSimpleName());
private EmcLocal emc;
private List<DiseaseLocal> diseaseList;
private HashMap<String, DirectoryServiceItem> serviceMap;
private ArrayList<DirectoryServiceItem> serviceList;
private HashMap<String, DCFI> collFuncMap;
private ArrayList<DCFI> collFuncList;
private DiseaseLocal disease;
//Заболевание
private DiseaseLocal selectedDisease;
//private DirectoryCollaboratorItem selectedDisColl;
private DirectoryVisitingPurposeItem selectedPurpose;
private DirectoryDiseaseResultItem selectedResult;
//Услуга (посещение)
private Date selectedDate;
private DirectoryCollaboratorItem selectedColl;
private DirectoryServiceItem selectedService;
private String inputedServCode;
private DCFI selectedCollFunc;
private String inputedSpecCode;
private DirectoryServicingPlaceItem selectedPlace;
//Диагноз
private DirectoryDiagnosisTypeItem selectedDiagType;
private DirectoryDiagnosisEncounterItem selectedEncounter;
private DelegateComboboxModel modelDisease;
//private DelegateComboboxModel modelDisCollab;
private DelegateComboboxModel modelPurpose;
private DelegateComboboxModel modelResult;
private DelegateComboboxModel modelCollab;
private DelegateComboboxModel modelService;
private TextFieldModel modelServiceCode;
private DelegateComboboxModel modelCollFunc;
private TextFieldModel modelSpecCode;
private DelegateComboboxModel modelPlace;
private DelegateComboboxModel modelDiagType;
private DelegateComboboxModel modelEncounter;
private DirectoryTraumaType dirTrauma;
private DirectoryTraumaTypeItem selectedTrauma;
private DirectoryCollaborator dirColl;
private DirectoryVisitingPurpose dirPurpose;
private DirectoryDiseaseResult dirResult;
private DirectoryService dirService;
private DirectoryCollaboratorFunctions dirCollFunc;
private DirectoryServicingPlace dirPlace;
private DirectoryDiagnosisType dirDiagType;
private DirectoryDiagnosisEncounter dirEncounter;
private DirectoryMKB10 dirMkb;
private DisSerDiagAuditChunk result;
private String uet;
/** Creates new form DialogQuickInput */
public DialogQuickInput(Frame parent, EmcLocal emc, DiseaseLocal disease, AuditManager am) throws ClipsException {
super(parent, "Быстрый ввод данных", am);
initComponents();
this.emc = emc;
this.disease = disease;
dirColl = DirectoryLocator.getDirectory(DirectoryCollaborator.class);
dirPurpose = DirectoryLocator.getDirectory(DirectoryVisitingPurpose.class);
dirResult = DirectoryLocator.getDirectory(DirectoryDiseaseResult.class);
dirService = DirectoryLocator.getDirectory(DirectoryService.class);
dirCollFunc = DirectoryLocator.getDirectory(DirectoryCollaboratorFunctions.class);
dirPlace = DirectoryLocator.getDirectory(DirectoryServicingPlace.class);
dirDiagType = DirectoryLocator.getDirectory(DirectoryDiagnosisType.class);
dirEncounter = DirectoryLocator.getDirectory(DirectoryDiagnosisEncounter.class);
dirMkb = DirectoryLocator.getDirectory(DirectoryMKB10.class);
dirTrauma = DirectoryLocator.getDirectory(DirectoryTraumaType.class);
initDiseasePanel();
initSerrenPanel();
initDiagnosisPanel();
//после подготовки всех панелей выставим текущее заболевание
modelDisease.setSelectedItemImp(selectedDisease);
StateSaver.attachTo(this);
}
private void initDiseasePanel() throws ClipsException {
List<DiseaseLocal> dList = emc.getDiseaseList();
diseaseList = new ArrayList<DiseaseLocal>();
selectedDisease = new DiseaseLocal(emc);
diseaseList.add(selectedDisease);
for (DiseaseLocal diseaseLocal : dList) {
if (diseaseLocal.getClosed() == null
&& !diseaseLocal.isProfcheckup()
&& !diseaseLocal.isMedexam()) {
diseaseList.add(diseaseLocal);
if (disease != null && diseaseLocal.getID() == disease.getID()) {
selectedDisease = diseaseLocal;
}
}
}
Collections.sort(diseaseList, new Comparator<DiseaseLocal>() {
@Override
public int compare(DiseaseLocal o1, DiseaseLocal o2) {
try {
if (o1.getCreated() == null || o2.getCreated() == null) {
return 0;
}
return -o1.getCreated().compareTo(o2.getCreated());
} catch (ClipsException ex) {
return 0;
}
}
});
modelDisease = new DelegateComboboxModel(jComboDisease, false) {
@Override
public boolean isSelectionVisible() {
return true;
}
@Override
public Object getElementAtImp(int index) throws ClipsException {
return diseaseList.get(index);
}
@Override
public int getSizeImp() throws ClipsException {
return diseaseList.size();
}
@Override
public Object getSelectedItemImp() throws ClipsException {
return selectedDisease;
}
@Override
public void setSelectedItemImp(Object anItem) throws ClipsException {
selectedDisease = (DiseaseLocal) anItem;
try {
if (selectedDisease.getID() != 0) {
jComboPurpose.setSelectedItem(selectedDisease.getVisitingPurpose());
}
//панель диагноза привести в соответствие
resetDiagnosysPanel();
} catch (ClipsException ex) {
//Всеголишь запрос данных для автозаполнения
ex.printStackTrace();
}
}
};
/*selectedDisColl = UserInfo.get().getCollaborator();
modelDisCollab = new DelegateComboboxModel(jComboDisCollab, false) {
@Override
public boolean isSelectionVisible(){
return true;
}
@Override
public Object getElementAtImp(int index) throws ClipsException {
return dirColl.getItems().get(index);
}
@Override
public int getSizeImp() throws ClipsException {
return dirColl.getItems().size();
}
@Override
public Object getSelectedItemImp() throws ClipsException {
return selectedDisColl;
}
@Override
public void setSelectedItemImp(Object anItem) throws ClipsException {
selectedDisColl = (DirectoryCollaboratorItem) anItem;
}
};*/
for (int i = 0; i < dirPurpose.getItems().size(); i++) {
DirectoryVisitingPurposeItem item = dirPurpose.getItems().get(i);
if (item.getTitle().trim().toUpperCase().startsWith("ЗАБОЛ")) {
selectedPurpose = item;
break;
}
}
modelPurpose = new DelegateComboboxModel(jComboPurpose, false) {
@Override
public boolean isSelectionVisible(){
return true;
}
@Override
public Object getElementAtImp(int index) throws ClipsException {
return dirPurpose.getItems().get(index);
}
@Override
public int getSizeImp() throws ClipsException {
return dirPurpose.getItems().size();
}
@Override
public Object getSelectedItemImp() throws ClipsException {
return selectedPurpose;
}
@Override
public void setSelectedItemImp(Object anItem) throws ClipsException {
selectedPurpose = (DirectoryVisitingPurposeItem) anItem;
}
};
modelResult = new DelegateComboboxModel(jComboResult, false) {
@Override
public boolean isSelectionVisible(){
return true;
}
@Override
public Object getElementAtImp(int index) throws ClipsException {
return dirResult.getItems().get(index);
}
@Override
public int getSizeImp() throws ClipsException {
return dirResult.getItems().size();
}
@Override
public Object getSelectedItemImp() throws ClipsException {
return selectedResult;
}
@Override
public void setSelectedItemImp(Object anItem) throws ClipsException {
selectedResult = (DirectoryDiseaseResultItem) anItem;
}
};
}
private void initSerrenPanel() throws ClipsException {
//слушатель для датачузера даты посещения
selectedDate = TimeLocal.getCurrentTime().getTime();
//((JTextField)jDateSerren.getDateEditor()).setEditable(false);
jDateSerren.addDateListener(new DateListener() {
@Override
public void dateChanged(DateEvent event) {
if (!framework.utils.Comparator.dataEqual(event.getNewValue(), event.getOldValue())) {
selectedDate = event.getNewValue();
System.out.println("Selected date = " + selectedDate);
}
}
});
jDateSerren.setDate(selectedDate);
selectedColl = UserInfo.get().getCollaborator();
modelCollab = new DelegateComboboxModel(jComboCollab, false) {
@Override
public boolean isSelectionVisible(){
return true;
}
@Override
public Object getElementAtImp(int index) throws ClipsException {
DirectoryLpuItem lpu = UserInfo.get().getCollaborator().getLpu();
return dirColl.getItemsFiltered(lpu, true, false, UserInfo.get().canUseHiddenDirectoryItems()).get(index);
}
@Override
public int getSizeImp() throws ClipsException {
DirectoryLpuItem lpu = UserInfo.get().getCollaborator().getLpu();
return dirColl.getItemsFiltered(lpu, true, false, UserInfo.get().canUseHiddenDirectoryItems()).size();
}
@Override
public Object getSelectedItemImp() throws ClipsException {
return selectedColl;
}
@Override
public void setSelectedItemImp(Object anItem) throws ClipsException {
selectedColl = (DirectoryCollaboratorItem) anItem;
resetCollFuncList(selectedColl);
modelCollFunc.contentStateChanged();
modelSpecCode.contentStateChanged();
}
};
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 + " (Не указан срок действия)");
} else if (polisOMS.getTillDate().before(TimeLocal.getCurrentTime().getTime())) {
jLabelPolis.setText(polisInfo + " (Просрочен)");
jLabelPolis.setBackground(DefaultColors.TABLE_RED_FOREGROUND);
} else {
jLabelPolis.setText(polisInfo);
}
} else {
jLabelPolis.setText("Отсутствует");
jLabelPolis.setBackground(DefaultColors.TABLE_RED_FOREGROUND);
}
//код услуги и комбо с услугами
serviceMap = new HashMap<String, DirectoryServiceItem>();
serviceList = new ArrayList<DirectoryServiceItem>();
SelectorEditableExceptional<DirectoryServiceItem> servItems = dirService.getItems();
for (int i = 0; i < servItems.size(); i++) {
DirectoryServiceItem item = servItems.get(i);
if (item.getID() != 0 && !item.getCode().trim().isEmpty()
&& item.getGroup().getID() == ServiceGroup.SERVICE_GROUP_VISIT) {
serviceMap.put(item.getCode().trim(), item);
serviceList.add(item);
}
}
modelService = new DelegateComboboxModel(jComboService, false) {
@Override
public boolean isSelectionVisible(){
return true;
}
@Override
public Object getElementAtImp(int index) throws ClipsException {
return serviceList.get(index);
}
@Override
public int getSizeImp() throws ClipsException {
return serviceList.size();
}
@Override
public Object getSelectedItemImp() throws ClipsException {
return selectedService;
}
@Override
public void setSelectedItemImp(Object anItem) throws ClipsException {
selectedService = (DirectoryServiceItem) anItem;
if (selectedService == null || tfServiceCode.getText().equals(selectedService.getCode())) {
return;
}
inputedServCode = selectedService.getCode();
tfServiceCode.setText(inputedServCode);
}
};
modelServiceCode = new TextFieldModel(tfServiceCode) {
@Override
protected void setModelTextChecked(String text) throws ClipsException, ParseException, NumberFormatException {
selectedService = serviceMap.get(text);
jComboService.setSelectedItem(selectedService);
}
@Override
protected String getModelTextChecked() throws ClipsException {
return inputedServCode;
}
};
modelServiceCode.setModelText("");
//Код типа приема
resetCollFuncList(selectedColl);
modelCollFunc = new DelegateComboboxModel(jComboSpec, false) {
@Override
public boolean isSelectionVisible(){
return true;
}
@Override
public boolean isEnabled() {
return collFuncList.size() > 1;
}
@Override
public Object getElementAtImp(int index) throws ClipsException {
return collFuncList.get(index);
}
@Override
public int getSizeImp() throws ClipsException {
return collFuncList.size();
}
@Override
public Object getSelectedItemImp() throws ClipsException {
return selectedCollFunc;
}
@Override
public void setSelectedItemImp(Object anItem) throws ClipsException {
selectedCollFunc = (DCFI) anItem;
if (selectedCollFunc == null) {
jPanel2.remove(panUet);
tfUet.setText("1");
return;
}
inputedSpecCode = selectedCollFunc.getItem().getReceptionType().getExtKey();
if (!tfSpecCode.getText().equals(inputedSpecCode)) {
tfSpecCode.setText(inputedSpecCode);
}
if (inputedSpecCode.contains("29")) {
jPanel2.add(panUet, BorderLayout.SOUTH);
}
else {
jPanel2.remove(panUet);
tfUet.setText("1");
}
DialogQuickInput.this.validate();
DialogQuickInput.this.pack();
DialogQuickInput.this.repaint();
}
};
modelSpecCode = new TextFieldModel(tfSpecCode) {
@Override
protected boolean isEnabled() {
return collFuncList.size() > 1;
}
@Override
protected void setModelTextChecked(String text) throws ClipsException, ParseException, NumberFormatException {
selectedCollFunc = collFuncMap.get(text);
modelCollFunc.setSelectedItemImp(selectedCollFunc);
modelCollFunc.contentStateChanged();
}
@Override
protected String getModelTextChecked() throws ClipsException {
return inputedSpecCode;
}
};
tfSpecCode.setDocument(modelSpecCode);
tfSpecCode.setText(inputedSpecCode);
for (int i = 0; i < dirPlace.getItems().size(); i++) {
DirectoryServicingPlaceItem item = dirPlace.getItems().get(i);
if (item.getTitle().trim().toUpperCase().startsWith("ПОЛИ")) {
selectedPlace = item;
break;
}
}
modelPlace = new DelegateComboboxModel(jComboPlace, false) {
@Override
public boolean isSelectionVisible(){
return true;
}
@Override
public Object getElementAtImp(int index) throws ClipsException {
return dirPlace.getItems().get(index);
}
@Override
public int getSizeImp() throws ClipsException {
return dirPlace.getItems().size();
}
@Override
public Object getSelectedItemImp() throws ClipsException {
return selectedPlace;
}
@Override
public void setSelectedItemImp(Object anItem) throws ClipsException {
selectedPlace = (DirectoryServicingPlaceItem) anItem;
}
};
tfUet.getDocument().addDocumentListener(
new CheckableDocListener(tfUet, FormatChecker.UET) {
@Override
public void setField(String doc) {
uet = doc;
}
});
tfUet.setText("1");
}
private void initDiagnosisPanel() throws ClipsException {
modelDiagType = new DelegateComboboxModel(jComboDiagType, false) {
@Override
public boolean isSelectionVisible(){
return true;
}
@Override
public Object getElementAtImp(int index) throws ClipsException {
return dirDiagType.getItems().get(index);
}
@Override
public int getSizeImp() throws ClipsException {
return dirDiagType.getItems().size();
}
@Override
public Object getSelectedItemImp() throws ClipsException {
return selectedDiagType;
}
@Override
public void setSelectedItemImp(Object anItem) throws ClipsException {
selectedDiagType = (DirectoryDiagnosisTypeItem) anItem;
}
};
panelMkbInput.addContentStateListener(new ContentStateListener() {
@Override
public void contentStateChanged() {
try {
selectedEncounter = emc.getClient().getAutocalculatedEncounter(panelMkbInput.getSelectedItem(), selectedDisease.getID());
modelEncounter.contentStateChanged();
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}
});
selectedEncounter = emc.getClient().getAutocalculatedEncounter(panelMkbInput.getSelectedItem(), selectedDisease.getID());
modelEncounter = new DelegateComboboxModel(jComboDiagEncount, false) {
@Override
public boolean isSelectionVisible(){
return true;
}
@Override
public Object getElementAtImp(int index) throws ClipsException {
return dirEncounter.getItems().get(index);
}
@Override
public int getSizeImp() throws ClipsException {
return dirEncounter.getItems().size();
}
@Override
public Object getSelectedItemImp() throws ClipsException {
return selectedEncounter;
}
@Override
public void setSelectedItemImp(Object anItem) throws ClipsException {
selectedEncounter = (DirectoryDiagnosisEncounterItem) anItem;
if (selectedEncounter != null
&& selectedEncounter.isTrauma()) {
jPanel3.add(panTraumaType, BorderLayout.SOUTH);
}
else {
jPanel3.remove(panTraumaType);
selectedTrauma = null;
}
DialogQuickInput.this.validate();
DialogQuickInput.this.pack();
DialogQuickInput.this.repaint();
}
};
new DelegateComboboxModel(cbTraumaType, false) {
@Override
public boolean isSelectionVisible(){
return true;
}
@Override
public Object getElementAtImp(int index) throws ClipsException {
return dirTrauma.getItems().get(index);
}
@Override
public int getSizeImp() throws ClipsException {
return dirTrauma.getItems().size();
}
@Override
public Object getSelectedItemImp() throws ClipsException {
return selectedTrauma;
}
@Override
public void setSelectedItemImp(Object anItem) throws ClipsException {
selectedTrauma = (DirectoryTraumaTypeItem) anItem;
}
};
}
private void resetCollFuncList(DirectoryCollaboratorItem coll) throws ClipsException {
collFuncMap = new HashMap<String, DCFI>();
collFuncList = new ArrayList<DCFI>();
SelectorEditableExceptional<DirectoryCollaboratorFunctionsItem> collFuncItems = dirCollFunc.getItems();
String clinicType = UserInfo.get().getCollaborator().getLpu().getClinicType().getExtKey().trim();
for (int i = 0; i < collFuncItems.size(); i++) {
DirectoryCollaboratorFunctionsItem item = collFuncItems.get(i);
if (item.getReceptionType().getExtKey() != null
&& !item.getReceptionType().getExtKey().trim().isEmpty()
&& item.getReceptionType().getExtKey().trim().startsWith(clinicType)
&& item.getCollaborator().getID() == coll.getID()) {
DCFI dCFI = new DCFI(item);
collFuncMap.put(item.getReceptionType().getExtKey().trim(), dCFI);
collFuncList.add(dCFI);
}
}
if (collFuncList.size() == 1) {
selectedCollFunc = collFuncList.get(0);
inputedSpecCode = selectedCollFunc.getItem().getReceptionType().getExtKey();
} else {
selectedCollFunc = null;
inputedSpecCode = "";
}
}
private void resetDiagnosysPanel() throws ClipsException {
DiagnosisLocal specificDiagnosis = selectedDisease.getSpecificDiagnosis();
if (specificDiagnosis == null || specificDiagnosis.getID() == 0) {
jComboDiagType.setSelectedItem(dirDiagType.getItemFromID(0));
panelMkbInput.setSelectedItem(null);
jComboDiagEncount.setSelectedItem(dirEncounter.getItemFromID(0));
panelMkbInput1.setSelectedItem(null);
} else {
jComboDiagType.setSelectedItem(specificDiagnosis.getType());
panelMkbInput.setSelectedItem(specificDiagnosis.getMkb());
jComboDiagEncount.setSelectedItem(specificDiagnosis.getEncounter());
panelMkbInput1.setSelectedItem(specificDiagnosis.getComplication());
}
}
public DisSerDiagAuditChunk getResult() {
return result;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panUet = new javax.swing.JPanel();
labUet = new javax.swing.JLabel();
jPanel14 = new javax.swing.JPanel();
tfUet = new javax.swing.JTextField();
panTraumaType = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
cbTraumaType = new javax.swing.JComboBox();
jPanel15 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jComboDisease = new javax.swing.JComboBox();
jComboPurpose = new javax.swing.JComboBox();
jComboResult = new javax.swing.JComboBox();
jPanel2 = new javax.swing.JPanel();
jPanel13 = new javax.swing.JPanel();
jPanel6 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jPanel7 = new javax.swing.JPanel();
jDateSerren = new org.infotechservice.ICalendar.components.ICDateChooser();
jComboCollab = new javax.swing.JComboBox();
jLabelPolis = new javax.swing.JLabel();
jPanel8 = new javax.swing.JPanel();
tfServiceCode = new javax.swing.JTextField();
jComboService = new javax.swing.JComboBox();
jPanel9 = new javax.swing.JPanel();
tfSpecCode = new javax.swing.JTextField();
jComboSpec = new javax.swing.JComboBox();
jComboPlace = new javax.swing.JComboBox();
jPanel16 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
jPanel17 = new javax.swing.JPanel();
jPanel10 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jPanel11 = new javax.swing.JPanel();
jComboDiagType = new javax.swing.JComboBox();
panelMkbInput = new clips.doctor.diagnosis.PanelMkbInput();
jComboDiagEncount = new javax.swing.JComboBox();
panelMkbInput1 = new clips.doctor.diagnosis.PanelMkbInput();
jPanel12 = new javax.swing.JPanel();
btOK = new javax.swing.JButton();
btCancel = new javax.swing.JButton();
panUet.setLayout(new java.awt.BorderLayout(3, 0));
labUet.setText("УЕТ");
labUet.setPreferredSize(new java.awt.Dimension(125, 17));
panUet.add(labUet, java.awt.BorderLayout.LINE_START);
jPanel14.setLayout(new java.awt.BorderLayout());
tfUet.setColumns(8);
jPanel14.add(tfUet, java.awt.BorderLayout.WEST);
panUet.add(jPanel14, java.awt.BorderLayout.CENTER);
panTraumaType.setLayout(new java.awt.BorderLayout(3, 0));
jLabel2.setText("Тип травмы (отравления)");
panTraumaType.add(jLabel2, java.awt.BorderLayout.LINE_START);
panTraumaType.add(cbTraumaType, java.awt.BorderLayout.CENTER);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
jPanel15.setLayout(new java.awt.BorderLayout(0, 3));
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Заболевание"));
jPanel1.setLayout(new java.awt.BorderLayout(5, 0));
jPanel4.setLayout(new java.awt.GridLayout(0, 1, 0, 3));
jLabel1.setText("Заболевание");
jPanel4.add(jLabel1);
jLabel3.setText("Цель посещения");
jPanel4.add(jLabel3);
jLabel4.setFont(new java.awt.Font("DejaVu Sans", 2, 13));
jLabel4.setText("Закрыть с результатом");
jLabel4.setToolTipText("Заполняется только при закрытии заболевания");
jPanel4.add(jLabel4);
jPanel1.add(jPanel4, java.awt.BorderLayout.WEST);
jPanel5.setLayout(new java.awt.GridLayout(0, 1, 0, 3));
jPanel5.add(jComboDisease);
jPanel5.add(jComboPurpose);
jPanel5.add(jComboResult);
jPanel1.add(jPanel5, java.awt.BorderLayout.CENTER);
jPanel15.add(jPanel1, java.awt.BorderLayout.PAGE_START);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Посещение"));
jPanel2.setLayout(new java.awt.BorderLayout(0, 3));
jPanel13.setLayout(new java.awt.BorderLayout(3, 0));
jPanel6.setLayout(new java.awt.GridLayout(0, 1, 0, 3));
jLabel5.setText("Дата");
jPanel6.add(jLabel5);
jLabel6.setText("Сотрудник");
jPanel6.add(jLabel6);
jLabel7.setText("Полис");
jPanel6.add(jLabel7);
jLabel8.setText("Код посещения");
jPanel6.add(jLabel8);
jLabel9.setText("Код приема");
jPanel6.add(jLabel9);
jLabel10.setText("Место обслуживания");
jPanel6.add(jLabel10);
jPanel13.add(jPanel6, java.awt.BorderLayout.WEST);
jPanel7.setLayout(new java.awt.GridLayout(0, 1, 0, 3));
jDateSerren.setPreferredSize(new java.awt.Dimension(130, 19));
jPanel7.add(jDateSerren);
jPanel7.add(jComboCollab);
jLabelPolis.setText("Полис ОМС");
jLabelPolis.setOpaque(true);
jPanel7.add(jLabelPolis);
tfServiceCode.setText("Code");
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addComponent(tfServiceCode, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jComboService, 0, 0, Short.MAX_VALUE))
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(tfServiceCode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboService, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jPanel8Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jComboService, tfServiceCode});
jPanel7.add(jPanel8);
tfSpecCode.setText("Code");
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addComponent(tfSpecCode, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jComboSpec, 0, 0, Short.MAX_VALUE))
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(tfSpecCode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboSpec, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jPanel9Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jComboSpec, tfSpecCode});
jPanel7.add(jPanel9);
jPanel7.add(jComboPlace);
jPanel13.add(jPanel7, java.awt.BorderLayout.CENTER);
jPanel2.add(jPanel13, java.awt.BorderLayout.CENTER);
jPanel15.add(jPanel2, java.awt.BorderLayout.PAGE_END);
jPanel16.setLayout(new java.awt.BorderLayout(0, 3));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Диагноз"));
jPanel3.setLayout(new java.awt.BorderLayout(0, 3));
jPanel17.setLayout(new java.awt.BorderLayout(3, 0));
jPanel10.setLayout(new java.awt.GridLayout(0, 1, 0, 3));
jLabel11.setText("Тип диагноза");
jPanel10.add(jLabel11);
jLabel12.setText("Код МКБ");
jPanel10.add(jLabel12);
jLabel13.setText("Характер заболевания");
jPanel10.add(jLabel13);
jLabel14.setFont(new java.awt.Font("DejaVu Sans", 2, 13));
jLabel14.setText("Осложнение");
jLabel14.setToolTipText("Необязательно для заполнения");
jPanel10.add(jLabel14);
jPanel17.add(jPanel10, java.awt.BorderLayout.LINE_START);
jPanel11.setLayout(new java.awt.GridLayout(0, 1, 0, 3));
jPanel11.add(jComboDiagType);
jPanel11.add(panelMkbInput);
jPanel11.add(jComboDiagEncount);
jPanel11.add(panelMkbInput1);
jPanel17.add(jPanel11, java.awt.BorderLayout.CENTER);
jPanel3.add(jPanel17, java.awt.BorderLayout.CENTER);
jPanel16.add(jPanel3, java.awt.BorderLayout.PAGE_START);
btOK.setText("Записать");
btOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btOKActionPerformed(evt);
}
});
btCancel.setText("Отменить");
btCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btCancelActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
jPanel12.setLayout(jPanel12Layout);
jPanel12Layout.setHorizontalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout.createSequentialGroup()
.addContainerGap(671, Short.MAX_VALUE)
.addComponent(btOK)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btCancel)
.addContainerGap())
);
jPanel12Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btCancel, btOK});
jPanel12Layout.setVerticalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btCancel)
.addComponent(btOK))
);
jPanel16.add(jPanel12, java.awt.BorderLayout.PAGE_END);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel15, javax.swing.GroupLayout.DEFAULT_SIZE, 851, Short.MAX_VALUE)
.addComponent(jPanel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCancelActionPerformed
setDlgResult(ModalDialog.DLG_CANCEL);
dispose();
}//GEN-LAST:event_btCancelActionPerformed
private void btOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btOKActionPerformed
QuickInputChunk c = new QuickInputChunk();
//Заболевание
try {
String checkUET = FormatChecker.checkUet(uet);
if (checkUET == null) {
try {
Number v = NumberFormat.getInstance().parse(uet);
double d = v.doubleValue();
int uetI = (int) (d * 100);
c.uet = uetI;
} catch (ParseException pex) {
throw new ClipsException(pex.getLocalizedMessage());
}
}
else {
throw new ClipsException(checkUET);
}
c.emcID = emc.getID();
c.diseaseID = selectedDisease.getID();
c.purposeID = selectedPurpose.getID();
c.resultID = selectedResult == null ? 0 : selectedResult.getID();
//Посещение
c.date = selectedDate;
c.dataSt = selectedDate;
c.collID = selectedColl == null ? 0 : selectedColl.getID();
c.serviceID = selectedService == null ? 0 : selectedService.getID();
c.collFuncID = selectedCollFunc == null ? 0 : selectedCollFunc.getItem().getID();
c.placeID = selectedPlace.getID();
//Диагноз
DiagnosChunk dc = new DiagnosChunk();
dc.diagTypeID = selectedDiagType == null ? 0 : selectedDiagType.getID();
dc.mkbID = panelMkbInput.getSelectedItem() == null ? 0 : panelMkbInput.getSelectedItem().getID();
dc.encounterID = selectedEncounter == null ? 0 : selectedEncounter.getID();
dc.complicationID = panelMkbInput1.getSelectedItem() == null ? 0 : panelMkbInput1.getSelectedItem().getID();
dc.dateDs = selectedDate;
dc.trawmaTypeID = selectedTrauma == null ? 0 : selectedTrauma.getID();
c.diagList.add(dc);
result = bean.get().saveChunk(c, true);
if (result == null) {
MessageBox.showWarning("Это посещение уже записано в базу");
} else {
setDlgResult(ModalDialog.DLG_OK);
dispose();
}
} catch (Exception ex) {
bean.clear();
MessageBox.showException(new ClipsException("", ex));
}
}//GEN-LAST:event_btOKActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btCancel;
private javax.swing.JButton btOK;
private javax.swing.JComboBox cbTraumaType;
private javax.swing.JComboBox jComboCollab;
private javax.swing.JComboBox jComboDiagEncount;
private javax.swing.JComboBox jComboDiagType;
private javax.swing.JComboBox jComboDisease;
private javax.swing.JComboBox jComboPlace;
private javax.swing.JComboBox jComboPurpose;
private javax.swing.JComboBox jComboResult;
private javax.swing.JComboBox jComboService;
private javax.swing.JComboBox jComboSpec;
private org.infotechservice.ICalendar.components.ICDateChooser jDateSerren;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JLabel jLabelPolis;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel15;
private javax.swing.JPanel jPanel16;
private javax.swing.JPanel jPanel17;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JLabel labUet;
private javax.swing.JPanel panTraumaType;
private javax.swing.JPanel panUet;
private clips.doctor.diagnosis.PanelMkbInput panelMkbInput;
private clips.doctor.diagnosis.PanelMkbInput panelMkbInput1;
private javax.swing.JTextField tfServiceCode;
private javax.swing.JTextField tfSpecCode;
private javax.swing.JTextField tfUet;
// End of variables declaration//GEN-END:variables
private class DCFI {
DirectoryCollaboratorFunctionsItem item;
public DCFI(DirectoryCollaboratorFunctionsItem item) {
this.item = item;
}
public DirectoryCollaboratorFunctionsItem getItem() {
return item;
}
@Override
public String toString() {
try {
return item.getReceptionType().toString()
+ " (" + item.getFirstMedicalAid().toString() + ")";
} catch (ClipsException ex) {
ex.printStackTrace();
return "Ошибка сервера";
}
}
}
}