Bahmni 0.91.. Unable to create new Bed layout

Hello Everyone, Am testing the new Bed management of the latest bahmni version but am having some problems creating bed layout. Any solution? or the old sql script still apply?

2 Likes

I can confirm this issue.

@barnaby85, did you find a solution?

Other than that, here is what I found out:

  1. It is possible to create beds via API, e.g.:
curl -k -u Superman:Admin123 -X POST https://my-bahmni-installation/openmrs/ws/rest/v1/bed \
-H "Content-Type: application/json" \
--data-binary @- << EOF
{
   "bedNumber": "Test",
   "bedType": "LUXURY",
   "row": 1,
   "column": 2,
   "status": "AVAILABLE",
   "locationUuid": "0f67687d-d6e4-42c8-b807-813da458f233"
}
EOF
  1. The underlying error

The underlying error is caused by an SQL statement that is executed with bed_id null, this can be seen in the openmrs log file (/var/log/openmrs/openmrs.log):

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'bed_id' cannot be null

I looked in the mysql log file (/var/lib/mysql/localhost.log), and it shows the following:

insert into bed_location_map (location_id, bed_id, row_number, column_number) values (17, null, 1, 1)
1 Like

Hi, I’m also facing this issue. How can i fix it ?

Can you provide more details. Which version of Bahmni? Which application and what steps did you perform? Can you also check the openmrs log file to see if there is some SQL error logged? Is it the same one?

Hi @gsluthra, Thanks for your quick reply. I’m using Bahmni 0.92. I finally found the solution. based on this post bed-management-while-creating-new-beds-layout-shows-error. Here are detailed steps i did :

1- Connect to mysql :

mysql -u root -p openmrs

2- enter the cmd line below to display the bed layout table

show create table bed_location_map;

Copy the line containing “bed_id” for precise details of this field

bed_id` int(11) NOT NULL,

3- the solution to this problem is to lift the NOT NULL constraint on this field. To do so, execute the command below:

alter table bed_location_map modify bed_id int(11);

4- Log out of Mysql and restart the openmrs service

exit;

sudo service openmrs restart

Got it. Thanks for sharing. You removed the NOT NULL constraint on the bed_id column.