Browse Source

Merge branch 'master' of https://172.16.32.165/lighter/web-server

xiaochan 1 month ago
parent
commit
cfbd850547

+ 87 - 0
src/main/java/thyyxxk/webserver/api/ccbmispos/CcbMisPosApi.java

@@ -0,0 +1,87 @@
+package thyyxxk.webserver.api.ccbmispos;
+
+import com.ccb.wlpt.RequestProcess;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.config.auth.PassToken;
+import thyyxxk.webserver.config.envionment.CcbMisConfig;
+
+import java.util.Objects;
+
+@Slf4j
+@RestController
+@RequestMapping("/api/ccbmispos")
+public class CcbMisPosApi {
+    private volatile boolean initialized = false;
+    private final CcbMisConfig cfg;
+
+    @Autowired
+    public CcbMisPosApi(CcbMisConfig cfg) {
+        this.cfg = cfg;
+    }
+
+    @PassToken
+    @GetMapping("/initFileCert")
+    public String initFileCert() {
+        log.info("initFileCert:{}", cfg);
+        String initResult = RequestProcess.initFileCert(cfg.getMchId(), cfg.getUserid(),
+                cfg.getCertFile(), cfg.getCertPassword(), cfg.getConfigFile());
+        if (Objects.equals(initResult, "")) {
+            initResult = "INIT SUCCESS";
+            initialized = true;
+        } else {
+            initialized = false;
+            initResult = "INIT FAILED:" + initResult;
+        }
+        log.info("initResult:{}", initResult);
+        return initResult;
+    }
+
+    @PassToken
+    @GetMapping("/removeFileCert")
+    public String removeFileCert() {
+        RequestProcess.removeFileCert(cfg.getMchId(), cfg.getUserid());
+        return "OK";
+    }
+
+    @PassToken
+    @GetMapping("/downloadTradeList")
+    public String downloadTradeList() {
+        if (!initialized) {
+            String initResult = initFileCert();
+            if (!Objects.equals(initResult, "INIT SUCCESS")) {
+                return initResult;
+            }
+        }
+        String xml = "<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\" ?>  \n" +
+                "<TX>   \n" +
+                "  <REQUEST_SN>" + System.currentTimeMillis() + "000</REQUEST_SN>  \n" +
+                "  <CUST_ID>"+cfg.getMchId() +"</CUST_ID>  \n" +
+                "  <USER_ID>"+cfg.getUserid()+"</USER_ID>  \n" +
+                "  <PASSWORD>"+cfg.getUserPassword()+"</PASSWORD>  \n" +
+                "  <TX_CODE>5W1005</TX_CODE>  \n" +
+                "  <LANGUAGE>CN</LANGUAGE>  \n" +
+                "  <TX_INFO>  \n" +
+                "    <DATE>20250715</DATE>  \n" +
+                "    <KIND>1</KIND>  \n" +
+                "    <FILETYPE>1</FILETYPE>  \n" +
+                "    <TYPE>0</TYPE>  \n" +
+                "    <NORDERBY>1</NORDERBY>  \n" +
+                "    <POS_CODE></POS_CODE>  \n" +
+                "    <ORDER></ORDER>  \n" +
+                "    <STATUS>1</STATUS>  \n" +
+                "    <BILL_FLAG>1</BILL_FLAG>  \n" +
+                "    <Mrch_No></Mrch_No>  \n" +
+                "    <GROUP_FLAG>0</GROUP_FLAG>  \n" +
+                "    <TXN_TPCD>1</TXN_TPCD>  \n" +
+                "  </TX_INFO>\n" +
+                "</TX> \n";
+        log.info("入参:\r\n{}", xml);
+        String result =  RequestProcess.sendRequest(cfg.getServiceUrl(), xml);
+        log.info("出参:\r\n{}", result);
+        return result;
+    }
+}

+ 20 - 0
src/main/java/thyyxxk/webserver/config/envionment/CcbMisConfig.java

@@ -0,0 +1,20 @@
+package thyyxxk.webserver.config.envionment;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@Data
+@ConfigurationProperties(prefix = "thyy.mispos")
+@NoArgsConstructor
+public class CcbMisConfig {
+    private String mchId;
+    private String userid;
+    private String userPassword;
+    private String configFile;
+    private String certFile;
+    private String certPassword;
+    private String serviceUrl;
+}

+ 2 - 3
src/main/java/thyyxxk/webserver/dao/his/inpatient/ChargeListDao.java

@@ -28,8 +28,6 @@ public interface ChargeListDao {
             "rtrim(a.bed_no) as bedNo, " +
             "gender=(case when sex='1' then '男' when sex='2' then '女' else '未知' end), " +
             "rtrim(zk_ward) as dept,admiss_date as admdate,med_type as medtype, " +
-            "convert(varchar(10),admiss_date,21) as begndate," +
-            "convert(varchar(10),dis_date,21) as enddate, " +
             "balance=(select ((select isnull(sum(t.depo_amount),0) from zy_deposit_file t " +
             "where t.inpatient_no=a.inpatient_no and t.admiss_times=a.admiss_times and t.status in (1,2)) + " +
             "(select sum(e.fund_pay_sumamt) from zy_ledger_file e where e.inpatient_no=#{patNo} and e.admiss_times=#{times}) - " +
@@ -98,7 +96,8 @@ public interface ChargeListDao {
             "(select d.bill_item_zy from zd_charge_item d where d.code=charge_code_mx) else " +
             "(select max(d.bill_item_zy) from yp_zd_dict d where d.code=charge_code_mx) end " +
             "from zy_detail_charge a where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "and trans_flag_yb!=2 and charge_amount!=0) temp) res group by " +
+            "and trans_flag_yb!=2 and charge_amount!=0 and charge_date>=#{begndate} " +
+            "and charge_date<=#{enddate}) temp) res group by " +
             "code, name, specification, unit, price, billItemCode, execDept ")
     List<ChargeItem> getChargeListWithoutChargeDate(PatOverview overview);
 

+ 1 - 1
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/EmergencyRescueDao.java

@@ -29,7 +29,7 @@ public interface EmergencyRescueDao {
             "psnNo=(select psn_no from t_si_pat_info b where b.pat_no=patient_id and b.times=a.times), " +
             "medType=(select med_type from t_si_pat_info b where b.pat_no=patient_id and b.times=a.times), " +
             "medListCodg=case when a.medi_item_type=0 then  " +
-            "(select max(national_code) from zd_charge_item where code=his_item_code) else  " +
+            "(select isnull(national_code_27, national_code) from zd_charge_item where code=his_item_code) else  " +
             "(select max(national_code) from yp_zd_dict where code=his_item_code) end, " +
             "bilgDrCodg=(select rtrim(yb_code) from a_employee_mi where code=input_staff) " +
             "from t_mt_receipt a where patient_id=#{patNo} and times=#{times} and yb_trans_flag=0")

+ 2 - 6
src/main/java/thyyxxk/webserver/entity/inpatient/chargelist/PatOverview.java

@@ -23,12 +23,8 @@ public class PatOverview {
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date disdate;
-    @DateTimeFormat(pattern = "yyyy-MM-dd")
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date begndate;
-    @DateTimeFormat(pattern = "yyyy-MM-dd")
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date enddate;
+    private String begndate;
+    private String enddate;
 
     private String statement;
 

+ 5 - 8
src/main/java/thyyxxk/webserver/service/inpatient/ChargeListService.java

@@ -58,14 +58,8 @@ public class ChargeListService {
         }
         pat.setMedtype(MedType.getName(pat.getMedtype()));
         pat.setDept(deptCache.get(pat.getDept()).getName());
-        if (null == pat.getEnddate()) {
-            String disdate = dao.selectActOrderDisDate(overview.getPatNo(), overview.getTimes());
-            if (null == disdate) {
-                pat.setEnddate(DateUtil.formatDate(new Date(), "yyyy-MM-dd"));
-            } else {
-                pat.setEnddate(disdate);
-            }
-        }
+        pat.setBegndate(overview.getBegndate());
+        pat.setEnddate(overview.getEnddate());
         pat.setDays(Math.abs(calculateDaysBetween(pat.getBegndate(), pat.getEnddate())));
         return pat;
     }
@@ -88,9 +82,12 @@ public class ChargeListService {
         } else {
             v.setStatement("");
         }
+        v.setBegndate(v.getBegndate() + " 00:00:00");
+        v.setEnddate(v.getEnddate() + " 23:59:59.999");
         List<ChargeItem> chargeList = v.needChargeDate()
                 ? dao.getChargeListWithChargeDate(v)
                 : dao.getChargeListWithoutChargeDate(v);
+        chargeList.removeIf(item -> BigDecimal.ZERO.compareTo(item.getQuantity()) == 0);
         for (ChargeItem item : chargeList) {
             item.setBillItemName(billItemCache.get(item.getBillItemCode()).getName());
         }

+ 8 - 0
src/main/resources/application-dev.yml

@@ -227,3 +227,11 @@ thyy:
     hosp-level: 03
     soft-developer:
     api-name:
+  mispos:
+    mchId: 105430180621029
+    userid: 105430180621029-002
+    user-password: thyy@2018
+    config-file: D:\work\ccbmis\config.xml
+    cert-file: D:\work\ccbmis\MC1819980.pfx
+    cert-password: 123456
+    service-url: https://merchant.ccb.com

+ 7 - 8
src/main/resources/application-prod.yml

@@ -208,11 +208,10 @@ thyy:
     soft-developer:
     api-name:
   mispos:
-    mchId: 105551000018861
-    key: 4a06c47d6508d52a67d388ab020111
-    posid: 005540716
-    userid: 105551000018861-008
-    password: ccb95533
-    configFile: D:\workspace\ccbmis\ccbmis\web\WEB-INF\CCB_EBSClient\conf\config.xml
-    certFile: D:\workspace\ccbmis\ccbmis\web\WEB-INF\CCB_EBSClient\cert\MC1462935.pfx
-    certPassword: ccb95533
+    mchId: 105430180621029
+    userid: 105430180621029-002
+    user-password: thyy@2018
+    configFile: D:\work\ccbmis\config.xml
+    certFile: D:\work\ccbmis\MC1819980.pfx
+    certPassword: 123456
+    service-url: https://merchant.ccb.com