<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags"%>

<!-- Page Content  -->
<div id="divContent">

	<div id="divCondition" style="background-color: #eeeeee; height: 120px;">
		<span style="mar">조건부</span>
	</div>
	<div id="divResult">
		Image 파일 전송 서비스 : <br>
		<form style="border:1px solid;" id="fileUpload" name="fileUpload" method="post" action="${pageContext.request.contextPath}/mobile/medical/inputWoundImg.json" enctype="multipart/form-data">
		<input type="hidden" name="hospitalCd" value="01">
		<input type="hidden" name="userId" value="aaa">
		<input type="hidden" name="patientId" value="patientId01">
		<input type="hidden" name="deptCd" value=d001>
		<input type="hidden" name="doctorId" value="aaa">
		<input type="hidden" name="treatCls" value="I">
		<input type="hidden" name="excutionDtTm" value="2019-02-28 10:10:10">
		이미지파일 전송 : <input type="file" name="image"> 
		썸네일이미지파일 전송 : <input type="file" name="thumbnail">
		<input type="submit" name="업로드" value="제출"><br>
		</form>
		<div>
			<button id="regist_image" type="button">regist_image</button>
		</div>
	</div>
</div>

<script type="text/javascript">
$(document).ready(function () {

	//==== 페이지 기본 설정 { ====
	$('#divHeader').css('display', 'block');
	$('#divHeaderTitle').text("test page");

    $('#dismiss, .overlay').on('click', function () {
        $('#divMainMenu').removeClass('active');
        $('#divQuickMenu').removeClass('active');
		$('.overlay').removeClass('active');
    });
	//==== 페이지 기본 설정 } ====
	
	//==== 메뉴기능 제거 { ====
	$('.side-right').css('display', 'none');	
	$('.side-left').css('display', 'none');	
	//==== 메뉴기능 제거 } ====
		
	/////////////////////////////////////////////////////////////////////////////////////////
	// 이미지 업로드 테스트 및 이미지 정보 db 등록   
	$("#regist_image").click(function(){
			
			//alert('test alert');
		    var url=contextPath + "/mobile/medical/inputWoundImg.json";  
		    var params="";  
			
		    $("#fileUpload").ajaxForm({
		        enctype: "multipart/form-data",
		        dataType : "json",
		        url:url,      
		        success:function(args){   
		        	//alert('result : success ' + args);
		            //alert(JSON.stringify(args));
		        	$("#result").html(JSON.stringify(args));      
		        },   
		        error:function(e){  
		            alert(e.responseText);  
		        } 				
			});
			
			$("#fileUpload").submit(); 
	      
	});	
});
</script>
