Browse Source

入院接收

lighter 4 months ago
parent
commit
63d73b90ed

+ 1 - 0
src/main/java/thyyxxk/webserver/constants/BedStatusEnum.java

@@ -7,6 +7,7 @@ import java.util.List;
  * 床位状态:1入院;2:安排;3:待出院;4:转科;5:出院9:召回
  */
 public enum BedStatusEnum {
+    PRE_ADMISS("0", "待入院"),
     ADMISSION("1","入院"),
     ARRANGE("2","安排"),
     STAY_OUT_OF_THE_HOSPITAL("3","待出院"),

+ 22 - 4
src/main/java/thyyxxk/webserver/controller/medicaladvice/patientinfo/AdjustBedController.java

@@ -2,12 +2,11 @@ package thyyxxk.webserver.controller.medicaladvice.patientinfo;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.beans.factory.annotation.Autowired;
-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 org.springframework.web.bind.annotation.*;
 import thyyxxk.webserver.config.auth.PassToken;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.inpatient.ZyActpatient;
 import thyyxxk.webserver.entity.medicaladvice.medicamanage.MzZyReq;
 import thyyxxk.webserver.entity.medicaladvice.medicamanage.ZyBedPreMsg;
 import thyyxxk.webserver.entity.medicaladvice.medicamanage.patientinfo.ZyBedMi;
@@ -45,6 +44,25 @@ public class AdjustBedController {
     public ResultVo<IPage<ZyBedPreMsg>> queryZyBedPreMsg(@RequestBody ZyBedPreMsg msg){
         return service.queryZyBedPreMsg(msg);
     }
+
+    @GetMapping("queryPreAdmiss")
+    public ResultVo<List<ZyActpatient>> queryPreAdmiss(@RequestParam("ward") String ward) {
+        List<ZyActpatient> list = service.queryPreAdmiss(ward);
+        if (null == list || list.isEmpty()) {
+            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "没有待接收的患者。");
+        }
+        return ResultVoUtil.success(list);
+    }
+
+    @PostMapping("receivePatient")
+    public ResultVo<String> receivePatient(@RequestBody ZyActpatient actpatient) {
+        int res = service.receivePatient(actpatient);
+        if (res > 0) {
+            return ResultVoUtil.success("接收成功。");
+        }
+        return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "接收失败,更新数据失败。");
+    }
+
     @PostMapping("getIdleBedNoList")
     public ResultVo<List<Map>> getIdleBedNoList(@RequestBody ZyBedPreMsg msg){
         return service.getIdleBedNoList(msg);

+ 13 - 0
src/main/java/thyyxxk/webserver/dao/his/medicaladvice/patientinfo/AdjustBedDao.java

@@ -4,6 +4,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
+import thyyxxk.webserver.entity.inpatient.ZyActpatient;
 import thyyxxk.webserver.entity.medicaladvice.medicamanage.MzZyReq;
 import thyyxxk.webserver.entity.medicaladvice.medicamanage.patientinfo.ZyBedMi;
 
@@ -64,4 +65,16 @@ public interface AdjustBedDao {
     Integer queryIsPreBed(ZyBedMi param);
     @Select(" select top 1 rtrim(name) name  from mz_patient_mi where patient_id =#{patientId}  ")
     String selectPatientMi(@Param("patientId") String patientId);
+
+
+    @Select("select rtrim(inpatient_no) as inpatientNo, " +
+            "admiss_times,rtrim(name) as name,admiss_date,rtrim(bed_no) as bedNo, " +
+            "gender=case when sex='1' then N'男' when sex='2' then N'女' else N'未知' end, " +
+            "wardName=(select rtrim(d.name) from zd_unit_code d where d.code=ward), " +
+            "smallDeptName=(select rtrim(d.name) from zd_unit_code d where d.code=small_dept) " +
+            "from zy_actpatient where ward=#{ward} and bed_status='0'")
+    List<ZyActpatient> getPreAdmPatients(String ward);
+
+    @Update("update zy_actpatient set bed_status='1' where inpatient_no=#{patNo}")
+    int updateBedStatus(String patNo);
 }

+ 1 - 0
src/main/java/thyyxxk/webserver/dao/his/medicaladvice/patientinfo/ZyBedPreMsgDao.java

@@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import thyyxxk.webserver.entity.medicaladvice.medicamanage.ZyBedPreMsg;
 
+
 /**
  * 预分配床位消息表
  * 

+ 8 - 0
src/main/java/thyyxxk/webserver/service/medicaladvice/patientinfo/AdjustBedService.java

@@ -20,6 +20,7 @@ import thyyxxk.webserver.constants.Message;
 import thyyxxk.webserver.dao.his.medicaladvice.patientinfo.AdjustBedDao;
 import thyyxxk.webserver.dao.his.medicaladvice.patientinfo.ZyBedPreMsgDao;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.inpatient.ZyActpatient;
 import thyyxxk.webserver.entity.login.UserInfo;
 import thyyxxk.webserver.entity.medicaladvice.medicamanage.MzZyReq;
 import thyyxxk.webserver.entity.medicaladvice.medicamanage.ZyBedPreMsg;
@@ -161,6 +162,13 @@ public class AdjustBedService {
         return ResultVoUtil.success(page);
     }
 
+    public List<ZyActpatient> queryPreAdmiss(String ward) {
+        return dao.getPreAdmPatients(ward);
+    }
+
+    public int receivePatient(ZyActpatient actpatient) {
+        return dao.updateBedStatus(actpatient.getInpatientNo());
+    }
 
     public ResultVo<List<Map>> getIdleBedNoList(ZyBedPreMsg msg) {
         List<Map> list = new ArrayList<>();

+ 1 - 1
src/main/java/thyyxxk/webserver/service/zygl/ZyActpatientService.java

@@ -144,7 +144,7 @@ public class ZyActpatientService {
         zyActpatient.setAdmissDate(now);
         zyActpatient.setVisitType(ZyActpatient.SELF_PAYING_RESPONCE_TYPE);
         zyActpatient.setTimesBilled(1);
-        zyActpatient.setBedStatus(BedStatusEnum.ADMISSION.code);
+        zyActpatient.setBedStatus(BedStatusEnum.PRE_ADMISS.code);
         zyActpatient.setZySerialNo(zyConfigService.getZySerialNo());
         zyActpatient.setResponceType(StrUtil.isBlank(zyActpatient.getResponceType()) ? ZyActpatient.SELF_PAYING_RESPONCE_TYPE : zyActpatient.getResponceType());
         zyActpatient.setBalance(BigDecimal.ZERO);