/*
* PanelDiagnosis.java
*
* Created on 4 Март 2008 г., 10:47
*/
package clips.doctor.diagnosis;
import clips.delegate.client.ClientLocal;
import clips.delegate.directory.complex.DirectoryMKB10Item;
import clips.delegate.directory.simple.diagnosisType.DirectoryDiagnosisTypeItem;
import clips.delegate.doctor.diagnosis.DiagnosisLocal;
import cli_fmw.delegate.DelegateLine2;
import cli_fmw.main.ClipsException;
import cli_fmw.main.PageContainer;
import cli_fmw.utils.Selector;
import clips.delegate.doctor.DiseaseLocal;
import clips.delegate.service.SerRenLocal;
import clips.directory.dialogs.mkb10.DirectoryDialogMKB10;
import cli_fmw.main.PrintCreators;
import cli_fmw.main.PageException;
import cli_fmw.main.PageGeneric;
import cli_fmw.main.Persistentable;
import cli_fmw.main.Printable;
import cli_fmw.report.CombinedReportCreator;
import cli_fmw.utils.MessageBox;
import cli_fmw.utils.ModalDialog;
import cli_fmw.utils.table_config_states.StateSaver;
import cli_fmw.utils.table_config_states.TableState;
import cli_fmw.delegate.directory.complex.DirectoryLocator;
import cli_fmw.main.ContentStateListener;
import cli_fmw.report.panels.model.delegate.DelegateComboboxModel;
import cli_fmw.report.panels.model.delegate.DelegateTextModel;
import cli_fmw.report.panels.model.delegate.DirectorySimpleFilteredComboBoxModel;
import clips.delegate.directory.complex.DirectoryMKB10;
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.traumaType.DirectoryTraumaType;
import clips.delegate.directory.simple.traumaType.DirectoryTraumaTypeItem;
import beans.directory.simple.entities.DiagnosisType;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
/**
*Панель для отображения диагноза
* @author lacoste
*/
public class PanelDiagnosis extends PageGeneric implements Persistentable, Printable/*, ContentStateListener*/ {
private DiagnosisLocal diagnosisLocal;
private ArrayList<DiagnosisLocal> diagnosis2delete;
private boolean canBeEdit;
private DirectoryMKB10 dirMkb;
private DirectoryTraumaType directoryTT;
private DirectoryDiagnosisEncounter directoryDE;
/** Creates new form PanelDiagnosis
* @param container
* @param dl
* @throws ClipsException
*/
public PanelDiagnosis(PageContainer container, DiagnosisLocal dl) throws ClipsException {
super(container);
initComponents();
this.canBeEdit = dl.getSerrenLocal().canModify();
this.diagnosisLocal = dl;
this.diagnosis2delete = new ArrayList<DiagnosisLocal>();
//Заполняем чекбокс типов диагнозов
DirectoryDiagnosisType directoryDT = DirectoryLocator.getDirectory(DirectoryDiagnosisType.class);
directoryTT = DirectoryLocator.getDirectory(DirectoryTraumaType.class);
directoryDE = DirectoryLocator.getDirectory(DirectoryDiagnosisEncounter.class);
new DirectorySimpleFilteredComboBoxModel<DiagnosisLocal, DirectoryDiagnosisTypeItem> (cbType, diagnosisLocal, directoryDT) {
@Override
public DirectoryDiagnosisTypeItem getSelectedDirectoryItem() throws ClipsException {
return getObject().getType();
}
@Override
public void setSelectedDirectoryItem(DirectoryDiagnosisTypeItem item) throws ClipsException {
getObject().setType(item);
}
@Override
public Object addItem(String txt) {
return super.addItem(txt);
}
};
new DirectorySimpleFilteredComboBoxModel<DiagnosisLocal, DirectoryTraumaTypeItem> (cbTraumatype, diagnosisLocal, directoryTT) {
@Override
public DirectoryTraumaTypeItem getSelectedDirectoryItem() throws ClipsException {
return getObject() != null ? getObject().getTrauma() : directoryTT.getNullItem();
}
@Override
public void setSelectedDirectoryItem(DirectoryTraumaTypeItem item) throws ClipsException {
getObject().setTrauma(item);
}
@Override
protected boolean isEnabled() {
try {
return checkTrauma();
} catch (ClipsException ex) {
ex.printStackTrace();
return false;
}
}
};
tabAccomDiags.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
setEnableComponents();
}
});
new DelegateTextModel<DiagnosisLocal>(tfAuthor, dl) {
@Override
protected void setModelTextChecked(String text) throws ClipsException {
getObject().setAuthor(text);
}
@Override
protected String getModelTextChecked() throws ClipsException {
return getObject().getAuthor();
}
};
//Заполняем комбо повторяемости диагноза
new DirectorySimpleFilteredComboBoxModel<DiagnosisLocal, DirectoryDiagnosisEncounterItem> (cbEncounter, diagnosisLocal, directoryDE) {
@Override
public DirectoryDiagnosisEncounterItem getSelectedDirectoryItem() throws ClipsException {
DirectoryDiagnosisEncounterItem encounter = getObject().getEncounter();
return encounter;
}
@Override
public void setSelectedDirectoryItem(DirectoryDiagnosisEncounterItem item) throws ClipsException {
getObject().setEncounter(item);
}
};
//Заполнение чекбокса стадии заболевания
new DelegateComboboxModel<DiagnosisLocal>(cbStage, dl, false) {
@Override
public Object getElementAtImp(int index) throws ClipsException {
return DiagnosisLocal.STAGES[index];
}
@Override
public int getSizeImp() throws ClipsException {
return DiagnosisLocal.STAGES.length;
}
@Override
public Object getSelectedItemImp() throws ClipsException {
int stage = getObject().getStage();
return getElementAtImp(stage);
}
@Override
public void setSelectedItemImp(Object anId) throws ClipsException {
getObject().setStage(getid(anId));
}
};
pmiMainDiagnosis.setSelectedItem(diagnosisLocal.getMkb());
pmiMainDiagnosis.addContentStateListener(new ContentStateListener() {
@Override
public void contentStateChanged() {
try {
DirectoryMKB10Item selectedItem = pmiMainDiagnosis.getSelectedItem();
if (selectedItem != null && selectedItem.getID() != 0){
diagnosisLocal.setMkb(selectedItem);
cbEncounter.setEnabled(false);
if (selectedItem.isTrauma()){
cbEncounter.setSelectedItem(directoryDE.getTrauma());
}else if (selectedItem.isHealthy()){
cbEncounter.setSelectedItem(directoryDE.getHealthy());
}else{
//сбрасывается если было проставлено "травма" или "здоров"
Object last = cbEncounter.getSelectedItem();
if (last.equals(directoryDE.getTrauma())
|| last.equals(directoryDE.getHealthy())) {
cbEncounter.setSelectedItem(directoryDE.getNullItem());
}
cbEncounter.setEnabled(true);
}
}
// setAutoEncounter();
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}
});
pmiСomplication.setSelectedItem(diagnosisLocal.getComplication());
pmiСomplication.addContentStateListener(new ContentStateListener() {
@Override
public void contentStateChanged() {
try {
DirectoryMKB10Item selectedItem = pmiСomplication.getSelectedItem();
if (selectedItem != null){
diagnosisLocal.setComplication(selectedItem);
}
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}
});
dirMkb = DirectoryLocator.getDirectory(DirectoryMKB10.class);
checkTrauma();
setScreenFields();
resizeColumn();
StateSaver.attachTo(this);
}
private boolean checkTrauma() throws ClipsException{
DirectoryDiagnosisEncounterItem item = diagnosisLocal.getEncounter();
if (item != null){
if (item.isTrauma()){
return true;
}else{
if (diagnosisLocal.isDirty() && !diagnosisLocal.getTrauma().isNullItem()){
diagnosisLocal.setTrauma(directoryTT.getNullItem());
}
}
}
return false;
}
@Deprecated
private void setAutoEncounter() throws ClipsException {
//Вычисление повторяемости
ClientLocal client = diagnosisLocal.getSerrenLocal().getPolisData().getClient();
DirectoryDiagnosisEncounterItem itemEncounter = client.getAutocalculatedEncounter(diagnosisLocal.getMkb(), diagnosisLocal.getSerrenLocal().getDiseaseLocal().getID());
diagnosisLocal.setEncounter(itemEncounter);
cbEncounter.setSelectedItem(itemEncounter);
//сброс кеша заболевания
//diagnosisLocal.getSerrenLocal().getDiseaseLocal().clearDiagnosisCache();
}
private void updateTable() throws ClipsException {
tabAccomDiags.setModel(new TableModelAccompDiagnosisList(diagnosisLocal.getAccompDiagnosis(), canBeEdit));
tabAccomDiags.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tabAccomDiags.getColumnModel().getColumn(TableModelAccompDiagnosisList.COL_ENCOUNTER).setCellEditor(
new DefaultCellEditor(new JComboBox(DirectoryLocator.getDirectory(DirectoryDiagnosisEncounter.class).toArray())));
tabAccomDiags.getColumnModel().getColumn(TableModelAccompDiagnosisList.COL_STAGE).setCellEditor(new DefaultCellEditor(new JComboBox(DiagnosisLocal.STAGES)));
}
private void resizeColumn() {
TableState state = new TableState();
state.setPreferredWidth(TableModelAccompDiagnosisList.COL_DATE, 2);
state.setPreferredWidth(TableModelAccompDiagnosisList.COL_MKB, 7);
state.setPreferredWidth(TableModelAccompDiagnosisList.COL_ENCOUNTER, 7);
state.setPreferredWidth(TableModelAccompDiagnosisList.COL_STAGE, 1);
StateSaver.setDefaultState(this, tabAccomDiags, state);
}
private void setScreenFields() throws ClipsException {
dateDiagnosis.setDate(diagnosisLocal.getDate());
setEnableComponents();
updateTable();
}
public void setEnableComponents() {
dateDiagnosis.setEnabled(false);
cbType.setEnabled(canBeEdit);
cbEncounter.setEnabled(canBeEdit);
cbStage.setEnabled(canBeEdit);
tfAuthor.setEditable(canBeEdit);
btAccDiagByCode.setEnabled(canBeEdit && !diagnosisLocal.isNewlyCreated());
tfAccDiagCode.setEditable(canBeEdit && !diagnosisLocal.isNewlyCreated());
// btAdd.setEnabled(canBeEdit && !diagnosisLocal.isNewlyCreated());
btDelete.setEnabled(canBeEdit && tabAccomDiags.getSelectedRowCount() > 0);
}
private boolean isFieldsOK() throws ClipsException{
if (diagnosisLocal.getEncounter() == null || diagnosisLocal.getEncounter().getID() == 0) {
return false;
}
if (diagnosisLocal.getType() == null || diagnosisLocal.getType().getID() == 0) {
return false;
}
if (diagnosisLocal.getMkb() == null || diagnosisLocal.getMkb().getID() == 0) {
return false;
}
for (DiagnosisLocal dl : diagnosisLocal.getAccompDiagnosis()) {
if (dl.getMkb().isNullItem()) {
return false;
}
}
return true;
}
/** 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.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel14 = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
tfAccDiagCode = new javax.swing.JTextField();
btAccDiagByCode = new javax.swing.JButton();
jPanel8 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
jPanel13 = new javax.swing.JPanel();
btDelete = new javax.swing.JButton();
btAdd = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
tabAccomDiags = new cli_fmw.utils.sorted_table.SortedTable();
jPanel6 = new javax.swing.JPanel();
titles = new javax.swing.JPanel();
jLabelDate = new javax.swing.JLabel();
jLabelMKB = new javax.swing.JLabel();
jLabelType = new javax.swing.JLabel();
jLabelEncount = new javax.swing.JLabel();
jLabelTrawma = new javax.swing.JLabel();
jLabelStage = new javax.swing.JLabel();
jLabelcomplif = new javax.swing.JLabel();
jLabelCollab = new javax.swing.JLabel();
values = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
dateDiagnosis = new org.infotechservice.ICalendar.components.ICDateChooser();
pmiMainDiagnosis = new clips.doctor.diagnosis.PanelMkbInput();
cbType = new javax.swing.JComboBox();
cbEncounter = new javax.swing.JComboBox();
cbTraumatype = new javax.swing.JComboBox();
cbStage = new javax.swing.JComboBox();
pmiСomplication = new clips.doctor.diagnosis.PanelMkbInput();
tfAuthor = new javax.swing.JTextField();
jPanel14.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
jLabel7.setText("сопутствующее заболевание по коду");
jPanel14.add(jLabel7);
tfAccDiagCode.setColumns(8);
tfAccDiagCode.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
tfAccDiagCodeKeyPressed(evt);
}
});
jPanel14.add(tfAccDiagCode);
btAccDiagByCode.setText("ОК");
btAccDiagByCode.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btAccDiagByCodeActionPerformed(evt);
}
});
jPanel14.add(btAccDiagByCode);
jPanel8.setLayout(new java.awt.BorderLayout(5, 5));
jPanel5.setLayout(new java.awt.BorderLayout());
btDelete.setText("Удалить");
btDelete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btDeleteActionPerformed(evt);
}
});
jPanel13.add(btDelete);
btAdd.setText("Добавить");
btAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btAddActionPerformed(evt);
}
});
jPanel13.add(btAdd);
jPanel5.add(jPanel13, java.awt.BorderLayout.LINE_END);
jPanel8.add(jPanel5, java.awt.BorderLayout.SOUTH);
jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("Сопутствующие диагнозы"));
jScrollPane1.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
jScrollPane1ComponentResized(evt);
}
});
tabAccomDiags.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tabAccomDiagsMouseClicked(evt);
}
});
jScrollPane1.setViewportView(tabAccomDiags);
jPanel8.add(jScrollPane1, java.awt.BorderLayout.CENTER);
jPanel6.setLayout(new java.awt.BorderLayout(5, 5));
titles.setLayout(new java.awt.GridLayout(0, 1, 5, 5));
jLabelDate.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabelDate.setText("Дата постановки:");
titles.add(jLabelDate);
jLabelMKB.setText("Диагноз:");
titles.add(jLabelMKB);
jLabelType.setText("Тип диагноза:");
titles.add(jLabelType);
jLabelEncount.setText("Характер:");
titles.add(jLabelEncount);
jLabelTrawma.setText("Травма:");
titles.add(jLabelTrawma);
jLabelStage.setText("Стадия:");
titles.add(jLabelStage);
jLabelcomplif.setText("Осложнение:");
titles.add(jLabelcomplif);
jLabelCollab.setText("Специалист:");
titles.add(jLabelCollab);
jPanel6.add(titles, java.awt.BorderLayout.WEST);
values.setLayout(new java.awt.GridLayout(0, 1, 5, 5));
jPanel3.setLayout(new java.awt.BorderLayout());
dateDiagnosis.setEnabled(false);
jPanel3.add(dateDiagnosis, java.awt.BorderLayout.WEST);
values.add(jPanel3);
pmiMainDiagnosis.setPreferredSize(new java.awt.Dimension(200, 25));
values.add(pmiMainDiagnosis);
values.add(cbType);
values.add(cbEncounter);
cbTraumatype.setEnabled(false);
values.add(cbTraumatype);
cbStage.setPreferredSize(new java.awt.Dimension(50, 24));
values.add(cbStage);
values.add(pmiСomplication);
tfAuthor.setText(" ");
values.add(tfAuthor);
jPanel6.add(values, java.awt.BorderLayout.CENTER);
jPanel8.add(jPanel6, java.awt.BorderLayout.NORTH);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
/**
* Добавление сопутствующего диагноза
* @param evt
*/
private void btAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAddActionPerformed
try {
List<DiagnosisLocal> accompDiagnosis = diagnosisLocal.getAccompDiagnosis();
DiagnosisLocal newDiagnosis = new DiagnosisLocal(diagnosisLocal.getSerrenLocal());
newDiagnosis.addContentStateListener(getContainer());
DirectoryDialogMKB10 dlg = new DirectoryDialogMKB10(false, newDiagnosis.getMkb());
dlg.setVisible(true);
if (dlg.getDlgResult() == ModalDialog.DLG_OK) {
Selector selectedItems = dlg.getSelectedItems();
if (selectedItems.size() > 0) {
DirectoryMKB10Item mkb10item = (DirectoryMKB10Item) selectedItems.get(0);
newDiagnosis.setMkb(mkb10item);
newDiagnosis.setReferencedDiagnosis(diagnosisLocal);
newDiagnosis.setEncounter(diagnosisLocal.getEncounter());
newDiagnosis.setType(diagnosisLocal.getType());
accompDiagnosis.add(newDiagnosis);
diagnosisLocal.setAccompDiagnosis(accompDiagnosis);
updateTable();
}
}
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}//GEN-LAST:event_btAddActionPerformed
/**
* Удаление сопутствующего диагноза
* @param evt
*/
private void btDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btDeleteActionPerformed
if (tabAccomDiags.getSelectedRowCount() > 0) {
try {
List<DiagnosisLocal> accompDiagnosis = diagnosisLocal.getAccompDiagnosis();
DiagnosisLocal remove = accompDiagnosis.remove(tabAccomDiags.getSelectedRowSorted());
diagnosis2delete.add(remove);
diagnosisLocal.setAccompDiagnosis(accompDiagnosis);
updateTable();
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}
}//GEN-LAST:event_btDeleteActionPerformed
private void jScrollPane1ComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jScrollPane1ComponentResized
}//GEN-LAST:event_jScrollPane1ComponentResized
private void tabAccomDiagsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabAccomDiagsMouseClicked
int row = tabAccomDiags.getSelectedRowSorted();
int col = tabAccomDiags.getSelectedColumn();
if (evt.getClickCount() == 2
&& col == TableModelAccompDiagnosisList.COL_MKB
&& tabAccomDiags.isCellEditable(row, col)) {
try {
DirectoryDialogMKB10 dlg = new DirectoryDialogMKB10(false, tabAccomDiags.getValueAt(row, col));
dlg.setVisible(true);
if (dlg.getDlgResult() == ModalDialog.DLG_OK) {
Selector selectedItems = dlg.getSelectedItems();
if (selectedItems.size() > 0) {
DirectoryMKB10Item mkb10item = (DirectoryMKB10Item) selectedItems.get(0);
tabAccomDiags.setValueAt(mkb10item, row, col);
}
}
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}
}//GEN-LAST:event_tabAccomDiagsMouseClicked
private void btAccDiagByCodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAccDiagByCodeActionPerformed
// try {
// String code = tfAccDiagCode.getText().trim().toUpperCase();
// if (code.isEmpty()) {
// return;
// }
// DirectoryMKB10Item item = dirMkb.getItemByCode(code);
// if (item == null) {
// MessageBox.showWarning("Не удалось найти элемент справочника МКБ по введенному коду");
// }
// else {
// DiagnosisLocal newDiagnosis = new DiagnosisLocal(diagnosisLocal.getSerrenLocal());
// newDiagnosis.addContentStateListener(getContainer());
// newDiagnosis.setMkb(item);
// accompDiagnosisList.add(newDiagnosis);
// newDiagnosis.setReferencedDiagnosis(diagnosisLocal);
// newDiagnosis.setEncounter(diagnosisLocal.getEncounter());
// newDiagnosis.setType(diagnosisLocal.getType());
// updateTable();
// }
// tfAccDiagCode.setText("");
// } catch (ClipsException ex) {
// MessageBox.showException(ex);
// }
}//GEN-LAST:event_btAccDiagByCodeActionPerformed
private void tfAccDiagCodeKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfAccDiagCodeKeyPressed
// if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
// btAccDiagByCodeActionPerformed(null);
// }
}//GEN-LAST:event_tfAccDiagCodeKeyPressed
@Override
public String getPageTitle() {
return "Диагноз";
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btAccDiagByCode;
private javax.swing.JButton btAdd;
private javax.swing.JButton btDelete;
private javax.swing.JComboBox cbEncounter;
private javax.swing.JComboBox cbStage;
private javax.swing.JComboBox cbTraumatype;
private javax.swing.JComboBox cbType;
private org.infotechservice.ICalendar.components.ICDateChooser dateDiagnosis;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabelCollab;
private javax.swing.JLabel jLabelDate;
private javax.swing.JLabel jLabelEncount;
private javax.swing.JLabel jLabelMKB;
private javax.swing.JLabel jLabelStage;
private javax.swing.JLabel jLabelTrawma;
private javax.swing.JLabel jLabelType;
private javax.swing.JLabel jLabelcomplif;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel8;
private javax.swing.JScrollPane jScrollPane1;
private clips.doctor.diagnosis.PanelMkbInput pmiMainDiagnosis;
private clips.doctor.diagnosis.PanelMkbInput pmiСomplication;
private cli_fmw.utils.sorted_table.SortedTable tabAccomDiags;
private javax.swing.JTextField tfAccDiagCode;
private javax.swing.JTextField tfAuthor;
private javax.swing.JPanel titles;
private javax.swing.JPanel values;
// End of variables declaration//GEN-END:variables
@Override
public boolean isDirty() {
return diagnosisLocal == null? false : diagnosisLocal.isDirty();
}
@Override
public void save() throws ClipsException {
if (isFieldsOK()) {
if (diagnosisLocal.getType().getID() == DiagnosisType.DIAGNOSIS_TYPE_FINAL) {
DiagnosisLocal sd = diagnosisLocal.getSerrenLocal().getDiseaseLocal().getSpecificDiagnosis();
if (sd != null && sd.getID() != diagnosisLocal.getID()) {
int res = MessageBox.showConfirmYesNo(MessageBox.C_RESET_DIAGNOSIS_TYPES);
if (res != MessageBox.ANSWER_YES) {
return;
}
}
}
diagnosisLocal.save1();
for (DiagnosisLocal dl : diagnosis2delete) {
dl.remove();
}
DiseaseLocal diseaseLocal = diagnosisLocal.getSerrenLocal().getDiseaseLocal();
for (SerRenLocal serren : diseaseLocal.getSerrenList()) {
for (DiagnosisLocal diagnosis : serren.getDiagnosisList()) {
diagnosis.reload();
}
}
diagnosis2delete.clear();
setEnableComponents();
// diseaseLocal.clearSpecificDiagnosesCash();
} else {
throw new ClipsException("Не заполнены необходимые поля");
}
}
@Override
public void restore() {
if (diagnosisLocal.isNewlyCreated()){
try {
getContainer().removePage(this, true);
} catch (PageException ex) {
MessageBox.showException(ex);
}
}else{
try {
diagnosisLocal.restore();
diagnosis2delete.clear();
setScreenFields();
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}
}
@Override
public boolean readyForPrint() {
return !isDirty();
}
@Override
public void print() {
try {
if (readyForPrint()) {
CombinedReportCreator parCreator = PrintCreators.createCombinedReportHeader(getClass());
diagnosisLocal.print(parCreator);
parCreator.finish();
}
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}
@Override
public DelegateLine2 getDelegate() {
return diagnosisLocal;
}
}