lihong hai 1 ano
pai
achega
84cd58a160

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

@@ -1,11 +1,13 @@
 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.entity.ResultVo;
 import thyyxxk.webserver.entity.dictionary.CodeName;
 import thyyxxk.webserver.entity.outpatient.triage.*;
 import thyyxxk.webserver.service.outpatient.triage.TriageService;
+import thyyxxk.webserver.utils.AssertUtil;
 import thyyxxk.webserver.utils.ResultVoUtil;
 
 import java.util.List;
@@ -110,4 +112,20 @@ public class TriageController {
     public ResultVo<String> notifyMessage(@RequestBody MessageForPush param) {
         return service.notifyMessage(param);
     }
+
+    @PostMapping("/saveNewCard")
+    public ResultVo<String> saveNewCard(@RequestBody Map<String,Object> param) {
+        String oldPatientId = Convert.toStr(param.get("oldPatientId"));
+        String newPatientId = Convert.toStr(param.get("newPatientId"));
+        AssertUtil.isnotBlank(oldPatientId,"旧门诊号不能为空");
+        AssertUtil.isnotBlank(newPatientId,"新门诊号不能为空");
+        return service.saveNewCard(oldPatientId,newPatientId);
+    }
+
+    @PostMapping("/queryCardInfo")
+    public ResultVo<Map<String,Object>> queryCardInfo(@RequestBody Map<String,Object> param) {
+        String oldPatientId = Convert.toStr(param.get("oldPatientId"));
+        String newPatientId = Convert.toStr(param.get("newPatientId"));
+        return service.queryCardInfo(oldPatientId,newPatientId);
+    }
 }

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

@@ -1,11 +1,21 @@
 package thyyxxk.webserver.dao.his.outpatient.triage;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Insert;
+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.dictionary.CodeName;
-import thyyxxk.webserver.entity.outpatient.triage.*;
+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 java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface TriageDao {
@@ -216,4 +226,8 @@ public interface TriageDao {
 
     @Select("select rtrim(code_rs) from a_employee_mi where dept_code='2080000' and isnull(del_flag,'0')!='1'")
     List<String> selectCodeRsList();
+    @Update(" update t_wechat_patient_bind set patient_id=#{newPatientId},ic_card_no=#{icCardNo} where patient_id=#{oldPatientId} ")
+    int saveNewCard(@Param("oldPatientId") String oldPatientId, @Param("newPatientId")String newPatientId,@Param("icCardNo") String icCardNo);
+    @Select(" select rtrim(patient_id) patient_id,rtrim(ic_card_no) ic_card_no,rtrim(name) name from mz_patient_mi where patient_id=#{newPatientId} ")
+    Map<String,Object> selectCardInfo(@Param("newPatientId") String newPatientId);
 }

+ 40 - 3
src/main/java/thyyxxk/webserver/service/outpatient/triage/TriageService.java

@@ -1,5 +1,7 @@
 package thyyxxk.webserver.service.outpatient.triage;
 
+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.metadata.IPage;
@@ -8,19 +10,34 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import thyyxxk.webserver.config.exception.BizException;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.Capacity;
 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.*;
+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.socketmessage.ApiMessageBody;
 import thyyxxk.webserver.entity.socketmessage.SendUserList;
 import thyyxxk.webserver.service.externalhttp.WebSocketService;
 import thyyxxk.webserver.service.outpatient.wxapi.SendWxInfoService;
-import thyyxxk.webserver.utils.*;
+import thyyxxk.webserver.utils.AssertUtil;
+import thyyxxk.webserver.utils.DateUtil;
+import thyyxxk.webserver.utils.IdCardUtil;
+import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.StringUtil;
+import thyyxxk.webserver.utils.TokenUtil;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author dj
@@ -291,4 +308,24 @@ public class TriageService {
         }
         return ResultVoUtil.success();
     }
+
+    public ResultVo<String> saveNewCard(String oldPatientId, String newPatientId) {
+        Map<String,Object> oldPatientInfo = dao.selectCardInfo(oldPatientId);
+        AssertUtil.isnotBlank(oldPatientInfo,"未查询到该病人信息,请确认旧门诊号是否填写正确?");
+        Map<String,Object> patientInfo = dao.selectCardInfo(newPatientId);
+        AssertUtil.isnotBlank(patientInfo,"未查询到该病人信息,请确认新门诊号是否填写正确?");
+        if(!Convert.toStr(oldPatientInfo.get("name"),"").equals(Convert.toStr(patientInfo.get("name"),""))){
+            throw new BizException(ExceptionEnum.LOGICAL_ERROR, StrUtil.format("旧门诊号对应的病人为[{}],新门诊号对应的病人为[{}],不是同一病人,请重新填写数据!",Convert.toStr(oldPatientInfo.get("name"),""),Convert.toStr(patientInfo.get("name"),"")));
+        }
+        dao.saveNewCard(oldPatientId, newPatientId, Convert.toStr(patientInfo.get("ic_card_no"),""));
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION,"保存成功");
+    }
+
+    public ResultVo<Map<String, Object>> queryCardInfo(String oldPatientId, String newPatientId) {
+        AssertUtil.isnotBlank(oldPatientId,"旧门诊号不能为空");
+        AssertUtil.isnotBlank(newPatientId,"新门诊号不能为空");
+        Map<String,Object> patientInfo = dao.selectCardInfo(newPatientId);
+        AssertUtil.isnotBlank(patientInfo,"未查询到该病人信息,请确认新门诊号是否填写正确?");
+        return ResultVoUtil.success(patientInfo);
+    }
 }