瀏覽代碼

急诊登记功能

lighter 5 月之前
父節點
當前提交
d235c8c638

+ 31 - 0
src/main/java/thyyxxk/webserver/controller/outpatient/triage/TriageController.java

@@ -3,8 +3,10 @@ package thyyxxk.webserver.controller.outpatient.triage;
 import cn.hutool.core.convert.Convert;
 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.dictionary.CodeName;
+import thyyxxk.webserver.entity.inpatient.chargeinputinquiry.InquiryParams;
 import thyyxxk.webserver.entity.outpatient.triage.*;
 import thyyxxk.webserver.service.outpatient.triage.TriageService;
 import thyyxxk.webserver.utils.AssertUtil;
@@ -139,4 +141,33 @@ public class TriageController {
         String newPatientId = Convert.toStr(param.get("newPatientId"));
         return service.queryCardInfo(oldPatientId,newPatientId);
     }
+
+    @GetMapping("/getEmergencyRegInfo")
+    public ResultVo<EmergencyRegInfo> getEmergencyRegInfo(
+            @RequestParam("patientId") String patientId, @RequestParam("times") Integer times) {
+        EmergencyRegInfo info = service.getEmergencyRegInfo(patientId,times);
+        if (null == info) {
+            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "没有找到患者的挂号信息。");
+        }
+        return ResultVoUtil.success(info);
+    }
+
+    @PostMapping("/saveEmergencyRegInfo")
+    public ResultVo<Integer> saveEmergencyRegInfo(@RequestBody EmergencyRegInfo info) {
+        int res = service.saveEmergencyRegInfo(info);
+        if (res > 0) {
+            return ResultVoUtil.success(res);
+        }
+        return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "保存失败。");
+    }
+
+    @GetMapping("/getEmrRegExportData")
+    public ResultVo<List<EmergencyRegInfo>> getEmrRegExportData(
+            @RequestParam("start") String start, @RequestParam("end") String end) {
+        List<EmergencyRegInfo> list = service.getEmrRegExportData(start, end);
+        if (list.isEmpty()) {
+            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "没有可以导出的数据。");
+        }
+        return ResultVoUtil.success(list);
+    }
 }

+ 26 - 0
src/main/java/thyyxxk/webserver/dao/his/outpatient/triage/EmergencyRegDao.java

@@ -0,0 +1,26 @@
+package thyyxxk.webserver.dao.his.outpatient.triage;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.outpatient.triage.EmergencyRegInfo;
+
+public interface EmergencyRegDao extends BaseMapper<EmergencyRegInfo> {
+
+    @Select("select " +
+            "rtrim(a.patient_id) as patientId,a.times,level=N'三级', " +
+            "rtrim(a.name) as patientName,a.request_day as regTime, " +
+            "gender=case when b.sex='1' then N'男' when b.sex='2' then N'女' else N'未知' end, " +
+            "rtrim(b.social_no) as idCard,consciousness=N'清醒',rtrim(b.phone_no) as phone, " +
+            "rtrim(b.adress) as liveAddress,createTime=getdate() " +
+            "from mzy_reqrec a,mz_patient_mi b " +
+            "where a.patient_id=#{patientId} and a.times=#{times} " +
+            "and a.patient_id=b.patient_id")
+    EmergencyRegInfo getRawEntity(String patientId, Integer times);
+
+    @Select("select top 1 rtrim(inpatient_no) from a_patient_mi where social_no=#{idNo}")
+    String getInpatientNo(String idNo);
+    
+    @Select("select rtrim(name) from zd_unit_code where code= " +
+            "(select zk_ward from zy_actpatient where inpatient_no=#{patNo})")
+    String getDeptName(String patNo);
+}

+ 10 - 10
src/main/java/thyyxxk/webserver/dao/his/outpatient/triage/TriageDao.java

@@ -159,20 +159,20 @@ public interface TriageDao {
 
     // 获取所有挂号病人
     @Select("<script>" +
-            "select visit_date,patient_id, times, name, " +
-            "dept_code, dept_name=(select name from zd_unit_code where code=(select dept_code from " +
-            "mzfz_zd_dept_room where room_code=a.room_code)), " +
+            "select visit_date,rtrim(a.patient_id) as patient_id,a.times,rtrim(b.name) as name,dept_code, " +
+            "dept_name=(select name from zd_unit_code where code=dept_code), " +
             "room_code,room_name=(select room_name from mzfz_zd_dept_room where room_code=a.room_code), " +
-            "phone_no=(select rtrim(isnull(phone_no,'-')) from mz_patient_mi where patient_id=a.patient_id)," +
-            "phone=(select rtrim(isnull(phone_no,'-')) from mz_patient_mi where patient_id=a.patient_id)," +
-            "address=(select rtrim(isnull(adress,'-')) from mz_patient_mi where patient_id=a.patient_id)," +
+            "phone=rtrim(isnull(b.phone_no,'-')),rtrim(b.social_no) as socialNo, " +
+            "address=rtrim(isnull(b.adress,'-')), " +
+            "gender=case when b.sex='1' then N'男' when b.sex='2' then N'女' else N'未知' end, " +
             "room_status=(select status_flag from mzfz_zd_dept_room where room_code=a.room_code), " +
             "doctor_code,doctor_name=(select name from a_employee_mi where code=doctor_code), " +
-            "serial_no, gh_no, req_type,reqName=(select rtrim(name) from mzy_zd_charge_type where code=a.req_type), " +
-            "fz_no, slow_flag, status_flag, status_time,call_time, req_order, ampm, " +
-            "req_fee=(select req_fee from mzy_reqrec where patient_id=a.patient_id and times=a.times)," +
+            "serial_no,gh_no,req_type,reqName=(select rtrim(name) from mzy_zd_charge_type where code=a.req_type), " +
+            "fz_no,slow_flag,status_flag,status_time,call_time,req_order,ampm, " +
+            "req_fee=(select req_fee from mzy_reqrec where patient_id=a.patient_id and times=a.times), " +
             "clinic_fee=(select clinic_fee from mzy_reqrec where patient_id=a.patient_id and times=a.times) " +
-            "from mzfz_patient_order a where datediff(day, visit_date, getdate())=0 " +
+            "from mzfz_patient_order a,mz_patient_mi b where datediff(day,visit_date,getdate())=0 " +
+            "and a.patient_id=b.patient_id " +
             "and (a.patient_id like #{content} or a.name like #{content}) " +
             "and dept_code in " +
             "<foreach collection='deptCodes' item='deptCode' open='(' separator=',' close=')'>" +

+ 143 - 0
src/main/java/thyyxxk/webserver/entity/outpatient/triage/EmergencyRegInfo.java

@@ -0,0 +1,143 @@
+package thyyxxk.webserver.entity.outpatient.triage;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import java.util.Date;
+
+@Data
+@TableName(value = "t_emergency_reg_info")
+public class EmergencyRegInfo {
+	@TableId(type = IdType.AUTO)
+	private Integer id;
+
+	/**
+	 * 门诊ID号
+	 */
+	private String patientId;
+
+	/**
+	 * 就诊次数
+	 * */
+	private Integer times;
+
+	/**
+	 * 患者姓名
+	 */
+	private String patientName;
+
+	/**
+	 * 挂号时间
+	 */
+	private Date regTime;
+
+	/**
+	 * 级别(默认三级)
+	 */
+	private String level;
+
+	/**
+	 * 患者性别
+	 */
+	private String gender;
+
+	/**
+	 * 患者年龄
+	 */
+	private String age;
+
+	/**
+	 * 患者脉搏
+	 */
+	private String pulse;
+
+	/**
+	 * 患者血压
+	 */
+	private String bloodPressure;
+
+	/**
+	 * 患者体温
+	 */
+	private String temperature;
+
+	/**
+	 * 类别
+	 */
+	private String type;
+
+	/**
+	 * 患者意识
+	 */
+	private String consciousness;
+
+	/**
+	 * 诊断编码
+	 */
+	private String icdCode;
+
+	/**
+	 * 诊断名称
+	 */
+	private String icdName;
+
+	/**
+	 * 五大中心诊断编码
+	 */
+	private String icdCode5c;
+
+	/**
+	 * 五大中心诊断名称
+	 */
+	private String icdName5c;
+
+	/**
+	 * 科室
+	 */
+	private String deptClass;
+
+	/**
+	 * 患者住址
+	 */
+	private String liveAddress;
+
+	/**
+	 * 患者手机号
+	 */
+	private String phone;
+
+	/**
+	 * 登记人编码
+	 */
+	private String createStaffCode;
+
+	/**
+	 * 登记人姓名
+	 */
+	private String createStaffName;
+
+	/**
+	 * 去向
+	 */
+	private String dest;
+
+	/**
+	 * 住院科室
+	 */
+	private String hospitalization;
+
+	/**
+	 * 备注
+	 */
+	private String remark;
+
+	/**
+	 * 登记时间
+	 */
+	private Date createTime;
+
+	@TableField(exist = false)
+	private String idCard;
+}

+ 52 - 7
src/main/java/thyyxxk/webserver/service/outpatient/triage/TriageService.java

@@ -4,6 +4,7 @@ import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
@@ -13,19 +14,17 @@ import thyyxxk.webserver.config.exception.BizException;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.Capacity;
 import thyyxxk.webserver.constants.Gender;
+import thyyxxk.webserver.dao.his.outpatient.triage.EmergencyRegDao;
 import thyyxxk.webserver.dao.his.outpatient.triage.TriageDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.dictionary.CodeName;
-import thyyxxk.webserver.entity.outpatient.triage.FloorScreen;
-import thyyxxk.webserver.entity.outpatient.triage.MessageForPush;
-import thyyxxk.webserver.entity.outpatient.triage.MzYshTzxx;
-import thyyxxk.webserver.entity.outpatient.triage.MzfzPatientOrder;
-import thyyxxk.webserver.entity.outpatient.triage.MzfzZdDeptRoom;
-import thyyxxk.webserver.entity.outpatient.triage.TriageNotifyRelation;
+import thyyxxk.webserver.entity.inpatient.chargeinputinquiry.InquiryParams;
+import thyyxxk.webserver.entity.outpatient.triage.*;
 import thyyxxk.webserver.entity.socketmessage.ApiMessageBody;
 import thyyxxk.webserver.entity.socketmessage.SendUserList;
 import thyyxxk.webserver.service.externalhttp.WebSocketService;
 import thyyxxk.webserver.service.outpatient.wxapi.SendWxInfoService;
+import thyyxxk.webserver.service.redislike.RedisLikeService;
 import thyyxxk.webserver.utils.AssertUtil;
 import thyyxxk.webserver.utils.DateUtil;
 import thyyxxk.webserver.utils.IdCardUtil;
@@ -46,13 +45,17 @@ import java.util.Map;
 @Service
 public class TriageService {
     private final TriageDao dao;
+    private final EmergencyRegDao erdao;
     private final WebSocketService socketService;
     private final SendWxInfoService sendWxInfoService;
+    private final RedisLikeService redis;
 
-    public TriageService(TriageDao dao, WebSocketService socketService, SendWxInfoService sendWxInfoService) {
+    public TriageService(TriageDao dao, EmergencyRegDao erdao, WebSocketService socketService, SendWxInfoService sendWxInfoService, RedisLikeService redis) {
         this.dao = dao;
+        this.erdao = erdao;
         this.socketService = socketService;
         this.sendWxInfoService = sendWxInfoService;
+        this.redis = redis;
     }
 
     public String getBigScreenFooter() {
@@ -351,4 +354,46 @@ public class TriageService {
         AssertUtil.isnotBlank(patientInfo,"未查询到该病人信息,请确认新门诊号是否填写正确?");
         return ResultVoUtil.success(patientInfo);
     }
+
+    public EmergencyRegInfo getEmergencyRegInfo(String patientId, Integer times) {
+        QueryWrapper<EmergencyRegInfo> wrapper = new QueryWrapper<>();
+        wrapper.eq("patient_id", patientId);
+        wrapper.eq("times", times);
+        EmergencyRegInfo info = erdao.selectOne(wrapper);
+        if (null == info) {
+            info = erdao.getRawEntity(patientId, times);
+        }
+        if (null == info) {
+            return null;
+        }
+        String idCard = info.getIdCard();
+        if (IdCardUtil.isValidatedIdCard(idCard)) {
+            info.setAge(IdCardUtil.getAgeByIdCard(idCard) + "岁");
+            String inpatientNo = erdao.getInpatientNo(idCard);
+            if (StringUtil.notBlank(inpatientNo)) {
+                info.setHospitalization(erdao.getDeptName(inpatientNo));
+            }
+        }
+        String userCode = TokenUtil.getInstance().getTokenUserId();
+        String userName = redis.getEmployeeName(userCode);
+        info.setCreateStaffCode(userCode);
+        info.setCreateStaffName(userName);
+        return info;
+    }
+
+    public Integer saveEmergencyRegInfo(EmergencyRegInfo info) {
+        if (null != info.getId()) {
+            erdao.updateById(info);
+        } else {
+            erdao.insert(info);
+        }
+        return info.getId();
+    }
+
+    public List<EmergencyRegInfo> getEmrRegExportData(String start, String end) {
+        QueryWrapper<EmergencyRegInfo> wrapper = new QueryWrapper<>();
+        wrapper.ge("create_time", start);
+        wrapper.le("create_time", end);
+        return erdao.selectList(wrapper);
+    }
 }