Jelajahi Sumber

修复门特问题。

lighter 3 tahun lalu
induk
melakukan
a64a67cf4b

+ 1 - 1
pom.xml

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

+ 94 - 0
src/main/java/thyyxxk/webserver/controller/medicalinsurance/MarkMtFeesController.java

@@ -0,0 +1,94 @@
+package thyyxxk.webserver.controller.medicalinsurance;
+
+import lombok.extern.slf4j.Slf4j;
+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 thyyxxk.webserver.config.auth.PassToken;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.markmtfees.UploadMtFeeParam;
+import thyyxxk.webserver.entity.medicalinsurance.outpatient.MzPatientInfo;
+import thyyxxk.webserver.entity.medicalinsurance.setlinfo.FundDetail;
+import thyyxxk.webserver.service.medicalinsurance.SiMzService;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Slf4j
+@RestController
+@RequestMapping("/markMtFees")
+public class MarkMtFeesController {
+    private final SiMzService mzService;
+
+    @Autowired
+    public MarkMtFeesController(SiMzService mzService) {
+        this.mzService = mzService;
+    }
+
+    @PassToken
+    @PostMapping("/uploadFees")
+    public Map<String, Object> uploadFees(@RequestBody UploadMtFeeParam param) {
+        MzPatientInfo mz = new MzPatientInfo();
+        mz.setPatNo(param.getPatientId());
+        mz.setTimes(param.getTimes());
+        mz.setStaffId(param.getStaffId());
+        ResultVo<FundDetail> result = mzService.outpatientPreSettlement(mz);
+        return getStringObjectMap(param, result, "收费窗口获取门特报销");
+    }
+
+    @PassToken
+    @PostMapping("/settlement")
+    public Map<String, Object> settlement(@RequestBody UploadMtFeeParam param) {
+        MzPatientInfo mz = new MzPatientInfo();
+        mz.setPatNo(param.getPatientId());
+        mz.setTimes(param.getTimes());
+        mz.setStaffId(param.getStaffId());
+        ResultVo<FundDetail> result = mzService.outpatientSettlement(mz);
+        return getStringObjectMap(param, result, "收费窗口门特结算");
+    }
+
+    @PassToken
+    @PostMapping("/revokeSettlement")
+    public Map<String, Object> revokeSettlement(@RequestBody UploadMtFeeParam param) {
+        MzPatientInfo mz = new MzPatientInfo();
+        mz.setPatNo(param.getPatientId());
+        mz.setTimes(param.getTimes());
+        mz.setStaffId(param.getStaffId());
+        ResultVo<String> result = mzService.revokeOutpatientSettlement(mz);
+        Map<String, Object> map = new HashMap<>();
+        if (result.getCode() == ExceptionEnum.SUCCESS.getCode()) {
+            map.put("code", 0);
+            map.put("msg", result.getData());
+        } else {
+            map.put("code", -1);
+            map.put("msg", result.getMessage());
+        }
+        log.info("窗口取消门特结算:参数:{},结果:{}", param, map);
+        return map;
+    }
+
+    private Map<String, Object> getStringObjectMap(@RequestBody UploadMtFeeParam param,
+                                                   ResultVo<FundDetail> result,
+                                                   String logText) {
+        Map<String, Object> map = new HashMap<>();
+        if (result.getCode() != ExceptionEnum.SUCCESS.getCode()) {
+            map.put("code", -1);
+            map.put("msg", result.getMessage());
+            return map;
+        }
+        FundDetail fund = result.getData();
+        map.put("code", 0);
+        Map<String, String> payInfo = new HashMap<>();
+        payInfo.put("cashPay", String.valueOf(fund.getCashPay()));
+        payInfo.put("selfPay", String.valueOf(fund.getSelfPay()));
+        payInfo.put("acctPay", String.valueOf(fund.getAcctPay()));
+        payInfo.put("fundPay", String.valueOf(fund.getFundPay()));
+        payInfo.put("totalCost", String.valueOf(fund.getTotalCost()));
+        map.put("payInfo", payInfo);
+        log.info("{}:参数:{},结果:{}", logText, param, map);
+        return map;
+    }
+}

+ 0 - 132
src/main/java/thyyxxk/webserver/dao/his/markmtfees/MarkMtFeesDao.java

@@ -1,132 +0,0 @@
-package thyyxxk.webserver.dao.his.markmtfees;
-
-import org.apache.ibatis.annotations.*;
-import thyyxxk.webserver.entity.markmtfees.*;
-
-import java.util.List;
-
-/**
- * @author dj
- */
-@Mapper
-public interface MarkMtFeesDao {
-    @Select("select rtrim(social_no) from mz_patient_mi where patient_id=#{patientId}")
-    String selectSocialNoByPatientId(@Param("patientId") String patientId);
-
-    @Select("select times from mz_patient_mi where patient_id=#{patientId} ")
-    Integer selectMaxTimes(@Param("patientId") String patientId);
-
-    @Select("select phone_no from mz_patient_mi where patient_id=#{patientId}")
-    String selectPhoneNo(@Param("patientId") String patientId);
-
-    @Update("update mz_patient_mi set phone_no=#{phoneNo} where patient_id=#{patientId}")
-    void updatePhoneNo(@Param("patientId") String patientId, @Param("phoneNo") String phoneNo);
-
-    @Update("update mz_patient_mi set social_no=#{socialNo} where patient_id=#{patientId}")
-    void updateSocialNo(@Param("patientId") String patientId, @Param("socialNo") String socialNo);
-
-
-    @Select("select count(1) from mt_part_info where patient_id=#{patientId} and times=#{times}")
-    int selectCountMtPartInfo(@Param("patientId") String patientId,
-                              @Param("times") Integer times);
-
-    @Insert("insert into mz_charge_detail_yb (patient_id, times, receipt_no, order_no, response_type, yb_type) "+
-            "values (#{patientId}, #{times}, #{receiptNo}, #{orderNo}, #{responseType}, #{ybType})")
-    void insertMzChargeYb(@Param("patientId") String patientId,
-                          @Param("times") Integer times,
-                          @Param("receiptNo") Integer receiptNo,
-                          @Param("orderNo") Integer orderNo,
-                          @Param("responseType") String responseType,
-                          @Param("ybType") String ybType);
-
-    @Delete("delete from mt_part_info where patient_id=#{patientId} and times=#{times}")
-    void clearMtPartInfo(@Param("patientId") String patientId,
-                         @Param("times") Integer times);
-
-    @Insert("insert into mt_part_info (patient_id, times, icd, balance, serial_apply, responce_type, create_datetime) "+
-            "values (#{patientId},#{times},#{icd},#{balance},#{apply},'02',getdate())")
-    void insertHnsybMtPartInfo(@Param("patientId") String patientId,
-                               @Param("times") Integer times,
-                               @Param("icd") String icd,
-                               @Param("balance") String balance,
-                               @Param("apply") String apply);
-
-    @Insert("insert into mt_part_info (patient_id, times, icd, balance, serial_apply, responce_type, " +
-            "hic_no, icd_code, icd_name, second_icd_code, third_icd_code, mz_serial_no, create_datetime) values "+
-            "(#{patientId},#{times},null,null,#{bizType},'03',#{hicNo},#{icdCode},#{icdName}," +
-            "#{secondIcdCode},#{thirdIcdCode},#{mzSerialNo},getdate())")
-    void insertCssybMtPartInfo(CssybApplyInfo info);
-
-    @Select("select count(1) from t_mt_receipt where patient_id=#{patientId} and times=#{times} and " +
-            "receipt_no=#{receiptNo} and order_no=#{orderNo}")
-    int selectFeeCount(@Param("patientId") String patientId,
-                       @Param("times") Integer times,
-                       @Param("receiptNo") Integer receiptNo,
-                       @Param("orderNo") Integer orderNo);
-
-    @Insert("insert into t_mt_receipt (patient_id, times, receipt_no, order_no, item_no, his_item_name, " +
-            "his_item_code, fee_date, input_date, medi_item_type, charge_fee, price, quantity, drug_win, " +
-            "input_staff, input_man, serial_no, yb_trans_flag, charge_type, bill_item_code) values (" +
-            "#{patientId},#{times},#{receiptNo},#{orderNo},#{itemNo},#{drugName},#{chargeItemCode}," +
-            "#{priceTime},getdate(),#{mediItemType},#{chargeFee},#{unitPrice},#{quantity},#{drugWin}," +
-            "#{doctorCode},#{doctorName},#{serialNo},0, #{groupNo},#{billItemCode})")
-    void insertBatchedMtFeeInfo(MzReceipt param);
-
-    @Delete("delete from t_mt_receipt where patient_id=#{patientId} and times=#{times} and " +
-            "receipt_no=#{receiptNo} and order_no=#{orderNo}")
-    void deleteMtFees(OrderNo param);
-
-    @Select("SELECT a.patient_id,a.social_no,a.name,a.lv_date,a.sex,a.response_type,a.charge_type,a.times,a.age," +
-            "a.birth_day,responce_name=b.name,address=a.adress,phone_no=a.phone_no FROM " +
-            "mz_patient_mi a,mz_zd_responce_type b,mz_visit_table c WHERE a.patient_id=#{patientId} and " +
-            "a.patient_id=c.patient_id and c.responce_type=b.code " +
-            "union " +
-            "SELECT a.patient_id,a.social_no,a.name,a.lv_date,a.sex,a.response_type,a.charge_type,a.times,a.age," +
-            "a.birth_day,responce_name=b.name,address=a.adress,phone_no=a.phone_no FROM " +
-            "mz_patient_mi_b a,mz_zd_responce_type b,mz_visit_table_b c WHERE a.patient_id=#{patientId} and " +
-            "a.patient_id=c.patient_id and c.responce_type=b.code order by lv_date desc")
-    List<MzPatient> selectMzPatient(@Param("patientId") String patientId);
-
-    @Select("SELECT patient_id,times,visit_dept_code, " +
-            "visitDeptName=(select rtrim(name) from zd_unit_code where code=visit_dept_code), " +
-            "doctor_code,visit_date,icd_code,receipt_no,order_no,op_id,op_day,windows_no," +
-            "doctorName=(select rtrim(name) from a_employee_mi where code=doctor_code)," +
-            "receive_flag,sick_date,icd_text,symptom,jz_flag,first_or_not,group_type,rz_flag," +
-            "responce_type,bear_no,weight,hight,pressure,dept_no FROM mz_visit_table " +
-            "WHERE patient_id = #{patientId} AND times = #{times}")
-    MzVisit selectMzVisit(@Param("patientId") String patientId,
-                          @Param("times") Integer times);
-
-    @Select("select top 1 * from mt_part_info where patient_id=#{patientId} and times=#{times}")
-    MtPartInfo selectMtPartInfo(@Param("patientId") String patientId,
-                                @Param("times") Integer times);
-
-    @Select("select rtrim(name) from a_employee_mi where code=#{code}")
-    String selectDoctorName(@Param("code") String code);
-
-    @Select("select rtrim(specification) from yp_zd_dict where code=#{code} and serial=#{serial}")
-    String selectSpecification(@Param("code") String code, @Param("serial") String serial);
-
-    @Select("select rtrim(supply_name) from mz_zd_supply_type where supply_code=#{code}")
-    String selectSupplyName(@Param("code") String code);
-
-    @Select("select rtrim(charge_unit) from zd_charge_item where code=#{code}")
-    String selectXmChargeUnit(@Param("code") String code);
-
-    @Select("select rtrim(name) from yp_zd_unit where code=#{code}")
-    String selectDrugUnit(@Param("code") String code);
-
-    @Select("select count(1) from mt_part_info where patient_id=#{patientId} and times=#{times} ")
-    int selectMtPartInfoCount(@Param("patientId") String patientId,
-                                      @Param("times") Integer times);
-
-    @Select("select top 1 * from mt_part_info where patient_id=#{patientId} order by times desc")
-    MtPartInfo selectLatestMtPartInfo(@Param("patientId") String patientId);
-
-    @Insert("insert into mt_part_info (patient_id, times, icd, balance, serial_apply, responce_type, " +
-            "hic_no, icd_code, icd_name, second_icd_code, third_icd_code, mz_serial_no, create_datetime) values "+
-            "(#{patientId},#{times},#{icd},#{balance},#{serialApply},#{responceType},#{hicNo},#{icdCode},#{icdName}," +
-            "#{secondIcdCode},#{thirdIcdCode},#{mzSerialNo},getdate())")
-    void insertNewPartInfo(MtPartInfo info);
-
-}

+ 10 - 0
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiMzDao.java

@@ -1,6 +1,7 @@
 package thyyxxk.webserver.dao.his.medicalinsurance;
 
 import org.apache.ibatis.annotations.*;
+import thyyxxk.webserver.entity.markmtfees.CssybApplyInfo;
 import thyyxxk.webserver.entity.markmtfees.MzReceipt;
 import thyyxxk.webserver.entity.markmtfees.MzVisit;
 import thyyxxk.webserver.entity.markmtfees.OrderNo;
@@ -72,6 +73,15 @@ public interface SiMzDao {
     @Select("select rtrim(name) from yp_zd_unit where code=#{code}")
     String selectDrugUnit(@Param("code") String code);
 
+    @Select("select count(1) from mt_part_info where patient_id=#{patNo} and times=#{times}")
+    int selectMtPartCount(@Param("patNo") String patNo, @Param("times") int times);
+
+    @Insert("insert into mt_part_info (patient_id, times, icd, balance, serial_apply, responce_type, " +
+            "hic_no, icd_code, icd_name, second_icd_code, third_icd_code, mz_serial_no, create_datetime) values "+
+            "(#{patientId},#{times},null,null,#{bizType},'03',#{hicNo},#{icdCode},#{icdName}," +
+            "#{secondIcdCode},#{thirdIcdCode},#{mzSerialNo},getdate())")
+    void insertMtPartInfo(CssybApplyInfo info);
+
     @Insert("insert into mz_charge_detail_yb (patient_id, times, receipt_no, order_no, response_type, yb_type) "+
             "values (#{patientId}, #{times}, #{receiptNo}, #{orderNo}, #{insutype}, #{medType})")
     void insertMzChargeYb(@Param("patientId") String patientId,

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

@@ -90,7 +90,7 @@ public class ExecService {
     public JSONObject makeTradeHeader(SiFunction function) {
         String staffId = TokenUtil.getTokenUserId();
         String staffName = dao.selectStaffName(staffId);
-        JSONObject header = makePublicHeader("");
+        JSONObject header = makePublicHeader(SiUtil.INSTITUTION_AREA);
         header.put("infno", function.getCode());
         header.put("opter", staffId);
         header.put("opter_name", staffName);

+ 12 - 0
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiMzService.java

@@ -456,6 +456,18 @@ public class SiMzService {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
         }
         if (result.getIntValue(RESULT_CODE) == 0) {
+            int mtPartCount = dao.selectMtPartCount(p.getPatNo(), p.getTimes());
+            if (mtPartCount == 0) {
+                CssybApplyInfo applyInfo = new CssybApplyInfo();
+                applyInfo.setPatientId(p.getPatNo());
+                applyInfo.setTimes(p.getTimes());
+                applyInfo.setHicNo(preSetlmt.getPsnNo());
+                applyInfo.setBizType(preSetlmt.getMedType());
+                applyInfo.setIcdCode("");
+                applyInfo.setIcdName("");
+                applyInfo.setMzSerialNo(preSetlmt.getMdtrtId());
+                dao.insertMtPartInfo(applyInfo);
+            }
             JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
             FundDetail fundDetail = new FundDetail();
             fundDetail.setTotalCost(setlinfo.getDouble("medfee_sumamt"));

+ 3 - 0
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiZyService.java

@@ -84,6 +84,9 @@ public class SiZyService {
         if (null == admMdtrtinfo) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的参保信息!");
         }
+        if (StringUtil.isBlank(admMdtrtinfo.getChfpdrName())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "管床医生不能为空!");
+        }
         List<AdmDiseinfo> admDiseinfos = dao.selectAdmDiags(p.getInpatientNo(), p.getAdmissTimes());
         if (null == admDiseinfos || admDiseinfos.isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请填写医保入院诊断!");

+ 4 - 1
src/main/java/thyyxxk/webserver/utils/SiUtil.java

@@ -46,7 +46,10 @@ public class SiUtil {
     }
 
     public static String getInstitutionArea(String insureArea) {
-        return insureArea.startsWith("4301") ? "430105" : "439900";
+        if (StringUtil.isBlank(insureArea)) {
+            return INSTITUTION_AREA;
+        }
+        return insureArea.startsWith("4301") ? INSTITUTION_AREA : "439900";
     }
 
     private static String timestamp() {