Pārlūkot izejas kodu

医保入出院审核

lighter 3 gadi atpakaļ
vecāks
revīzija
f47f727708

+ 1 - 1
pom.xml

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

+ 47 - 0
src/main/java/thyyxxk/webserver/controller/medicalinsurance/SiAdmVerifyController.java

@@ -0,0 +1,47 @@
+package thyyxxk.webserver.controller.medicalinsurance;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.SiAdmissApply;
+import thyyxxk.webserver.entity.yibao.patient.Patient;
+import thyyxxk.webserver.service.medicalinsurance.SiAdmVerifyService;
+
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/siAdmissApply")
+public class SiAdmVerifyController {
+    private final SiAdmVerifyService service;
+
+    @Autowired
+    public SiAdmVerifyController(SiAdmVerifyService service) {
+        this.service = service;
+    }
+
+    @PostMapping("/selectAdmissApply")
+    public ResultVo<SiAdmissApply> selectAdmissApply(@RequestBody Patient p) {
+        return service.selectAdmissApply(p);
+    }
+
+    @PostMapping("/submitAdmissApply")
+    public ResultVo<String> submitAdmissApply(@RequestBody SiAdmissApply apply) {
+        return service.submitAdmissApply(apply);
+    }
+
+    @GetMapping("/selectUnhandledApplies")
+    public ResultVo<List<SiAdmissApply>> selectUnhandledApplies() {
+        return service.selectUnhandledApplies();
+    }
+
+    @PostMapping("/selectPatientInfo")
+    public ResultVo<Map<String, Object>> selectPatientInfo(@RequestBody SiAdmissApply apply) {
+        return service.selectPatientInfo(apply);
+    }
+
+    @PostMapping("/handleApply")
+    public ResultVo<String> handleApply(@RequestBody SiAdmissApply apply) {
+        return service.handleApply(apply);
+    }
+}

+ 0 - 54
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/BasSelectOverviewDao.java

@@ -479,60 +479,6 @@ public interface BasSelectOverviewDao extends BaseMapper<CaseFrontsheetSurgery>
             "lateCount=(select count(*) from batj_ba2 with(nolock) where late_flag=1 and zyys=b.zyys), " +
             "lateDays=datediff(day, a.dis_date, b.sign_date), " +
             "disDate=convert(varchar(10), c.start_time, 21) " +
-            "from zy_actpatient a with(nolock), batj_ba2 b with(nolock), yz_act_order c with(nolock) " +
-            "where " +
-            "a.inpatient_no not like 'S%' and " +
-            "a.inpatient_no not like 'JT%' and " +
-            "a.inpatient_no=b.zyh and " +
-            "a.admiss_times=b.zycs and " +
-            "a.inpatient_no=c.inpatient_no and " +
-            "a.admiss_times=c.admiss_times and " +
-            "c.start_time>=#{start} and " +
-            "c.start_time<=#{end} and " +
-            "c.order_code in ('06026','06053','06027', '05973') and " +
-            "isnull(a.file_status, 0)=#{fileStatus} and " +
-            "charindex('$',a.inpatient_no)=0 " +
-            "union " +
-            "select " +
-            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
-            "bedNo=rtrim(a.bed_no), " +
-            "bah=rtrim(a.inpatient_no), " +
-            "times=rtrim(a.admiss_times), " +
-            "name=rtrim(a.name), " +
-            "a.sex, " +
-            "deptName=(select rtrim(name) from zd_unit_code with(nolock) where code=a.dis_dept), " +
-            "doctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=b.zyys), " +
-            "b.late_flag, " +
-            "lateCount=(select count(*) from batj_ba2 with(nolock) where late_flag=1 and zyys=b.zyys), " +
-            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
-            "disDate=convert(varchar(10), c.start_time, 21) " +
-            "from zy_actpatient a with(nolock), batj_ba2 b with(nolock), yz_inact_order c with(nolock) " +
-            "where " +
-            "a.inpatient_no not like 'S%' and " +
-            "a.inpatient_no not like 'JT%' and " +
-            "a.inpatient_no=b.zyh and " +
-            "a.admiss_times=b.zycs and " +
-            "a.inpatient_no=c.inpatient_no and " +
-            "a.admiss_times=c.admiss_times and " +
-            "c.start_time>=#{start} and " +
-            "c.start_time<=#{end} and " +
-            "c.order_code in ('06026','06053','06027', '05973') and " +
-            "isnull(a.file_status, 0)=#{fileStatus} and " +
-            "charindex('$',a.inpatient_no)=0 " +
-            "union " +
-            "select " +
-            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
-            "bedNo=rtrim(a.bed_no), " +
-            "bah=rtrim(a.inpatient_no), " +
-            "times=rtrim(a.admiss_times), " +
-            "name=rtrim(a.name), " +
-            "a.sex, " +
-            "deptName=(select rtrim(name) from zd_unit_code with(nolock) where code=a.dis_dept), " +
-            "doctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=b.zyys), " +
-            "b.late_flag, " +
-            "lateCount=(select count(*) from batj_ba2 with(nolock) where late_flag=1 and zyys=b.zyys), " +
-            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
-            "disDate=convert(varchar(10), c.start_time, 21) " +
             "from zy_inactpatient a with(nolock), batj_ba2 b with(nolock), yz_act_order c with(nolock) " +
             "where " +
             "a.inpatient_no not like 'S%' and " +

+ 42 - 0
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiAdmVerifyDao.java

@@ -0,0 +1,42 @@
+package thyyxxk.webserver.dao.his.medicalinsurance;
+
+import org.apache.ibatis.annotations.*;
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.SiAdmissApply;
+import thyyxxk.webserver.entity.yibao.dismiss.ZyDisYbSrgry;
+
+import java.util.List;
+
+/**
+ * @author dj
+ */
+@Mapper
+public interface SiAdmVerifyDao {
+
+    @Select("select status,handle_comment,admiss_datetime from t_si_admiss_apply with(nolock) where pat_no=#{patNo} " +
+            "and times=#{times} and ledger_sn=#{ledger}")
+    SiAdmissApply selectAdmissApply(@Param("patNo") String patNo,
+                                    @Param("times") int times,
+                                    @Param("ledger") int ledger);
+
+    @Delete("delete from t_si_admiss_apply where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledger}")
+    void deleteAdmissApply(@Param("patNo") String patNo,
+                           @Param("times") int times,
+                           @Param("ledger") int ledger);
+
+    @Insert("insert into t_si_admiss_apply (pat_no,times,ledger_sn,input_staff,input_comment,input_datetime,status," +
+            "admiss_datetime,registered) values (#{patNo},#{times},#{ledgerSn},#{inputStaff},#{inputComment},getdate()," +
+            "0,#{admissDatetime},0)")
+    void insertAdmissApply(SiAdmissApply apply);
+
+    @Select("select a.pat_no,a.times,a.ledger_sn,a.status,c.sex as gender,rtrim(c.name) as name,c.med_type, " +
+            "wardName=(select rtrim(name) from zd_unit_code with(nolock) where code=c.ward),a.input_staff,c.admdvs, " +
+            "a.input_comment,a.input_datetime,a.status,a.handle_staff,a.handle_comment,a.handle_datetime,a.admiss_datetime " +
+            "from t_si_admiss_apply a with(nolock), zy_actpatient c with(nolock) " +
+            "where a.registered=0 and a.pat_no=c.inpatient_no and a.times=c.admiss_times")
+    List<SiAdmissApply> selectUnhandledApplies();
+
+    @Update("update t_si_admiss_apply set status=#{status},handle_staff=#{handleStaff},handle_comment=#{handleComment}, " +
+            "handle_datetime=getdate() where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn} ")
+    void handleApply(SiAdmissApply apply);
+
+}

+ 83 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/inpatient/SiAdmissApply.java

@@ -0,0 +1,83 @@
+package thyyxxk.webserver.entity.medicalinsurance.inpatient;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class SiAdmissApply implements Serializable {
+
+	/**
+	 * 住院号
+	 */
+	private String patNo;
+
+	/**
+	 * 住院次数
+	 */
+	private Integer times;
+
+	/**
+	 * 账页号
+	 */
+	private Integer ledgerSn;
+
+	/**
+	 * 申请人
+	 */
+	private String inputStaff;
+
+	/**
+	 * 入院登记时间
+	 */
+	private Date admissDatetime;
+
+	/**
+	 * 申请理由
+	 */
+	private String inputComment;
+
+	/**
+	 * 申请时间
+	 */
+	private Date inputDatetime;
+
+	/**
+	 * 申请状态:0:未处理,1:通过,2:驳回
+	 */
+	private Integer status;
+
+	/**
+	 * 处理人
+	 */
+	private String handleStaff;
+
+	/**
+	 * 处理意见
+	 */
+	private String handleComment;
+
+	/**
+	 * 处理时间
+	 */
+	private Date handleDatetime;
+
+	private String wardName;
+
+	private String admdvs;
+
+	private String admdvsName;
+
+	private Integer gender;
+
+	private String name;
+
+	private String inputName;
+
+	private String handleStaffName;
+
+	private String medType;
+
+	private String medTypeName;
+}

+ 1 - 1
src/main/java/thyyxxk/webserver/service/casefrontsheet/CaseFrontSheetService.java

@@ -130,7 +130,7 @@ public class CaseFrontSheetService {
      */
     public ResultVo<GetBasOverviewRet> getOutPatientForBas(GetOutSheet param) {
         GetBasOverviewRet ret = new GetBasOverviewRet();
-        if (!StringUtil.isBlank(param.getWard())) {
+        if (StringUtil.notBlank(param.getWard())) {
             int cd = dao.getCDBlfxCount(param.getWard());
             int all = dao.getAllDisPatientCount(param.getWard());
             if (cd == 0 || all == 0) {

+ 1 - 1
src/main/java/thyyxxk/webserver/service/externalhttp/SiExecSrvc.java

@@ -10,7 +10,7 @@ import com.dtflys.forest.http.ForestResponse;
 import java.util.Map;
 
 //@BaseRequest(baseURL = "http://10.136.68.158:22005/isp-api/powercsb/1101")
-@BaseRequest(baseURL = "http://10.93.28.228:80/isp-api/powercsb/1101")
+@BaseRequest(baseURL = "http://mbs.hun.hsip.gov.cn:20001/isp-api/powercsb/1101")
 public interface SiExecSrvc {
     @Post
     ForestResponse<byte[]> download(@Header Map<String, String> headerMap, @JSONBody JSONObject input);

+ 1 - 2
src/main/java/thyyxxk/webserver/service/medicalinsurance/ExecService.java

@@ -26,8 +26,7 @@ public class ExecService {
     private static final String OUTPUT = "output";
     private static final String MAC_ADDR = "FE-FC-FE-35-35-DE";
     private static final String IP_ADDR = "218.104.151.243";
-//    private static final String siApiUrl = "http://10.136.68.158:22005/isp-api/powercsb/1101";
-    private static final String siApiUrl = "http://10.93.28.228:80/isp-api/powercsb/1101";
+    private static final String siApiUrl = "http://mbs.hun.hsip.gov.cn:20001/isp-api/powercsb/1101";
     private final SiZyDao dao;
     private volatile String signNo;
 

+ 110 - 0
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiAdmVerifyService.java

@@ -0,0 +1,110 @@
+package thyyxxk.webserver.service.medicalinsurance;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.constants.sidicts.Insutype;
+import thyyxxk.webserver.constants.sidicts.MedType;
+import thyyxxk.webserver.dao.his.medicalinsurance.SiAdmVerifyDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.SiAdmissApply;
+import thyyxxk.webserver.entity.yibao.dismiss.ZyDisYbDiag;
+import thyyxxk.webserver.entity.yibao.dismiss.ZyDisYbSrgry;
+import thyyxxk.webserver.entity.yibao.patient.Patient;
+import thyyxxk.webserver.entity.yibao.patient.ZyInYbDiag;
+import thyyxxk.webserver.service.redislike.RedisLikeService;
+import thyyxxk.webserver.service.yibao.PatientService;
+import thyyxxk.webserver.utils.DecimalUtil;
+import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.StringUtil;
+import thyyxxk.webserver.utils.TokenUtil;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author dj
+ */
+@Slf4j
+@Service
+public class SiAdmVerifyService {
+    private final SiAdmVerifyDao dao;
+    private final RedisLikeService redis;
+    private final PatientService ptntSrvc;
+
+    @Autowired
+    public SiAdmVerifyService(SiAdmVerifyDao dao, RedisLikeService redis, PatientService ptntSrvc) {
+        this.dao = dao;
+        this.redis = redis;
+        this.ptntSrvc = ptntSrvc;
+    }
+
+    public ResultVo<SiAdmissApply> selectAdmissApply(Patient p) {
+        MedType medType = MedType.get(p.getMedType());
+        if (null == medType) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医疗类别不能为空!");
+        }
+        if (medType == MedType.GENERAL_HOSPITALIZATION ||
+                (medType == MedType.SINGLE_DISEASE_HOSPITALIZATION && p.getInpatientNo().startsWith("JT"))) {
+            SiAdmissApply apply = new SiAdmissApply();
+            apply.setStatus(1);
+            return ResultVoUtil.success(apply);
+        }
+        SiAdmissApply apply = dao.selectAdmissApply(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
+        if (null == apply) {
+            apply = new SiAdmissApply();
+            apply.setAdmissDatetime(p.getYbRegisterDate());
+        }
+        return ResultVoUtil.success(apply);
+    }
+
+    public ResultVo<String> submitAdmissApply(SiAdmissApply apply) {
+        if (StringUtil.isBlank(apply.getInputComment())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "申请理由不能为空!");
+        }
+        apply.setStatus(0);
+        apply.setInputStaff(TokenUtil.getTokenUserId());
+        dao.deleteAdmissApply(apply.getPatNo(), apply.getTimes(), apply.getLedgerSn());
+        dao.insertAdmissApply(apply);
+        return ResultVoUtil.success("提交成功。");
+    }
+
+    public ResultVo<List<SiAdmissApply>> selectUnhandledApplies() {
+        List<SiAdmissApply> list = dao.selectUnhandledApplies();
+        for (SiAdmissApply apply : list) {
+            apply.setInputName(redis.getEmployeeName(apply.getInputStaff()));
+            apply.setHandleStaffName(redis.getEmployeeName(apply.getHandleStaff()));
+            apply.setAdmdvsName(redis.getRegionName(apply.getAdmdvs()));
+            apply.setMedTypeName(MedType.getName(apply.getMedType()));
+        }
+        return ResultVoUtil.success(list);
+    }
+
+    public ResultVo<Map<String, Object>> selectPatientInfo(SiAdmissApply apply) {
+        ResultVo<Patient> ptntRsvo = ptntSrvc.getPatientInfo(apply.getPatNo());
+        if (ptntRsvo.getCode() != ExceptionEnum.SUCCESS.getCode()) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, ptntRsvo.getMessage());
+        }
+        Patient patient = ptntRsvo.getData();
+        List<ZyInYbDiag> inYbDiags = ptntSrvc.getZyInYbDiags(apply.getPatNo(), apply.getTimes()).getData();
+        for (ZyInYbDiag itm : inYbDiags) {
+            itm.setOperName(redis.getEmployeeName(itm.getOperId()));
+        }
+        Map<String, Object> map = new HashMap<>();
+        map.put("apply", apply);
+        map.put("patient", patient);
+        map.put("indiags", inYbDiags);
+        return ResultVoUtil.success(map);
+    }
+
+    public ResultVo<String> handleApply(SiAdmissApply apply) {
+        if (StringUtil.isBlank(apply.getHandleComment())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "处理意见不能为空!");
+        }
+        apply.setHandleStaff(TokenUtil.getTokenUserId());
+        dao.handleApply(apply);
+        return ResultVoUtil.success("处理成功。");
+    }
+}