Browse Source

添加医生兼职科室

DESKTOP-0GD05B0\Administrator 2 years ago
parent
commit
857b565a8e

+ 27 - 0
src/main/java/thyyxxk/webserver/controller/zhuyuanyizheng/ResidentDoctorController.java

@@ -0,0 +1,27 @@
+package thyyxxk.webserver.controller.zhuyuanyizheng;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.dictionary.CodeName;
+import thyyxxk.webserver.service.zhuyuanyisheng.YiZhuPublicService;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/residentDoctor")
+public class ResidentDoctorController {
+
+    private final YiZhuPublicService server;
+
+    public ResidentDoctorController(YiZhuPublicService server) {
+        this.server = server;
+    }
+
+    @GetMapping("/getAllWards")
+    public ResultVo<List<CodeName>> getAllWards() {
+        return server.getAllWards();
+    }
+
+}

+ 32 - 0
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/YiZhuPublicDao.java

@@ -0,0 +1,32 @@
+package thyyxxk.webserver.dao.his.zhuyuanyisheng;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.dictionary.CodeName;
+
+import java.util.List;
+
+@Mapper
+public interface YiZhuPublicDao {
+
+    @Select("select rtrim(code) code, rtrim(name) name, rtrim(py_code) pyCode " +
+            "from zd_unit_code where code like '8%' order by code")
+    List<CodeName> getAllWards();
+
+    @Select("select name=(SELECT rtrim(name) FROM zd_unit_code WHERE code = b.dept), " +
+            "       code = b.dept " +
+            "from a_employee_mi a, " +
+            "     zd_dept_all b " +
+            "where code = #{code} " +
+            "  and (a.dept_code = b.dept or a.dept_code = b.small_dept) " +
+            "union " +
+            "select name=(SELECT rtrim(name) FROM zd_unit_code WHERE code = b.dept), " +
+            "       code =  b.dept " +
+            "from zy_part_time_dept a, " +
+            "     zd_dept_all b " +
+            "where a.code = #{code} " +
+            "  and (a.dept_code = b.dept or a.dept_code = b.small_dept)" +
+            "  order by code")
+    List<CodeName> getDoctorWards(String code);
+
+}

+ 0 - 9
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/YiZhuPublic.java

@@ -1,9 +0,0 @@
-package thyyxxk.webserver.service.zhuyuanyisheng;
-
-public class YiZhuPublic {
-    // 模板编辑
-    public static final int MU_BAN_BIAN_JI_QUAN_XIAN = 43;
-    // 科室主任编码
-    public static final int KE_ZHU_REN_BIAN_MA = 11;
-
-}

+ 37 - 0
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/YiZhuPublicService.java

@@ -0,0 +1,37 @@
+package thyyxxk.webserver.service.zhuyuanyisheng;
+
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.dao.his.zhuyuanyisheng.YiZhuPublicDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.dictionary.CodeName;
+import thyyxxk.webserver.service.PublicServer;
+import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.TokenUtil;
+
+import java.util.List;
+
+@Service
+public class YiZhuPublicService {
+    // 模板编辑
+    public static final int MU_BAN_BIAN_JI_QUAN_XIAN = 43;
+    // 科室主任编码
+    public static final int KE_ZHU_REN_BIAN_MA = 11;
+
+    private final YiZhuPublicDao dao;
+    private final PublicServer publicServer;
+
+    public YiZhuPublicService(YiZhuPublicDao dao, PublicServer publicServer) {
+        this.dao = dao;
+        this.publicServer = publicServer;
+    }
+
+    public ResultVo<List<CodeName>> getAllWards() {
+        if (publicServer.needRule(2, 8, 52)) {
+            return ResultVoUtil.success(dao.getAllWards());
+        } else {
+            return ResultVoUtil.success(dao.getDoctorWards(TokenUtil.getTokenUserId()));
+        }
+    }
+
+
+}