فهرست منبع

Revert "Revert "진료관리 설정 관련 컨트롤러 서비스 추가""

This reverts commit 99cac1ae6c963a6d4115faa91fca7386565bed07.
huiwon.seo 4 سال پیش
والد
کامیت
fb2e5653d2

+ 77 - 0
src/main/java/com/lemon/lifecenter/controller/ClinicController.java

@@ -48,6 +48,7 @@ import com.lemon.lifecenter.common.LifeCenterController;
 import com.lemon.lifecenter.common.LifeCenterFileDownload;
 import com.lemon.lifecenter.common.LifeCenterFunction;
 import com.lemon.lifecenter.common.LifeCenterSessionController;
+import com.lemon.lifecenter.dto.ClinicConfigurationDTO;
 import com.lemon.lifecenter.dto.FileDownloadDTO;
 import com.lemon.lifecenter.dto.PatientDTO;
 import com.lemon.lifecenter.dto.PatientMemoDTO;
@@ -988,5 +989,81 @@ public class ClinicController extends LifeCenterController {
             i++;
         }
     }
+	
+	@RequestMapping("/api/configuration")
+	public @ResponseBody ClinicConfigurationDTO getConfigurationAPI(
+			@RequestParam(value = "centerCode", required = true, defaultValue = "") int centerCode) {
+
+		ClinicConfigurationDTO dto = new ClinicConfigurationDTO();
+		dto.setCenterCode(centerCode);
+		
+		return clinicService.selectConfiguration(dto);
+	}
+
+	@RequestMapping(value = "/api/configuration", method = RequestMethod.POST)
+	public @ResponseBody String insertConfigurationAPI(@ModelAttribute("dto") final ClinicConfigurationDTO dto) {
+
+		try {
+			clinicService.insertConfiguration(dto);
+
+			JSONObject json = new JSONObject();
+
+			json.put("code", "00");
+			json.put("message", "");
+
+			return json.toString();
+		} catch (Exception e) {
+			JSONObject json = new JSONObject();
+
+			json.put("code", "01");
+			json.put("message", e.getLocalizedMessage());
+
+			return json.toString();
+		}
+	}
+
+	@RequestMapping(value = "/api/configuration", method = RequestMethod.DELETE)
+	public @ResponseBody String deleteConfigurationAPI(@ModelAttribute("dto") final ClinicConfigurationDTO dto) {
+
+		try {
+			clinicService.deleteConfiguration(dto);
+
+			JSONObject json = new JSONObject();
+
+			json.put("code", "00");
+			json.put("message", "");
+
+			return json.toString();
+		} catch (Exception e) {
+			JSONObject json = new JSONObject();
+
+			json.put("code", "01");
+			json.put("message", e.getLocalizedMessage());
+
+			return json.toString();
+		}
+	}
+
+	@RequestMapping(value = "/api/configuration", method = RequestMethod.PATCH)
+	public @ResponseBody String updateConfigurationAPI(@ModelAttribute("dto") final ClinicConfigurationDTO dto) {
+
+		try {
+			clinicService.updateConfiguration(dto);
+
+			JSONObject json = new JSONObject();
+
+			json.put("code", "00");
+			json.put("message", "");
+
+			return json.toString();
+		} catch (Exception e) {
+			JSONObject json = new JSONObject();
+
+			json.put("code", "01");
+			json.put("message", e.getLocalizedMessage());
+
+			return json.toString();
+		}
+  }
 }
 

+ 23 - 2
src/main/java/com/lemon/lifecenter/service/ClinicService.java

@@ -5,8 +5,10 @@ import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.lemon.lifecenter.dto.ClinicConfigurationDTO;
 import com.lemon.lifecenter.dto.PatientMemoDTO;
 import com.lemon.lifecenter.dto.PatientPHRLatestDTO;
+import com.lemon.lifecenter.mapper.ClinicConfigurationMapper;
 import com.lemon.lifecenter.mapper.PatientMemoMapper;
 import com.lemon.lifecenter.mapper.PatientPHRLatestMapper;
 
@@ -14,10 +16,13 @@ import com.lemon.lifecenter.mapper.PatientPHRLatestMapper;
 public class ClinicService {
 
 	 @Autowired
-    private PatientPHRLatestMapper mapperPHRLatest;
+     private PatientPHRLatestMapper mapperPHRLatest;
 	
 	 @Autowired
-	private PatientMemoMapper mapperMemo;
+	 private PatientMemoMapper mapperMemo;
+	 
+	 @Autowired
+	 private ClinicConfigurationMapper mapperConfiguration;
 	 
 	public void insertPHRLatest(PatientPHRLatestDTO dto) {
 		mapperPHRLatest.insertPHRLatest(dto);
@@ -46,4 +51,20 @@ public class ClinicService {
     public void deleteMemo(PatientMemoDTO dto) {
 		mapperMemo.deleteMemo(dto);
 	}
+    
+    public void insertConfiguration(ClinicConfigurationDTO dto) {
+    	mapperConfiguration.insertConfiguration(dto);
+    }
+    
+    public ClinicConfigurationDTO selectConfiguration(ClinicConfigurationDTO dto) {
+    	return mapperConfiguration.selectConfiguration(dto);
+    }
+    
+    public void updateConfiguration(ClinicConfigurationDTO dto) {
+    	mapperConfiguration.updateConfiguration(dto);
+    }
+    
+    public void deleteConfiguration(ClinicConfigurationDTO dto) {
+    	mapperConfiguration.deleteConfiguration(dto);
+    }
 }