Prechádzať zdrojové kódy

医生页面结构设置API

wangfeng 6 rokov pred
rodič
commit
2411f8176e

+ 69 - 0
icss-service/src/main/java/com/diagbot/facade/DoctorPageModeFacade.java

@@ -0,0 +1,69 @@
+package com.diagbot.facade;
+
+import javax.validation.Valid;
+
+import org.springframework.stereotype.Component;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.diagbot.entity.DoctorPageMode;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.DoctorPageModeServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.vo.DoctorIdVO;
+import com.diagbot.vo.DoctorPageModeVO;
+/**
+ * 
+ * @author wangfeng
+ * @Description: 医生页面模式设置
+ * @date 2018年11月20日 下午2:56:01
+ */
+@Component
+public class DoctorPageModeFacade extends DoctorPageModeServiceImpl {
+
+	/**
+	 * 保存医生页面结构设置信息
+	 * @param doctorPageModeVO
+	 * @return
+	 */
+	public boolean saveDoctorPageMode(@Valid DoctorPageModeVO doctorPageModeVO) {
+		QueryWrapper<DoctorPageMode> doctorPageModeWrapper = new QueryWrapper<>();
+		doctorPageModeWrapper.eq("doctor_id", doctorPageModeVO.getDoctorId()).eq("is_deleted", IsDeleteEnum.N.getKey());
+		DoctorPageMode datas = getOne(doctorPageModeWrapper);
+		boolean res = false;
+		if (datas != null) {
+			UpdateWrapper<DoctorPageMode> doctorPageModeUpdate = new UpdateWrapper<>();
+			doctorPageModeUpdate.eq("doctor_id", doctorPageModeVO.getDoctorId())
+			               .eq("is_deleted", IsDeleteEnum.N.getKey())
+			               .set("mode_classify",doctorPageModeVO.getModeClassify())
+			               .set("mode_value",doctorPageModeVO.getModeValue() )
+			               .set("modifier",doctorPageModeVO.getDoctorId().toString() )
+			               .set("gmt_modified", DateUtil.now());
+			 res = update(new DoctorPageMode(), doctorPageModeUpdate);
+			//throw new CommonException(CommonErrorCode.NOT_EXISTS, "该模板名已存在");
+		}else {
+			DoctorPageMode doctorPageMode = new DoctorPageMode();
+			doctorPageMode.setDoctorId(doctorPageModeVO.getDoctorId());
+			doctorPageMode.setModeClassify(doctorPageModeVO.getModeClassify());
+			doctorPageMode.setModeValue(doctorPageModeVO.getModeValue());
+			doctorPageMode.setCreator(doctorPageModeVO.getDoctorId().toString());
+			doctorPageMode.setGmtCreate(DateUtil.now());
+			res = save(doctorPageMode);
+		}
+		
+		return res;
+	}
+
+	/**
+	 * 获取医生页面结构设置信息
+	 * @param doctorIdVO
+	 * @return
+	 */
+	public DoctorPageMode getDoctorPageMode(@Valid DoctorIdVO doctorIdVO) {
+		QueryWrapper<DoctorPageMode> doctorPageModeWrapper = new QueryWrapper<>();
+		doctorPageModeWrapper.eq("doctor_id", doctorIdVO.getDoctorId()).eq("is_deleted", IsDeleteEnum.N.getKey());
+		DoctorPageMode doctorPageModeData = getOne(doctorPageModeWrapper);
+		return doctorPageModeData;
+	}
+
+}

+ 69 - 0
icss-service/src/main/java/com/diagbot/web/DoctorPageModeController.java

@@ -0,0 +1,69 @@
+package com.diagbot.web;
+
+
+import java.util.List;
+
+import javax.validation.Valid;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.DoctorPageMode;
+import com.diagbot.facade.DoctorPageModeFacade;
+import com.diagbot.vo.DoctorIdVO;
+import com.diagbot.vo.DoctorPageModeVO;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2018-11-20
+ */
+/**
+ * 
+ * @author wangfeng
+ * @Description: 医生页面结构设置(文本和半结构) 前端控制器
+ * @date 2018年11月20日 下午2:50:40
+ */
+@RestController
+@RequestMapping("/doctorPageMode")
+@Api(value = "医生页面结构设置API[by:wangfeng]", tags = { "WF——医生页面结构设置API" })
+@SuppressWarnings("unchecked")
+public class DoctorPageModeController {
+	
+	@Autowired
+	DoctorPageModeFacade doctorPageModeFacade;
+	
+	@ApiOperation(value = "保存医生页面结构设置信息[by:wangfeng]",notes = "医生id : doctorId;</br>模式分类: modeClassify;</br> 模式值: modeValue;")
+    @PostMapping("/saveDoctorPageModes")
+    @SysLogger("saveDoctorPageModes")
+    @Transactional
+    public RespDTO<Boolean> saveDoctorPageModes(@Valid @RequestBody DoctorPageModeVO doctorPageModeVO) {
+
+        boolean res = doctorPageModeFacade.saveDoctorPageMode(doctorPageModeVO);
+        
+        return RespDTO.onSuc(res);
+    }
+
+	@ApiOperation(value = "获取医生页面结构设置信息[by:wangfeng]",notes = "获取医生页面结构设置信息")
+    @PostMapping("/getDoctorPageModes")
+    @SysLogger("getDoctorPageModes")
+    @Transactional
+    public RespDTO<DoctorPageMode> getDoctorPageModes(@Valid @RequestBody DoctorIdVO doctorIdVO) {
+
+		DoctorPageMode doctorPageModeData = doctorPageModeFacade.getDoctorPageMode(doctorIdVO);
+        
+        return RespDTO.onSuc(doctorPageModeData);
+    }
+}