Jelajahi Sumber

开始做住院费用清单

lighter 3 tahun lalu
induk
melakukan
bcd8c99224

+ 39 - 0
src/main/java/thyyxxk/webserver/controller/inpatient/ChargeListController.java

@@ -0,0 +1,39 @@
+package thyyxxk.webserver.controller.inpatient;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.inpatient.chargelist.BriefPatInfo;
+import thyyxxk.webserver.service.inpatient.ChargeListService;
+import thyyxxk.webserver.utils.ListUtil;
+import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.StringUtil;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/chargeList")
+public class ChargeListController {
+    private final ChargeListService service;
+
+    @Autowired
+    public ChargeListController(ChargeListService service) {
+        this.service = service;
+    }
+
+    @GetMapping("/selectBriefPatInfo")
+    public ResultVo<List<BriefPatInfo>> selectBriefPatInfo(@RequestParam("patNo") String patNo) {
+        if (StringUtil.isBlank(patNo)) {
+            return ResultVoUtil.fail(ExceptionEnum.INVALID_PARAM, "住院号不能为空!");
+        }
+        List<BriefPatInfo> resultList = service.selectBriefPatInfo(patNo);
+        if (ListUtil.isBlank(resultList)) {
+            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
+        }
+        return ResultVoUtil.success(resultList);
+    }
+}

+ 20 - 0
src/main/java/thyyxxk/webserver/dao/his/inpatient/ChargeListDao.java

@@ -0,0 +1,20 @@
+package thyyxxk.webserver.dao.his.inpatient;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.inpatient.chargelist.BriefPatInfo;
+
+import java.util.List;
+
+@Mapper
+public interface ChargeListDao {
+
+    @Select("select rtrim(inpatient_no) as patNo,admiss_times as times, " +
+            "rtrim(name) as name, admiss_date as admdate,dis_date as disdate " +
+            "from zy_inactpatient where inpatient_no=#{patNo} " +
+            "union " +
+            "select rtrim(inpatient_no) as patNo,admiss_times as times, " +
+            "rtrim(name) as name, admiss_date as admdate,dis_date as disdate " +
+            "from zy_actpatient where inpatient_no=#{patNo}")
+    List<BriefPatInfo> selectBriefPatInfo(String patNo);
+}

+ 26 - 0
src/main/java/thyyxxk/webserver/entity/inpatient/chargelist/BriefPatInfo.java

@@ -0,0 +1,26 @@
+package thyyxxk.webserver.entity.inpatient.chargelist;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+@Data
+public class BriefPatInfo {
+    private String patNo;
+    private Integer times;
+    private String name;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date admdate;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date disdate;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date begndate;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date enddate;
+}

+ 22 - 0
src/main/java/thyyxxk/webserver/service/inpatient/ChargeListService.java

@@ -0,0 +1,22 @@
+package thyyxxk.webserver.service.inpatient;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.dao.his.inpatient.ChargeListDao;
+import thyyxxk.webserver.entity.inpatient.chargelist.BriefPatInfo;
+
+import java.util.List;
+
+@Service
+public class ChargeListService {
+    private final ChargeListDao dao;
+
+    @Autowired
+    public ChargeListService(ChargeListDao dao) {
+        this.dao = dao;
+    }
+
+    public List<BriefPatInfo> selectBriefPatInfo(String patNo) {
+        return dao.selectBriefPatInfo(patNo);
+    }
+}