浏览代码

集成医保身份审核模块。

lighter 4 年之前
父节点
当前提交
8b21ac7124

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>0.5</version>
+    <version>0.6</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
 

+ 2 - 0
src/main/java/thyyxxk/webserver/config/exception/GlobalExceptionHandler.java

@@ -13,6 +13,7 @@ public class GlobalExceptionHandler {
     @ExceptionHandler(value = BizException.class)
     @ResponseBody
     public DJRet bizExceptionHandler(BizException e){
+        e.printStackTrace();
         log.error("发生业务异常:{}", e.getMessage());
         return DJRet.fail(e.getErrorEnum());
     }
@@ -20,6 +21,7 @@ public class GlobalExceptionHandler {
     @ExceptionHandler(value = NullPointerException.class)
     @ResponseBody
     public DJRet exceptionHandler(NullPointerException e){
+        e.printStackTrace();
         log.error("发生空指针异常:{}", e.getMessage());
         return DJRet.fail(ExceptionEnum.NULL_POINTER);
     }

+ 8 - 0
src/main/java/thyyxxk/webserver/controller/settings/Notification.java

@@ -1,11 +1,14 @@
 package thyyxxk.webserver.controller.settings;
 
 import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import thyyxxk.webserver.pojo.DJRet;
 import thyyxxk.webserver.pojo.settings.notification.SendMessageParam;
+import thyyxxk.webserver.utils.TokenUtil;
 import thyyxxk.webserver.websocket.WebSocketServer;
 
+@Slf4j
 @RestController
 @RequestMapping("/notification")
 public class Notification {
@@ -20,7 +23,12 @@ public class Notification {
         JSONObject obj = new JSONObject();
         obj.put("name", "systemNotification");
         obj.put("message", param.getMessage());
+        if (null != param.getRefreshDelay()) {
+            int delay = param.getRefreshDelay() * 1000;
+            obj.put("refreshDelay", delay);
+        }
         WebSocketServer.sendMessageToAll(obj.toJSONString());
+        log.info("发送全体消息 => 操作员:{},消息体:{}", TokenUtil.getTokenUserId(), obj);
         return DJRet.success();
     }
 

+ 43 - 0
src/main/java/thyyxxk/webserver/controller/yibao/YbVerifyController.java

@@ -0,0 +1,43 @@
+package thyyxxk.webserver.controller.yibao;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import thyyxxk.webserver.pojo.DJRet;
+import thyyxxk.webserver.pojo.yibao.patient.PatientPojo;
+import thyyxxk.webserver.pojo.yibao.ybverify.CancelRegisterRequestPojo;
+import thyyxxk.webserver.service.yibao.YbVerifyService;
+import thyyxxk.webserver.utils.TokenUtil;
+
+@RestController
+@RequestMapping("/ybVerify")
+public class YbVerifyController {
+    private final YbVerifyService service;
+
+    @Autowired
+    public YbVerifyController(YbVerifyService service) {
+        this.service = service;
+    }
+
+    @PostMapping("/approveYbsf")
+    public DJRet approveYbsf(@RequestBody PatientPojo param) {
+        param.setStaffId(TokenUtil.getTokenUserId());
+        return service.approveYbsf(param);
+    }
+
+    @PostMapping("/rejectYbsf")
+    public DJRet rejectYbsf(@RequestBody PatientPojo param) {
+        param.setStaffId(TokenUtil.getTokenUserId());
+        return service.rejectYbsf(param);
+    }
+
+    @GetMapping("/getUnhandledRequests")
+    public DJRet getUnhandledRequests(@RequestParam("requestType") Integer requestType) {
+        return service.getUnhandledRequests(requestType);
+    }
+
+    @PostMapping("/handleRequest")
+    public DJRet handleRequest(@RequestBody CancelRegisterRequestPojo param) {
+        param.setVerifyId(TokenUtil.getTokenUserId());
+        return service.handleRequests(param);
+    }
+}

+ 2 - 1
src/main/java/thyyxxk/webserver/dao/LoginDao.java

@@ -31,7 +31,8 @@ public interface LoginDao {
             "AND (b.dept_code=a.small_dept or b.dept_code=a.dept)")
     List<CodeNamePojo> getUserWards(@Param("code") String code);
 
-    @Select("select rtrim(code) code, rtrim(name) name, rtrim(py_code) pyCode " +
+    @Select("select code='', name='全部', py_code='qb' union " +
+            "select rtrim(code) code, rtrim(name) name, rtrim(py_code) pyCode " +
             "from zd_unit_code where code like '8%' order by code")
     List<CodeNamePojo> getAllWards();
 

+ 7 - 3
src/main/java/thyyxxk/webserver/dao/yibao/PatientDao.java

@@ -20,7 +20,7 @@ public interface PatientDao {
             "and b.ledger_sn=(select MAX(ledger_sn) from yb_zy_review_record " +
             "where inpatient_no=b.inpatient_no and admiss_times=b.admiss_times))), " +
             "RTRIM(a.responce_type) responceType " +
-            "from zy_actpatient a where ward=#{ward} and charindex('$',a.inpatient_no)=0 " +
+            "from zy_actpatient a where ward like #{ward} and charindex('$',a.inpatient_no)=0 " +
             "ORDER BY cast(a.bed_no AS int)")
     List<OverviewPojo> getOverView(@Param("ward") String ward);
 
@@ -67,6 +67,7 @@ public interface PatientDao {
             "input_name=rtrim((select name FROM a_employee_mi WHERE code = input_id)), " +
             "input_date=convert(VARCHAR(19), isnull(a.input_date, getdate()), 21), " +
             "yb_remark=rtrim(a.yb_remark), " +
+            "pass_id=rtrim(a.pass_id), " +
             "pass_name=rtrim((select name FROM a_employee_mi WHERE code = a.pass_id)), " +
             "pass_date=convert(VARCHAR(19), isnull(a.pass_date, ''), 21), " +
             "ledger_sn=rtrim(b.times_billed), " +
@@ -87,8 +88,8 @@ public interface PatientDao {
             "total_charge=(select rtrim(isnull(total_charge, '0.00')) from zy_ledger_file where inpatient_no=#{inpatientNo} " +
             "and admiss_times=b.admiss_times and ledger_sn=a.ledger_sn), " +
             "responce_type_name=RTRIM((select name from zy_zd_responce_type where code=a.responce_type))," +
-            "yb_type_name=RTRIM((select name from zy_zd_yb_type where code=b.yb_type and responce_type=b.responce_type))," +
-            "treat_type_name=RTRIM((select name from zd_yb_treat_type where code=b.treat_type))," +
+            "yb_type_name=(select rtrim(name) from zy_zd_yb_type where code=a.yb_type and responce_type=a.responce_type)," +
+            "treat_type_name=RTRIM((select name from zd_yb_treat_type where code=a.treat_type))," +
             "balance=RTRIM((select balance+charge_yb from zy_ledger_file where inpatient_no=#{inpatientNo} and " +
             "admiss_times=a.admiss_times and ledger_sn=a.ledger_sn))," +
             "hic_no=rtrim((select hic_no_new from a_patient_mi where inpatient_no = #{inpatientNo})), " +
@@ -125,6 +126,9 @@ public interface PatientDao {
     @Select("select convert(varchar(19), yb_register_date, 21) from zy_actpatient where inpatient_no=#{inpatientNo}")
     String getRegisterDate(@Param("inpatientNo") String inpatientNo);
 
+    @Update("update a_patient_mi set hic_no_new=#{hicNo} where inpatient_no=#{inpatientNo}")
+    void updateHicNoNew(@Param("inpatientNo") String inpatientNo, @Param("hicNo") String hicNo);
+
     @Select("select xnh_membersysno from zy_actpatient where inpatient_no=#{inpatientNo}")
     String getMemberSysNo(@Param("inpatientNo") String inpatientNo);
 

+ 49 - 0
src/main/java/thyyxxk/webserver/dao/yibao/YbVerifyDao.java

@@ -0,0 +1,49 @@
+package thyyxxk.webserver.dao.yibao;
+
+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.pojo.yibao.ybverify.CancelRegisterRequestPojo;
+import thyyxxk.webserver.pojo.yibao.ybverify.IdCardUploadPojo;
+
+import java.util.List;
+
+@Mapper
+public interface YbVerifyDao {
+
+    @Update("update zy_actpatient set xnh_membersysno=#{memberNo} where inpatient_no=#{inpatientNo}")
+    void updateMemberSysNo(@Param("inpatientNo") String inpatientNo, @Param("memberNo") String memberNo);
+
+    @Select("select * from zy_xnh_record_sfz where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}")
+    IdCardUploadPojo getSfzInfo(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
+
+    @Update("update yb_zy_review_record set status_flag='2', yb_remark=#{ybRemark}, " +
+            "pass_id=#{passId}, pass_date=getdate() where inpatient_no=" +
+            "#{inpatientNo} and admiss_times=#{admissTimes}")
+    void approveYbsf(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes,
+                @Param("passId") String passId, @Param("ybRemark") String ybRemark);
+
+    @Update("update zy_actpatient set " +
+            "responce_type=(select responce_type from yb_zy_review_record where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}), " +
+            "yb_type=(select yb_type from yb_zy_review_record where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}), " +
+            "treat_type=(select treat_type from yb_zy_review_record where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}) " +
+            "where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}")
+    void updateZyActpatient(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
+
+    @Update("update yb_zy_review_record set status_flag='9', yb_remark=#{ybRemark} where inpatient_no=" +
+            "#{inpatientNo} and admiss_times=#{admissTimes}")
+    void rejectYbsf(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes,
+               @Param("ybRemark") String ybRemark);
+
+    @Select("select * from zy_retract_yb where statusFlag=1 and requestType=#{requestType}")
+    List<CancelRegisterRequestPojo> getUnhandledRequests(@Param("requestType") int requestType);
+
+    @Select("select rtrim(name) from a_employee_mi where code_rs=#{verifyId}")
+    String getVerifyName(@Param("verifyId") String verifyId);
+
+    @Update("update zy_retract_yb set ybRemark=#{ybRemark}, verifyId=#{verifyId}, verifyName=#{verifyName}, " +
+            "verifyDate=getdate(), statusFlag=#{statusFlag} where id=#{id}")
+    void handleRequests(CancelRegisterRequestPojo indata);
+
+}

+ 4 - 0
src/main/java/thyyxxk/webserver/pojo/makedbzfees/InpatientInfoPojo.java

@@ -18,4 +18,8 @@ public class InpatientInfoPojo {
     public String getOperation() {
         return operation.equals("") ? "0" : operation;
     }
+
+    public Integer getMaxDetailSn() {
+        return null == maxDetailSn ? 0 : maxDetailSn;
+    }
 }

+ 1 - 0
src/main/java/thyyxxk/webserver/pojo/settings/notification/SendMessageParam.java

@@ -5,4 +5,5 @@ import lombok.Data;
 @Data
 public class SendMessageParam {
     private String message;
+    private Integer refreshDelay;
 }

+ 8 - 0
src/main/java/thyyxxk/webserver/pojo/yibao/patient/PatientPojo.java

@@ -48,6 +48,7 @@ public class PatientPojo {
     private String inputName;
     private String inputDate;
     private String ybRemark;
+    private String passId;
     private String passName;
     private String passDate;
     private String ledgerSn;
@@ -82,4 +83,11 @@ public class PatientPojo {
     private String chargeYb;
     private Integer dismissFlag; // 结算标志,1:出院结算, 2:中间断账
     private String zjdzDatetime; // 中间断账时间
+
+    public String getYbTypeName() {
+        if ("10".equals(responceType)) {
+            return "省医保";
+        }
+        return null == ybTypeName ? "" : (ybTypeName).trim();
+    }
 }

+ 33 - 0
src/main/java/thyyxxk/webserver/pojo/yibao/ybverify/CancelRegisterRequestPojo.java

@@ -0,0 +1,33 @@
+package thyyxxk.webserver.pojo.yibao.ybverify;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+@Data
+public class CancelRegisterRequestPojo {
+    private Integer id;
+    private String inpatientNo;
+    private Integer admissTimes;
+    private String name;
+    private Integer sex;
+    private String responceType;
+    private String ybType;
+    private String treatType;
+    private String remark;
+    private String inputId;
+    private String inputName;
+    private Integer inputTimes;
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date inputDate;
+    private String ybRemark;
+    private String verifyId;
+    private String verifyName;
+    private String verifyDate;
+    // 审核状态:0-初值,1-待审核,2-审核通过,3-审核不通过
+    private Integer statusFlag;
+
+}

+ 48 - 0
src/main/java/thyyxxk/webserver/pojo/yibao/ybverify/IdCardUploadPojo.java

@@ -0,0 +1,48 @@
+package thyyxxk.webserver.pojo.yibao.ybverify;
+
+import lombok.Data;
+
+@Data
+public class IdCardUploadPojo {
+    private String idcard;
+    private String name;
+    private String sex;
+    private String nation;
+    private String address;
+    private String birthday;
+    private String agency;
+    private String expirestart;
+    private byte[] fileSfz;
+
+    public String getIdcard() {
+        return (idcard) == null ? "" : (idcard).trim();
+    }
+
+    public String getName() {
+        return (name) == null ? "" : (name).trim();
+    }
+
+    public String getSex() {
+        return (sex) == null ? "" : (sex).trim();
+    }
+
+    public String getNation() {
+        return (nation) == null ? "" : (nation).trim();
+    }
+
+    public String getAddress() {
+        return (address) == null ? "" : (address).trim();
+    }
+
+    public String getBirthday() {
+        return (birthday) == null ? "" : (birthday).trim();
+    }
+
+    public String getAgency() {
+        return (agency) == null ? "" : (agency).trim();
+    }
+
+    public String getExpirestart() {
+        return (expirestart) == null ? "" : (expirestart).trim();
+    }
+}

+ 3 - 0
src/main/java/thyyxxk/webserver/service/yibao/PatientService.java

@@ -37,6 +37,7 @@ public class PatientService {
     }
 
     public DJRet getOverView(String ward) {
+        ward = "%" + ward + "%";
         return DJRet.success(dao.getOverView(ward));
     }
 
@@ -189,6 +190,8 @@ public class PatientService {
         if (djRet.getCode() == ExceptionEnum.SUCCESS.getCode()) {
             String[] infos = djRet.getData().toString().split("\t");
             YbRegisterInfo info = new YbRegisterInfo();
+            dao.updateHicNoNew(param.getInpatientNo(), infos[3]);
+            log.info("更新hicNoNew成功 => 住院号:{},hicNoNew: {}", param.getInpatientNo(), infos[3]);
             info.setIdCard(infos[0]);
             info.setName(infos[1]);
             info.setCorpName(infos[4]);

+ 87 - 0
src/main/java/thyyxxk/webserver/service/yibao/YbVerifyService.java

@@ -0,0 +1,87 @@
+package thyyxxk.webserver.service.yibao;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.dao.yibao.YbVerifyDao;
+import thyyxxk.webserver.pojo.DJRet;
+import thyyxxk.webserver.pojo.yibao.patient.PatientPojo;
+import thyyxxk.webserver.pojo.yibao.ybverify.CancelRegisterRequestPojo;
+import thyyxxk.webserver.pojo.yibao.ybverify.IdCardUploadPojo;
+import thyyxxk.webserver.utils.TokenUtil;
+
+@Slf4j
+@Service
+public class YbVerifyService {
+    private final YbVerifyDao dao;
+    private final YibaoHttpService http;
+
+    public YbVerifyService(YbVerifyDao dao, YibaoHttpService http) {
+        this.dao = dao;
+        this.http = http;
+    }
+
+
+    public DJRet approveYbsf(PatientPojo param) {
+        log.info("医保身份审核通过 => 操作员:{},住院号:{},住院次数:{}", TokenUtil.getTokenUserId(),
+                param.getInpatientNo(), param.getAdmissTimes());
+        if (param.getResponceType().equals("04")) {
+            DJRet djRet = http.httpPost("getFamilyMember", param, "04");
+            if (djRet.getCode() == ExceptionEnum.SUCCESS.getCode()) {
+                JSONObject obj = (JSONObject) djRet.getData();
+                JSONArray members = obj.getJSONArray("members");
+                for (int i = 0; i < members.size(); i++) {
+                    JSONObject member = members.getJSONObject(i);
+                    if (member.getString("name").trim().equals(param.getName().trim())) {
+                        String memberSysNo = member.getString("memberNo");
+                        param.setXnhMembersysno(memberSysNo);
+                        dao.updateMemberSysNo(param.getInpatientNo(), memberSysNo);
+                    }
+                }
+                djRet = http.httpPost("register", param, "04");
+                if (djRet.getCode() == ExceptionEnum.SUCCESS.getCode()) {
+                    IdCardUploadPojo info = dao.getSfzInfo(param.getInpatientNo(), param.getAdmissTimes());
+                    if (info == null || info.getFileSfz() == null) {
+                        djRet = http.httpPost("uploadScanFile", param, "04");
+                    } else {
+                        djRet = http.httpPost("uploadIdCard", param, "04");
+                    }
+                    if (djRet.getCode() == ExceptionEnum.SUCCESS.getCode()) {
+                        dao.approveYbsf(param.getInpatientNo(), param.getAdmissTimes(), TokenUtil.getTokenUserId(), param.getYbRemark());
+                        dao.updateZyActpatient(param.getInpatientNo(), param.getAdmissTimes());
+                        return DJRet.success();
+                    } else {
+                        return djRet;
+                    }
+                } else {
+                    return djRet;
+                }
+            } else {
+                return djRet;
+            }
+        } else {
+            dao.approveYbsf(param.getInpatientNo(), param.getAdmissTimes(), TokenUtil.getTokenUserId(), param.getYbRemark());
+            dao.updateZyActpatient(param.getInpatientNo(), param.getAdmissTimes());
+            return DJRet.success();
+        }
+    }
+
+    public DJRet rejectYbsf(PatientPojo param) {
+        dao.rejectYbsf(param.getInpatientNo(), param.getAdmissTimes(), param.getYbRemark());
+        return DJRet.success();
+    }
+
+    public DJRet getUnhandledRequests(Integer requestType) {
+        return DJRet.success(dao.getUnhandledRequests(requestType));
+    }
+
+    public DJRet handleRequests(CancelRegisterRequestPojo param) {
+        String verifyName = dao.getVerifyName(param.getVerifyId());
+        param.setVerifyName(verifyName);
+        log.info("取消医保入院登记审核>>> {}", param);
+        dao.handleRequests(param);
+        return DJRet.success();
+    }
+}