|
@@ -498,7 +498,7 @@ function retrieveSymptomData() {
|
|
|
* 메모 탭 처리
|
|
|
*/
|
|
|
|
|
|
- function handleMemoData() {
|
|
|
+function insertMemoData() {
|
|
|
|
|
|
var memoContent = $("#memoContent").val().trim();
|
|
|
|
|
@@ -508,14 +508,54 @@ function retrieveSymptomData() {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- createMemoData(memoContent);
|
|
|
-
|
|
|
- $("#memoContent").val("");
|
|
|
+ requestInsertMemoData(memoContent);
|
|
|
|
|
|
$("#defaultModalPrimaryMemo").modal("hide");
|
|
|
}
|
|
|
|
|
|
-function createMemoData(memoContent) {
|
|
|
+function deleteMemoData() {
|
|
|
+
|
|
|
+ const memoId = $("#defaultModalPrimaryMemo").data("memoid");
|
|
|
+
|
|
|
+ if (memoId === undefined || memoId === null || memoId === "") {
|
|
|
+ alert("오류! 삭제할 메모를 찾을 수 없습니다.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const result = confirm("메모를 삭제하시겠습니까?\n삭제후에는 복구가 불가능 합니다.");
|
|
|
+ if(result){
|
|
|
+ requestDeleteMemoData(memoId);
|
|
|
+
|
|
|
+ $("#defaultModalPrimaryMemo").modal("hide");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function modifyMemoData() {
|
|
|
+
|
|
|
+ const memoId = $("#defaultModalPrimaryMemo").data("memoid");
|
|
|
+
|
|
|
+ if (memoId === undefined || memoId === null || memoId === "") {
|
|
|
+ alert("오류! 삭제할 메모를 찾을 수 없습니다.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var memoContent = $("#memoContent").val().trim();
|
|
|
+
|
|
|
+ if (!memoContent) {
|
|
|
+ alert("메모 내용을 입력해 주세요.");
|
|
|
+ $("#memoContent").val("");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const result = confirm("메모를 수정하시겠습니까?");
|
|
|
+ if(result){
|
|
|
+ requestUpdateMemoData(memoId, memoContent);
|
|
|
+
|
|
|
+ $("#defaultModalPrimaryMemo").modal("hide");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function requestInsertMemoData(memoContent) {
|
|
|
|
|
|
$.ajax({
|
|
|
url : "./api/memoData",
|
|
@@ -531,6 +571,42 @@ function createMemoData(memoContent) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function requestDeleteMemoData(memoIdx) {
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ url : "./api/memoData",
|
|
|
+ data : {idx:memoIdx},
|
|
|
+ method : "DELETE",
|
|
|
+ dataType : "json",
|
|
|
+ success : function( datas ){
|
|
|
+
|
|
|
+ retrieveMemoData();
|
|
|
+ },
|
|
|
+ error : ajaxErrorHandler
|
|
|
+ }).done( function(){
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function requestUpdateMemoData(memoIdx, memoContent) {
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ url : "./api/memoData",
|
|
|
+ data : {idx:memoIdx, contents:memoContent},
|
|
|
+ method : "PATCH",
|
|
|
+ dataType : "json",
|
|
|
+ success : function( datas ){
|
|
|
+ if (datas.code === "00") {
|
|
|
+ retrieveMemoData();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("메모 수정 실패.\n" + datas.code);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error : ajaxErrorHandler
|
|
|
+ }).done( function(){
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
function retrieveMemoData() {
|
|
|
var ignoreCache = moment().unix();
|
|
|
var params = {patientIdx: ${patientIdx}, ignoreCache:ignoreCache};
|
|
@@ -547,9 +623,9 @@ function retrieveMemoData() {
|
|
|
html = "";
|
|
|
contents = datas.forEach(function(d) {
|
|
|
html += "<tr>";
|
|
|
- html += "<td>" + gridDateFormatter(d.createDate) + "</td>";
|
|
|
+ html += "<td>" + gridDateFormatter(d.updateDate) + "</td>";
|
|
|
if (d.canModify) {
|
|
|
- html += "<td><pre class='contentsEdit'>" + d.contents + "</pre></td>";
|
|
|
+ html += "<td><pre id='memo_"+d.idx+"' class='contentsEdit' onClick='modifyMemo("+d.idx+")'>" + d.contents + "</pre></td>";
|
|
|
}
|
|
|
else {
|
|
|
html += "<td><pre>" + d.contents + "</pre></td>";
|
|
@@ -799,7 +875,7 @@ $(document).ready(function() {
|
|
|
});
|
|
|
|
|
|
// 의료진 메모 추가 클릭 이벤트
|
|
|
- $(document).on('click','[data-target="#defaultModalPrimaryMemo"]',function(){
|
|
|
+ $(document).on('click','.addMemo',function(){
|
|
|
var memoInfoHTML = '';
|
|
|
memoInfoHTML += '<th>내용</th>';
|
|
|
memoInfoHTML += '<td>';
|
|
@@ -808,14 +884,35 @@ $(document).ready(function() {
|
|
|
memoInfoHTML += ' </div>';
|
|
|
memoInfoHTML += '</td>';
|
|
|
|
|
|
- $('#memoInfo').html(memoInfoHTML);
|
|
|
+ $('#memoInfo').html(memoInfoHTML);
|
|
|
+ $('.addMemoTools').show();
|
|
|
+ $('.modifMemoTools').hide();
|
|
|
+ $('#defaultModalPrimaryMemo').modal();
|
|
|
setTimeout(function (){
|
|
|
$('#memoInfo').find('.form-row textarea').focus();
|
|
|
- }, 500);
|
|
|
-
|
|
|
- });
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
+function modifyMemo(memoId) {
|
|
|
+ $("#defaultModalPrimaryMemo").data("memoid", memoId);
|
|
|
+ const content = $("#memo_"+memoId).html();
|
|
|
+ var memoInfoHTML = '';
|
|
|
+ memoInfoHTML += '<th>내용</th>';
|
|
|
+ memoInfoHTML += '<td>';
|
|
|
+ memoInfoHTML += ' <div class="form-row">';
|
|
|
+ memoInfoHTML += ' <textarea id="memoContent" class="form-control" rows="15" placeholder="내용을 입력하세요">'+content+'</textarea>';
|
|
|
+ memoInfoHTML += ' </div>';
|
|
|
+ memoInfoHTML += '</td>';
|
|
|
+
|
|
|
+ $('#memoInfo').html(memoInfoHTML);
|
|
|
+ $('.addMemoTools').hide();
|
|
|
+ $('.modifMemoTools').show();
|
|
|
+ $('#defaultModalPrimaryMemo').modal();
|
|
|
+ setTimeout(function (){
|
|
|
+ $('#memoInfo').find('.form-row textarea').focus();
|
|
|
+ }, 500);
|
|
|
+}
|
|
|
|
|
|
</script>
|
|
|
</head>
|
|
@@ -939,7 +1036,7 @@ $(document).ready(function() {
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="modal fade" id="defaultModalPrimaryMemo" tabindex="-1" role="dialog" aria-hidden="true">
|
|
|
+ <div class="modal fade" id="defaultModalPrimaryMemo" tabindex="-1" role="dialog" aria-hidden="true" data-memoid="">
|
|
|
<div class="modal-dialog" role="document">
|
|
|
<div class="modal-content">
|
|
|
<div class="modal-header">
|
|
@@ -966,9 +1063,14 @@ $(document).ready(function() {
|
|
|
</tr>
|
|
|
</table>
|
|
|
</div>
|
|
|
- <div class="modal-footer">
|
|
|
+ <div class="addMemoTools modal-footer">
|
|
|
+ <button type="button" class="btn btn-outline-primary" data-dismiss="modal">취소</button>
|
|
|
+ <button type="button" class="btn btn-primary" onclick="insertMemoData()">등록</button>
|
|
|
+ </div>
|
|
|
+ <div class="modifMemoTools modal-footer">
|
|
|
+ <button type="button" class="removeMemo btn btn-danger" onclick="deleteMemoData()">삭제</button>
|
|
|
<button type="button" class="btn btn-outline-primary" data-dismiss="modal">취소</button>
|
|
|
- <button type="button" class="btn btn-primary" onclick="handleMemoData()">등록</button>
|
|
|
+ <button type="button" class="btn btn-primary" onclick="modifyMemoData()">수정</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -1128,7 +1230,7 @@ $(document).ready(function() {
|
|
|
<div class="card-header">
|
|
|
<h1 class="h4">
|
|
|
- 의료진 메모
|
|
|
- <button type="button" class="btn btn-primary ml-2" data-toggle="modal" data-target="#defaultModalPrimaryMemo">메모추가</button>
|
|
|
+ <button type="button" class="addMemo btn btn-primary ml-2" data-toggle="modal">메모추가</button>
|
|
|
<button class="btn btn-success text-right" style="float:right;" onclick="getExcel('memo');">Excel 다운로드</button>
|
|
|
</h1>
|
|
|
</div>
|