| 
					
				 | 
			
			
				@@ -5,9 +5,11 @@ import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.config.exception.ExceptionEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.dao.his.dictionary.ServiceNumberDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.dao.his.dictionary.ZdHealthEducationDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import thyyxxk.webserver.dao.his.dictionary.ZdHealthEducationTypeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.entity.ResultVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.entity.dictionary.CodeName; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.entity.dictionary.ZdHealthEducation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import thyyxxk.webserver.entity.dictionary.ZdHealthEducationType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.utils.ResultVoUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.utils.StringUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -31,9 +33,13 @@ public class ServiceNumberService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private final ZdHealthEducationDao healthEducationDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public ServiceNumberService(ServiceNumberDao dao, ZdHealthEducationDao healthEducationDao) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private final ZdHealthEducationTypeDao zdHealthEducationTypeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ServiceNumberService(ServiceNumberDao dao, ZdHealthEducationDao healthEducationDao, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                ZdHealthEducationTypeDao zdHealthEducationTypeDao) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.dao = dao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.healthEducationDao = healthEducationDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.zdHealthEducationTypeDao = zdHealthEducationTypeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public ResultVo<Map<String, List<CodeName>>> selectServiceNumberDict(){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -109,4 +115,52 @@ public class ServiceNumberService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ResultVo<List<ZdHealthEducationType>> selectHeType(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return ResultVoUtil.success(zdHealthEducationTypeDao.selectHeType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ResultVo<Map<String, Object>> saveHeType(ZdHealthEducationType zdHealthEducationType){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(null == zdHealthEducationType || zdHealthEducationType.getCode() == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "健康教育类型信息不存在,请检查!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Object> resultMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String code = zdHealthEducationType.getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ZdHealthEducationType type = zdHealthEducationTypeDao.selectHeTypeByCode(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(null != type){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                num = zdHealthEducationTypeDao.updateHeTypeByCode(zdHealthEducationType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                num = zdHealthEducationTypeDao.insert(zdHealthEducationType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(num == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存健康教育类型信息失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            resultMap.put("cg", "保存健康教育类型信息成功!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResultVoUtil.success(resultMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch(Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存健康教育类型信息失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ResultVo<Map<String, Object>> delHeTypeByCode(String code) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtil.isBlank(code)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有健康教育类型编码,请检查!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Object> resultMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int num = zdHealthEducationTypeDao.deleteHeTypeByCode(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(num == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除健康教育类型失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            resultMap.put("cg", "删除健康教育类型成功!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResultVoUtil.success(resultMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch(Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除健康教育类型失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |