-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supported search history at API and Database levels
- Loading branch information
Showing
7 changed files
with
243 additions
and
1 deletion.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
api/src/main/java/com/openmrs/module/chartsearch/saving/ChartSearchHistory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package com.openmrs.module.chartsearch.saving; | ||
|
||
import java.io.Serializable; | ||
import java.util.Date; | ||
|
||
import javax.persistence.Access; | ||
import javax.persistence.AccessType; | ||
import javax.persistence.Basic; | ||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.Table; | ||
|
||
import org.openmrs.BaseOpenmrsObject; | ||
import org.openmrs.Patient; | ||
import org.openmrs.User; | ||
|
||
@Entity | ||
@Table(name = "chartsearch_history") | ||
@SuppressWarnings("serial") | ||
public class ChartSearchHistory extends BaseOpenmrsObject implements Serializable { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
@Column(name = "search_id") | ||
private Integer searchId; | ||
|
||
/** | ||
* Should be not save searches for the same phrase but rather just updated lastSearchedAt | ||
*/ | ||
@Column(name = "search_phrase", nullable = false, unique = true) | ||
private String searchPhrase; | ||
|
||
@Column(name = "last_searched_at", nullable = false) | ||
private Date lastSearchedAt; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "patient_id", nullable = false) | ||
private Patient patient; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User historyOwner; | ||
|
||
/** | ||
* @see org.openmrs.BaseOpenmrsObject#getUuid() | ||
*/ | ||
@Basic | ||
@Access(AccessType.PROPERTY) | ||
@Column(name = "uuid", length = 38, unique = true) | ||
@Override | ||
public String getUuid() { | ||
return super.getUuid(); | ||
} | ||
|
||
@Override | ||
public Integer getId() { | ||
return getSearchId(); | ||
} | ||
|
||
@Override | ||
public void setId(Integer id) { | ||
setSearchId(id); | ||
} | ||
|
||
public Integer getSearchId() { | ||
return searchId; | ||
} | ||
|
||
public void setSearchId(Integer searchId) { | ||
this.searchId = searchId; | ||
} | ||
|
||
public String getSearchPhrase() { | ||
return searchPhrase; | ||
} | ||
|
||
public void setSearchPhrase(String searchPhrase) { | ||
this.searchPhrase = searchPhrase; | ||
} | ||
|
||
public Date getLastSearchedAt() { | ||
return lastSearchedAt; | ||
} | ||
|
||
public void setLastSearchedAt(Date lastSearchedAt) { | ||
this.lastSearchedAt = lastSearchedAt; | ||
} | ||
|
||
public Patient getPatient() { | ||
return patient; | ||
} | ||
|
||
public void setPatient(Patient patient) { | ||
this.patient = patient; | ||
} | ||
|
||
public User getHistoryOwner() { | ||
return historyOwner; | ||
} | ||
|
||
public void setHistoryOwner(User historyOwner) { | ||
this.historyOwner = historyOwner; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters