6 Commits

12 changed files with 308 additions and 54 deletions

View File

@@ -1,32 +0,0 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package Metier;
/**
*
* @author medhi.rodrigues
*/
public class Observation {
/**
* observation = l'observation d'un m<>dicament
*/
private String observation;
//LES GUETTEUR
/**
* @return the observation
*/
public String getObservation() {
return observation;
}
}

View File

@@ -4,8 +4,8 @@
*/
package TEST;
import acces_aux_donnes.connexionSQL;
import acces_aux_donnes.praticienSQL;
import acces_aux_donnes.ConnexionSQL;
import acces_aux_donnes.PraticienSQL;
import acces_aux_donnes.MedicamentSQL;
import java.sql.Connection;
@@ -29,8 +29,14 @@ public class testMain {
//praticienSQL a =new praticienSQL();
//a.rechercherPraticien("Didier", "1234");
MedicamentSQL b = new MedicamentSQL();
b.rechercherMedicament("3MYC7");
//MedicamentSQL b = new MedicamentSQL();
//b.rechercherMedicament("3MYC7");
String id= "3MYC7";
String imgTrouve = "../img/"+ id +".jpg";
System.out.print(imgTrouve);
}

View File

@@ -19,16 +19,16 @@ public class MedicamentSQL {
private ResultSet result = null;
public MedicamentSQL() {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
connexionTest = ConnexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
}
public ArrayList<String> rechercherMedicament (String idMedoc){
public ArrayList<String> rechercherMedicament (String nomCo){
ArrayList<String> infoMedoc = new ArrayList<String>();
try {
stmt = connexionTest.createStatement();
// Acc<63>s <20> la table
result = stmt.executeQuery("SELECT * FROM MEDICAMENT WHERE mDepotLegal ='"+idMedoc+"';");
result = stmt.executeQuery("SELECT * FROM MEDICAMENT WHERE mNomCommercial ='"+nomCo+"';");
if(result.next()){
infoMedoc.add(result.getString(1));
infoMedoc.add(result.getString(2));

View File

@@ -7,6 +7,7 @@ package acces_aux_donnes;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
/**
*

View File

@@ -4,10 +4,60 @@
*/
package acces_aux_donnes;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
/**
*
* @author emile.lalorcey
*/
public class observationSQL {
private Connection connexionTest;
private Statement stmt = null;
private ResultSet result = null;
public observationSQL() {
connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB");
}
public int compterLignes(){
int nbLignes = 0;
try {
stmt = connexionTest.createStatement();
// Acc<63>s <20> la table
result = stmt.executeQuery("SELECT COUNT(idObservation) From OBSERVATION");
if (result.next()) {
nbLignes = Integer.parseInt(result.getString(1));
}
result.close();
stmt.close();
} catch (SQLException ex) {
System.out.println("SQLException : " + ex.getMessage());
System.out.println("SQLState : " + ex.getSQLState());
System.out.println("Code erreur : " + ex.getErrorCode());
}
return nbLignes;
}
public int ajouterObservation(String idMedoc, int idPraticien, String observation){
int passer = 1000;
int nbLignes = this.compterLignes();
try {
stmt = connexionTest.createStatement();
// Acc<63>s <20> la table
passer = stmt.executeUpdate("INSERT INTO OBSERVATION(idObservation, idMedoc, idPraticien, observation) "
+ "VALUES ("+(nbLignes+1)+",'"+idMedoc+"',"+idPraticien+",\""+observation+"\");");
result.close();
stmt.close();
}catch (SQLException ex) {
System.out.println("SQLException : " + ex.getMessage());
System.out.println("SQLState : " + ex.getSQLState());
System.out.println("Code erreur : " + ex.getErrorCode());
}
return passer;
}
}

View File

@@ -23,13 +23,84 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jLTitre" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="65" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="348" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="158" max="-2" attributes="0"/>
<Component id="jBsoumettre" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="23" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jLTitre" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="157" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jBsoumettre" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="46" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/img/logodetoure.gif"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLTitre">
<Properties>
<Property name="text" type="java.lang.String" value="Soumettez votre observation"/>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="jTAobservation">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jBsoumettre">
<Properties>
<Property name="text" type="java.lang.String" value="Soumettre"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBsoumettreActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@@ -4,17 +4,22 @@
*/
package presentation;
import acces_aux_donnes.ObservationSQL;
/**
*
* @author emile.lalorcey
*/
public class jffAjoutObservation extends javax.swing.JFrame {
private String idMedoc;
private int idPraticien;
/**
* Creates new form jffAjoutObservation
*/
public jffAjoutObservation() {
public jffAjoutObservation(String idMedoc,int idPraticien) {
initComponents();
this.idMedoc = idMedoc;
this.idPraticien = idPraticien;
}
/**
@@ -26,22 +31,73 @@ public class jffAjoutObservation extends javax.swing.JFrame {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLTitre = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTAobservation = new javax.swing.JTextArea();
jBsoumettre = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/logodetoure.gif"))); // NOI18N
jLTitre.setText("Soumettez votre observation");
jTAobservation.setColumns(20);
jTAobservation.setRows(5);
jScrollPane1.setViewportView(jTAobservation);
jBsoumettre.setText("Soumettre");
jBsoumettre.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBsoumettreActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLTitre)
.addGap(65, 65, 65)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 348, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(158, 158, 158)
.addComponent(jBsoumettre)))
.addGap(0, 23, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1)
.addComponent(jLTitre))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jBsoumettre)
.addContainerGap(46, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jBsoumettreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBsoumettreActionPerformed
ObservationSQL observ = new ObservationSQL();
observ.ajouterObservation(this.idMedoc, this.idPraticien, jTAobservation.getText());
}//GEN-LAST:event_jBsoumettreActionPerformed
/**
* @param args the command line arguments
*/
@@ -72,11 +128,16 @@ public class jffAjoutObservation extends javax.swing.JFrame {
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new jffAjoutObservation().setVisible(true);
//new jffAjoutObservation().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBsoumettre;
private javax.swing.JLabel jLTitre;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTAobservation;
// End of variables declaration//GEN-END:variables
}

View File

@@ -4,7 +4,7 @@
*/
package presentation;
import acces_aux_donnes.praticienSQL;
import acces_aux_donnes.PraticienSQL;
/**
*
@@ -158,7 +158,7 @@ public class jffConnexion extends javax.swing.JFrame {
private void jBValiderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBValiderActionPerformed
String identifiant = jTFIdentifiant.getText();
String mdp = String.valueOf(jPFmdp.getPassword());
praticienSQL testPraticien = new praticienSQL();
PraticienSQL testPraticien = new PraticienSQL();
String [] lePraticien = testPraticien.rechercherPraticien(identifiant,mdp);
if (lePraticien[0] != null){
System.out.print("TEST REUSSIE");

View File

@@ -28,6 +28,15 @@
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Component id="jLRecherche" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jTFRecherche" min="-2" pref="80" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jBRechercheValide" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@@ -35,7 +44,13 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="262" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLRecherche" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTFRecherche" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jBRechercheValide" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="227" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -48,5 +63,23 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLRecherche">
<Properties>
<Property name="text" type="java.lang.String" value="Recherche m&#xe9;dicament : "/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTFRecherche">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTFRechercheActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jBRechercheValide">
<Properties>
<Property name="text" type="java.lang.String" value="Rechercher"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBRechercheValideActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@@ -4,6 +4,10 @@
*/
package presentation;
import Metier.Medicament;
import acces_aux_donnes.MedicamentSQL;
import java.util.ArrayList;
/**
*
* @author emile.lalorcey
@@ -27,11 +31,29 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLRecherche = new javax.swing.JLabel();
jTFRecherche = new javax.swing.JTextField();
jBRechercheValide = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/logodetoure.gif"))); // NOI18N
jLRecherche.setText("Recherche m<>dicament : ");
jTFRecherche.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTFRechercheActionPerformed(evt);
}
});
jBRechercheValide.setText("Rechercher");
jBRechercheValide.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBRechercheValideActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
@@ -40,18 +62,57 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
.addContainerGap(344, Short.MAX_VALUE)
.addComponent(jLabel1)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLRecherche)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTFRecherche, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jBRechercheValide)
.addGap(27, 27, 27))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addContainerGap(262, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLRecherche)
.addComponent(jTFRecherche, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jBRechercheValide))
.addContainerGap(227, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jTFRechercheActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTFRechercheActionPerformed
}//GEN-LAST:event_jTFRechercheActionPerformed
private void jBRechercheValideActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBRechercheValideActionPerformed
String medocRechercher = jTFRecherche.getText();
MedicamentSQL medocTest = new MedicamentSQL();
ArrayList<String> rechercheMedoc = new ArrayList<String>();
rechercheMedoc = medocTest.rechercherMedicament(medocRechercher);
if (rechercheMedoc.get(0) != null) {
String idTrouve = rechercheMedoc.get(0);
String nomTrouve = rechercheMedoc.get(1);
String compositionTrouve = rechercheMedoc.get(2);
String effetTrouve = rechercheMedoc.get(3);
String contreIndicationTrouve = rechercheMedoc.get(4);
String imgTrouve = "../img/"+ idTrouve +".jpg";
Medicament medocTrouve = new Medicament(idTrouve, nomTrouve , compositionTrouve, effetTrouve
, contreIndicationTrouve,imgTrouve);
new jffInfoMedoc(medocTrouve).setVisible(true);
}else {
//ajout d'un JoptionPane
}
}//GEN-LAST:event_jBRechercheValideActionPerformed
/**
* @param args the command line arguments
*/
@@ -88,6 +149,9 @@ public class jffFamilleMedoc extends javax.swing.JFrame {
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBRechercheValide;
private javax.swing.JLabel jLRecherche;
private javax.swing.JLabel jLabel1;
private javax.swing.JTextField jTFRecherche;
// End of variables declaration//GEN-END:variables
}

View File

@@ -49,15 +49,14 @@
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSeparator1" alignment="1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLContrindication" min="-2" pref="265" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLPrix" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLComposition" min="-2" pref="265" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" pref="265" max="-2" attributes="0"/>

View File

@@ -4,6 +4,8 @@
*/
package presentation;
import Metier.Medicament;
/**
*
* @author emile.lalorcey
@@ -13,7 +15,7 @@ public class jffInfoMedoc extends javax.swing.JFrame {
/**
* Creates new form jffInfoMedoc
*/
public jffInfoMedoc() {
public jffInfoMedoc(Medicament medocTrouve) {
initComponents();
}
@@ -152,7 +154,6 @@ public class jffInfoMedoc extends javax.swing.JFrame {
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new jffInfoMedoc().setVisible(true);
}
});
}