12 Commits d2da08e854 ... 6b96f11bbf

Autor SHA1 Mensagem Data
  wuyongyi 6b96f11bbf feat:处方订单增加查询方法 1 ano atrás
  DYH2020 fadc9c0fab fix 修改接口 1 ano atrás
  DYH2020 1c5c827492 fix 修改接口 1 ano atrás
  DYH2020 365cc1ce4f fix 修改接口 1 ano atrás
  wuyongyi de9558a43c Merge branch 'v2.3.1_nfby' into publish 1 ano atrás
  wuyongyi e3b014fe72 feature: 下載备注 1 ano atrás
  wuyongyi 628b026d09 feature: 下載备注 1 ano atrás
  wuyongyi 7189239ea7 feature: 订单下载 1 ano atrás
  DYH2020 85c86bdb4a fix 修改下载hisPatientId接口 1 ano atrás
  wuyongyi 988cfabea6 feature:营养餐订单下载 1 ano atrás
  wuyongyi a616d33f18 feature:下载hispatientId 1 ano atrás
  wuyongyi 953e9623fd feature:下载hispatientId 1 ano atrás

+ 3 - 0
src/main/java/com/ywt/mg/domain/entities/MedicalCardRepository.java

@@ -10,4 +10,7 @@ public interface MedicalCardRepository extends JpaRepository<MedicalCard, Intege
 
     @Query(value = "select * from medical_card where mobile = ? ;", nativeQuery = true)
     List<MedicalCard> getCardByMobile(String patientmobile);
+
+    @Query(value = "select * from medical_card where hospital_id = ? and status = 1;", nativeQuery = true)
+    List<MedicalCard> getListByHospitalId(int hospitalId);
 }

+ 22 - 0
src/main/java/com/ywt/mg/domain/mealEntities/UserMealOrderView.java

@@ -111,6 +111,12 @@ public class UserMealOrderView implements Serializable {
     @Column(name = "need_package")
     private Boolean needPackage;
 
+    @Column(name ="total_cost_package_fee")
+    private Integer totalCostPackageFee;
+
+    @Column(name = "spec_price")
+    private Integer specPrice;
+
     public Integer getHospitalId() {
         return hospitalId;
     }
@@ -372,6 +378,22 @@ public class UserMealOrderView implements Serializable {
         this.needPackage = needPackage;
     }
 
+    public Integer getTotalCostPackageFee() {
+        return totalCostPackageFee;
+    }
+
+    public void setTotalCostPackageFee(Integer totalCostPackageFee) {
+        this.totalCostPackageFee = totalCostPackageFee;
+    }
+
+    public Integer getSpecPrice() {
+        return specPrice;
+    }
+
+    public void setSpecPrice(Integer specPrice) {
+        this.specPrice = specPrice;
+    }
+
     @Override
     public String toString() {
         return "UserMealOrderView{" +

+ 12 - 0
src/main/java/com/ywt/mg/domain/models/enums/PaymentChannelEnum.java

@@ -13,6 +13,7 @@ public enum PaymentChannelEnum {
     MedicalInsurance("医保", 7),
     ICBC("工行", 8),
     PharmacyPOS("药店pos机", 9),
+    PharmacyUnion("门店聚合", 10),
     UNKNOWN("", 0);
 
     private final String displayName;
@@ -41,5 +42,16 @@ public enum PaymentChannelEnum {
         return "";
     }
 
+    public static int getDisplayValue(String name) {
+        if (name == null || name.trim().equals("")) {
+            return 0;
+        }
+        for (PaymentChannelEnum enumValue : PaymentChannelEnum.values()) {
+            if (name.equals(enumValue.displayName)) {
+                return enumValue.value;
+            }
+        }
+        return 0;
+    }
 
 }

+ 1 - 0
src/main/java/com/ywt/mg/domain/models/enums/PresPaymentChannelEnum.java

@@ -11,6 +11,7 @@ public enum PresPaymentChannelEnum {
     MedicalInsurance("医保", 7),
     ICBC("工行", 8),
     PharmacyPOS("药店pos机", 9),
+    PharmacyUnion("门店聚合", 10),
     UNKNOWN("", 0);
 
     private final String displayName;

+ 20 - 11
src/main/java/com/ywt/mg/domain/models/enums/PrescriptionInfoExtStatusEnum.java

@@ -12,7 +12,9 @@ public enum PrescriptionInfoExtStatusEnum {
     PrintInjection("打印注射单", 1 << 4),   // 16
     PresNoPass("不通过", 1 << 5),           // 32
     Evaluate("已评价", 1 << 6),             // 64
-    ExistInjection("是否有注射药品", 1 << 7);// 128
+    ExistInjection("是否有注射药品", 1 << 7),// 128
+    PrintPres("打印处方筏", 1 << 8),         // 256
+    Delivered("已配送", 1 << 9);         // 512
 
     private final String displayName;
 
@@ -32,16 +34,23 @@ public enum PrescriptionInfoExtStatusEnum {
     }
 
     public static String getDisplayName(int value) {
-        if ((value & PresNoPass.value) == PresNoPass.value) {
-            return PresNoPass.displayName;
-        } else if ((value & IsPrint.value) == IsPrint.value) {
-            return IsPrint.displayName;
-        } else if ((value & IsSendOut.value) == IsSendOut.value) {
-            return IsSendOut.displayName;
-        } else if ((value & IsCheckIn.value) == IsCheckIn.value) {
-            return IsCheckIn.displayName;
-        } else {
-            return "";
+        for (PrescriptionInfoExtStatusEnum e : PrescriptionInfoExtStatusEnum.values()) {
+            if ((e.getValue() & value) == e.getValue() && e.getValue() <= value && (e.getValue() * 2) > value) {
+                return e.displayName;
+            }
         }
+        return "";
+    }
+
+    public static boolean checkDelivered(Integer value) {
+        if (value == null) {
+            return false;
+        }
+        value = value.intValue();
+        int deliveredValue = Delivered.getValue();
+        if ((deliveredValue & value) == deliveredValue && deliveredValue <= value && (deliveredValue * 2) > value) {
+            return true;
+        }
+        return false;
     }
 }

+ 10 - 0
src/main/java/com/ywt/mg/domain/models/pojo/ConstantRightDisplayDef.java

@@ -0,0 +1,10 @@
+package com.ywt.mg.domain.models.pojo;
+
+public class ConstantRightDisplayDef {
+
+    /**
+     * 医院后台--门诊通知--"下载患者ID"控制显示
+     * todo: 没勾选“下载患者ID”权限,则不显示该信息
+     */
+    public static final String COMMON_WX_PUSH_DISPLAY_DOWNLOAD_HISPATIENTID = "/hosp/commonWxPush/downloadHisPatientid";
+}

+ 11 - 0
src/main/java/com/ywt/mg/params/mealOrder/MealOrderListRequest.java

@@ -78,6 +78,9 @@ public class MealOrderListRequest implements Serializable {
     @ApiModelProperty(value = "判断医院后台还是公司后台")
     private int hosp;
 
+    @ApiModelProperty(value = "是否需要打包")
+    private String needPackage;
+
 
     public String getOrderNo() {
         return orderNo;
@@ -270,4 +273,12 @@ public class MealOrderListRequest implements Serializable {
     public void setHosp(int hosp) {
         this.hosp = hosp;
     }
+
+    public String getNeedPackage() {
+        return needPackage;
+    }
+
+    public void setNeedPackage(String needPackage) {
+        this.needPackage = needPackage;
+    }
 }

+ 11 - 0
src/main/java/com/ywt/mg/params/prescription/QueryPrescriptionListRequest.java

@@ -87,6 +87,9 @@ public class QueryPrescriptionListRequest implements Serializable {
     @ApiModelProperty(value = "医院ID")
     private int hospitalId;
 
+    @ApiModelProperty(value = "额外状态:0-未配送,1-已配送", example = "")
+    private String extStatus;
+
     public String getDoctorname() {
         return doctorname;
     }
@@ -294,4 +297,12 @@ public class QueryPrescriptionListRequest implements Serializable {
     public void setType(String type) {
         this.type = type;
     }
+
+    public String getExtStatus() {
+        return extStatus;
+    }
+
+    public void setExtStatus(String extStatus) {
+        this.extStatus = extStatus;
+    }
 }

+ 88 - 0
src/main/java/com/ywt/mg/services/CommonWxPushService.java

@@ -0,0 +1,88 @@
+package com.ywt.mg.services;
+
+import com.ywt.mg.core.SqlHelper;
+import com.ywt.mg.core.utils.Checker;
+import com.ywt.mg.domain.entities.MedicalCard;
+import com.ywt.mg.domain.entities.MedicalCardRepository;
+import com.ywt.mg.domain.models.ExcelDataMap;
+import com.ywt.mg.domain.models.ExcelStyleMap;
+import com.ywt.mg.domain.models.pojo.ConstantRightDisplayDef;
+import com.ywt.mg.domain.models.pojo.ExcelCollectPojo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class CommonWxPushService {
+    private static Logger logger = LoggerFactory.getLogger(CommonWxPushService.class);
+
+    @Autowired
+    private SqlHelper sqlHelper;
+
+    @Autowired
+    private MedicalCardRepository medicalCardRepository;
+
+    @Autowired
+    private AuthService authService;
+
+    @Autowired
+    private DownloadRecordService downloadRecordService;
+
+
+    public List<MedicalCard> getListByHospitalId(int hospitalId) {
+        return medicalCardRepository.getListByHospitalId(hospitalId);
+    }
+
+
+    public void downloadHisPatientId(int downloadRecordId, String fileName, Integer hospitalId) {
+        try {
+//            String downloadHisPatientidRightCode = ConstantRightDisplayDef.COMMON_WX_PUSH_DISPLAY_DOWNLOAD_HISPATIENTID;
+//            boolean downloadHisPatientidRight = authService.checkCacheRight(downloadHisPatientidRightCode);
+//            if (!downloadHisPatientidRight) {
+//                logger.error("CommonWxPushService#downloadHisPatientId>>没有权限,请先设置权限,userId:{}", authService.getCurrentAdmin());
+//            }
+            List<MedicalCard> infoList = getListByHospitalId(hospitalId);
+
+
+            String col1 = "患者ID";
+            String col2 = "患者姓名";
+            String col3 = "身份证号";
+            String col4 = "手机号";
+
+            String[] columns = new String[]{col1, col2, col3, col4};
+            ExcelDataMap map = new ExcelDataMap(columns);
+            if (Checker.isNone(infoList)) {
+                map.getStringListSafely(col1).add("");
+                map.getStringListSafely(col2).add("");
+                map.getStringListSafely(col3).add("");
+                map.getStringListSafely(col4).add("");
+            } else {
+                List<String> duplicateRemovalList = new ArrayList<>();
+                for (MedicalCard item : infoList) {
+                    String value = (new StringBuilder(item.getHisPatientId()).append("_").append(item.getIdNo())).toString();
+                    if (!duplicateRemovalList.contains(value)) {
+                        duplicateRemovalList.add(value);
+                        map.getStringListSafely(col1).add(item.getHisPatientId());
+                        map.getStringListSafely(col2).add(item.getPatientName());
+                        map.getStringListSafely(col3).add(item.getIdNo());
+                        map.getStringListSafely(col4).add(item.getMobile());
+                    }
+                }
+            }
+
+            // 得到统计
+            int size = infoList.size();
+            List<ExcelCollectPojo> itemList = null;
+            ExcelStyleMap excelStyleMap = new ExcelStyleMap(new String[]{});
+            int bill = 0;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
+        } catch (Exception e) {
+            logger.error("/CommonWxPushService/downloadHisPatientId(): {}", e.getMessage(), e);
+            e.printStackTrace();
+        }
+    }
+}

+ 86 - 10
src/main/java/com/ywt/mg/services/MealOrderService.java

@@ -133,6 +133,11 @@ public class MealOrderService {
             paramList.add(paymentNo);
         }
 
+        if(!Checker.isNone(request.getNeedPackage())){
+            whereSql += " and (need_package = ?)";
+            paramList.add(Integer.parseInt(request.getNeedPackage()));
+        }
+
         int hospitalId = Checker.getIntegerValue(request.getHospitalId());
         if (hospitalId > 0) {
             whereSql += " and ( hospital_id = ?)";
@@ -325,6 +330,7 @@ public class MealOrderService {
             String col8 = "支付状态";
             String col9 = "支付方式";
             String col10 = "总价";
+            String col10_2 = "是否选打包";
             String col11 = "支付时间";
             String col12 = "退款时间";
             String col13 = "取餐时间";
@@ -350,12 +356,12 @@ public class MealOrderService {
                 // 管理后台显示支付流水号
                 columns = new String[]{
                         col2, col3, col3_1, col3_2, col18, col4, col5, col20, col21, col6, col19, col7, col8, col9,
-                        col10, col15, col16, col17, col17_1, col17_2, col11, col12, col13, col14
+                        col10, col15, col16, col17, col17_1, col17_2, col10_2, col11, col12, col13, col14
                 };
             } else {
                 columns = new String[]{
                         col2, col4, col5, col20, col6, col19, col7, col8, col9,
-                        col10, col15, col16, col17, col17_1, col17_2, col11, col12, col13, col14
+                        col10, col15, col16, col17, col17_1, col17_2, col10_2, col11, col12, col13, col14
                 };
             }
             List<Shop> shopList = shopService.getAllShops();
@@ -374,6 +380,8 @@ public class MealOrderService {
                 String totalPriceStr = FormatUtil.intShrink100ToStr(userMealOrderView.getOrderAmount());
                 map.getStringListSafely(col10).add(totalPriceStr);
                 String payTime = FormatUtil.createTimeFormatList(userMealOrderView.getPaymentTime());
+                String needPack = userMealOrderView.getNeedPackage() ? "是":"否";
+                map.getStringListSafely(col10_2).add(needPack);
                 map.getStringListSafely(col11).add(payTime);
                 String deliveryTime = FormatUtil.createTimeFormatList(userMealOrderView.getDeliveryTime());
                 map.getStringListSafely(col13).add(deliveryTime);
@@ -503,7 +511,7 @@ public class MealOrderService {
                             .filter(v -> RefundStatusEnum.SUCCESS.getValue() != Checker.getIntegerValue(v.getRefundStatus()))
                             .mapToInt(v -> Checker.getIntegerValue(v.getOrderAmount()))
                             .sum()), null));
-            customExcelItemList.add(new CustomExcelItem(startColumn + 7, startRows, "总成本", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 7, startRows, "菜品成本总额", null));
             customExcelItemList.add(new CustomExcelItem(startColumn + 8, startRows, allCost, null));
             startRows += 1;
             // 微信支付
@@ -524,7 +532,7 @@ public class MealOrderService {
                             .filter(v -> RefundStatusEnum.SUCCESS.getValue() != Checker.getIntegerValue(v.getRefundStatus()))
                             .mapToInt(v -> Checker.getIntegerValue(v.getWechatPayAmount()))
                             .sum()), null));
-            customExcelItemList.add(new CustomExcelItem(startColumn + 7, startRows, "微信点单成本", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 7, startRows, "菜品微信点单成本", null));
             customExcelItemList.add(new CustomExcelItem(startColumn + 8, startRows, wechatSinglePointCost, null));
             startRows += 1;
             // 金币支付
@@ -545,7 +553,7 @@ public class MealOrderService {
                             .filter(v -> RefundStatusEnum.SUCCESS.getValue() != Checker.getIntegerValue(v.getRefundStatus()))
                             .mapToInt(v -> Checker.getIntegerValue(v.getCoinPayAmount()))
                             .sum()), null));
-            customExcelItemList.add(new CustomExcelItem(startColumn + 7, startRows, "金币点单成本", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 7, startRows, "菜品金币点单成本", null));
             customExcelItemList.add(new CustomExcelItem(startColumn + 8, startRows, coinSinglePointCost, null));
             startRows += 1;
             // 现场支付
@@ -566,7 +574,7 @@ public class MealOrderService {
                             .filter(v -> RefundStatusEnum.SUCCESS.getValue() != Checker.getIntegerValue(v.getRefundStatus()))
                             .mapToInt(v -> Checker.getIntegerValue(v.getF2fPayAmount()))
                             .sum()), null));
-            customExcelItemList.add(new CustomExcelItem(startColumn + 7, startRows, "现场点单成本", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 7, startRows, "菜品现场点单成本", null));
             customExcelItemList.add(new CustomExcelItem(startColumn + 8, startRows, p2fSinglePointCost, null));
             startRows += 1;
             // 洗碗费
@@ -587,6 +595,37 @@ public class MealOrderService {
                             .filter(v -> Checker.getIntegerValue(v.getPackageFee()) > 0)
                             .mapToInt(v -> Checker.getIntegerValue(v.getPackageFee()))
                             .sum()), null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 3, startRows, "包装费退款总额", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 4, startRows,
+                    FormatUtil.intShrink100ToStr(orders.stream()
+                            .filter(v ->  Checker.getIntegerValue(v.getPackageFee()) > 0 && RefundStatusEnum.SUCCESS.getValue() == Checker.getIntegerValue(v.getRefundStatus()))
+                            .mapToInt(v ->  Checker.getIntegerValue(v.getPackageFee()))
+                            .sum()), null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 5, startRows, "包装费实际支付总额", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 6, startRows,
+                    FormatUtil.intShrink100ToStr(orders.stream()
+                            .filter(v -> RefundStatusEnum.SUCCESS.getValue() != Checker.getIntegerValue(v.getRefundStatus()))
+                            .mapToInt(v -> Checker.getIntegerValue(v.getPackageFee()))
+                            .sum()), null));
+            startRows += 1;
+            customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows, "包装费成本总额", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 2, startRows,
+                    FormatUtil.intShrink100ToStr(orders.stream()
+                            .filter(v -> Checker.getIntegerValue(v.getTotalCostPackageFee()) > 0)
+                            .mapToInt(v -> Checker.getIntegerValue(v.getPackageFee()))
+                            .sum()), null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 3, startRows, "包装费成本退款总额", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 4, startRows,
+                    FormatUtil.intShrink100ToStr(orders.stream()
+                            .filter(v ->  Checker.getIntegerValue(v.getTotalCostPackageFee()) > 0 && RefundStatusEnum.SUCCESS.getValue() == Checker.getIntegerValue(v.getRefundStatus()))
+                            .mapToInt(v ->  Checker.getIntegerValue(v.getPackageFee()))
+                            .sum()), null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 5, startRows, "包装费实际成本总额", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 6, startRows,
+                    FormatUtil.intShrink100ToStr(orders.stream()
+                            .filter(v -> RefundStatusEnum.SUCCESS.getValue() != Checker.getIntegerValue(v.getRefundStatus()))
+                            .mapToInt(v -> Checker.getIntegerValue(v.getTotalCostPackageFee()))
+                            .sum()), null));
             startRows += 1;
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows, "配送费总额", null));
             customExcelItemList.add(new CustomExcelItem(startColumn + 2, startRows,
@@ -594,6 +633,37 @@ public class MealOrderService {
                             .filter(v -> Checker.getIntegerValue(v.getDeliveryFee()) > 0)
                             .mapToInt(v -> Checker.getIntegerValue(v.getDeliveryFee()))
                             .sum()), null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 3, startRows, "配送费退款总额", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 4, startRows,
+                    FormatUtil.intShrink100ToStr(orders.stream()
+                            .filter(v ->  Checker.getIntegerValue(v.getDeliveryFee()) > 0 && RefundStatusEnum.SUCCESS.getValue() == Checker.getIntegerValue(v.getRefundStatus()))
+                            .mapToInt(v ->  Checker.getIntegerValue(v.getDeliveryFee()))
+                            .sum()), null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 5, startRows, "配送费实际支付总额", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 6, startRows,
+                    FormatUtil.intShrink100ToStr(orders.stream()
+                            .filter(v -> RefundStatusEnum.SUCCESS.getValue() != Checker.getIntegerValue(v.getRefundStatus()))
+                            .mapToInt(v -> Checker.getIntegerValue(v.getDeliveryFee()))
+                            .sum()), null));
+            startRows += 1;
+            customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows, "总额(做法-加料)", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 2, startRows,
+                    FormatUtil.intShrink100ToStr(orders.stream()
+                            .filter(v -> Checker.getIntegerValue(v.getSpecPrice()) > 0)
+                            .mapToInt(v -> Checker.getIntegerValue(v.getSpecPrice()))
+                            .sum()), null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 3, startRows, "退款总额(做法-加料)", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 4, startRows,
+                    FormatUtil.intShrink100ToStr(orders.stream()
+                            .filter(v ->  Checker.getIntegerValue(v.getSpecPrice()) > 0 && RefundStatusEnum.SUCCESS.getValue() == Checker.getIntegerValue(v.getRefundStatus()))
+                            .mapToInt(v ->  Checker.getIntegerValue(v.getSpecPrice()))
+                            .sum()), null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 5, startRows, "实际总额(做法-加料)", null));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 6, startRows,
+                    FormatUtil.intShrink100ToStr(orders.stream()
+                            .filter(v -> RefundStatusEnum.SUCCESS.getValue() != Checker.getIntegerValue(v.getRefundStatus()))
+                            .mapToInt(v -> Checker.getIntegerValue(v.getSpecPrice()))
+                            .sum()), null));
             startRows += 2;
             // v1.3.1_nfyybyfy 新增职工统计
             // 职工支付
@@ -653,13 +723,19 @@ public class MealOrderService {
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 4,
                     "4、总成本=微信点单成本+金币点单成本+现场点单成本(也等于各个菜品成本价乘以份数的相加的总额);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 5,
-                    "5、微信点单成本:支付方式是“微信支付”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
+                    "5、菜品微信点单成本:支付方式是“微信支付”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 6,
-                    "   金币点单成本:支付方式是“微信+金币”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
+                    " 菜品金币点单成本:支付方式是“微信+金币”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 7,
-                    "   现场点单成本:支付方式是“现场支付”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
+                    " 菜品现场点单成本:支付方式是“现场支付”的订单,其各个菜品成本价乘以份数的相加的总额(不包含退款订单);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
             customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 8,
-                    "6、2元洗碗费总额:支付方式是“微信+金币”的订单,其微信支付部分的总额(不包含退款订单)。", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
+                    "6、2元洗碗费总额:支付方式是“微信+金币”的订单,其微信支付部分的总额(不包含退款订单);", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 9,
+                    "7、包装费总额=包装费退款总额+包装费实际总额;包装费成本总额=包装费成本退款总额+包装费实际成本总额;", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 10,
+                    "8、配送费总额=配送费退款总额+配送费实际总额;", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
+            customExcelItemList.add(new CustomExcelItem(startColumn + 1, startRows + 11,
+                    "9、总额(做法-加料)=退款总额(做法-加料)+实际总额(做法-加料)。", ExcelDownloadSrvOld.getCellFormat4StatRemarkWithNoSetBorder()));
         }
         return customExcelItemList;
     }

+ 22 - 3
src/main/java/com/ywt/mg/services/PharmacyService.java

@@ -169,6 +169,15 @@ public class PharmacyService {
                         paramList.add(statusInt);
                         break;
                 }
+            } else{
+                if (statusInt == 10) {
+                    whereSql += " and ( refund_status = ?  ) ";
+                    paramList.add(RefundStatusEnum.PENDING.getValue());
+                } else {
+                    whereSql += " and ( status = ? and (refund_status != ? or refund_status is null) ) ";
+                    paramList.add(statusInt);
+                    paramList.add(RefundStatusEnum.PENDING.getValue());
+                }
             }
         }
 
@@ -343,7 +352,8 @@ public class PharmacyService {
                     medicalCardPay = 0, medicalCardRefundTotal = 0, medicalCardRealTotal = 0,
                     posPay = 0, posRefundTotal = 0, posRealTotal = 0,
                     medicalInsurancePay = 0, medicalInsuranceRefundTotal = 0, medicalInsuranceRealTotal = 0,
-                    icbcPay = 0, icbcRefundTotal = 0, icbcRealTotal = 0;
+                    icbcPay = 0, icbcRefundTotal = 0, icbcRealTotal = 0,
+                    pharmacyUnionPay = 0, pharmacyUnionRefundTotal = 0, pharmacyUnionRealTotal = 0;
             List<PrescriptionInfo> list = downloadPrescriptionlist(request);
             ExcelDataMap map = new ExcelDataMap(columns);
             if (!Checker.isNone(list)) {
@@ -442,6 +452,8 @@ public class PharmacyService {
                             medicalInsuranceRefundTotal += Checker.getIntegerValue(p.getTotalPrice());
                         } else if (payChanelInt == PresPaymentChannelEnum.ICBC.getValue()) {
                             icbcRefundTotal += Checker.getIntegerValue(p.getTotalPrice());
+                        } else if (payChanelInt == PresPaymentChannelEnum.PharmacyUnion.getValue()) {
+                            pharmacyUnionRefundTotal += Checker.getIntegerValue(p.getTotalPrice());
                         }
                     }
                     if (paymentStatusInt == PaymentStatusEnum.Success.getValue()) {
@@ -461,6 +473,8 @@ public class PharmacyService {
                             medicalInsurancePay += Checker.getIntegerValue(p.getTotalPrice());
                         } else if (payChanelInt == PresPaymentChannelEnum.ICBC.getValue()) {
                             icbcPay += Checker.getIntegerValue(p.getTotalPrice());
+                        } else if (payChanelInt == PresPaymentChannelEnum.PharmacyUnion.getValue()) {
+                            pharmacyUnionPay += Checker.getIntegerValue(p.getTotalPrice());
                         }
                     }
                 }
@@ -473,7 +487,7 @@ public class PharmacyService {
                     medicalCardPay, medicalCardRefundTotal,
                     posPay, posRefundTotal,
                     medicalInsurancePay, medicalInsuranceRefundTotal,
-                    icbcPay, icbcRefundTotal);
+                    icbcPay, icbcRefundTotal, pharmacyUnionPay, pharmacyUnionRefundTotal);
             int bill = 0;
             downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
 
@@ -505,7 +519,7 @@ public class PharmacyService {
                                                      int medicalCardPay, int medicalCardRefundTotal,
                                                      int posPay, int posRefundTotal,
                                                      int medicalInsurancePay, int medicalInsuranceRefundTotal,
-                                                     int icbcPay, int icbcRefundTotal) {
+                                                     int icbcPay, int icbcRefundTotal, int pharmacyUnionPay, int pharmacyUnionRefundTotal) {
         int startRows = size + 3;
         int startColumn = 3;
 
@@ -548,6 +562,11 @@ public class PharmacyService {
         customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{"工行支付", FormatUtil.intShrink100ToStr(icbcPay)}));
         customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows, new String[]{"工行退款总额", FormatUtil.intShrink100ToStr(refundTotal)}));
         customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows, new String[]{"工行实际支付总额", FormatUtil.intShrink100ToStr(icbcPay - icbcRefundTotal)}));
+        startRows += 1;
+
+        customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{"门店聚合支付", FormatUtil.intShrink100ToStr(pharmacyUnionPay)}));
+        customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows, new String[]{"门店聚合退款总额", FormatUtil.intShrink100ToStr(pharmacyUnionRefundTotal)}));
+        customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows, new String[]{"门店聚合实际支付总额", FormatUtil.intShrink100ToStr(pharmacyUnionPay - pharmacyUnionRefundTotal)}));
 
 
         return customExcelItemList;

+ 26 - 2
src/main/java/com/ywt/mg/services/PrescriptionServices.java

@@ -236,6 +236,26 @@ public class PrescriptionServices {
 
         }
 
+        String extStatus = Checker.getStringValue(request.getExtStatus());
+        if (!Checker.isNone(extStatus)) {
+            // 额外状态:0-未配送,1-已配送
+            int extStatusInt = Integer.parseInt(extStatus);
+            switch (extStatusInt) {
+                case 0:
+                    whereSql += " and ( ext_status & ? != ? ) ";
+                    paramList.add(PrescriptionInfoExtStatusEnum.Delivered.getValue());
+                    paramList.add(PrescriptionInfoExtStatusEnum.Delivered.getValue());
+                    break;
+                case 1:
+                    whereSql += " and ( ext_status & ? = ? ) ";
+                    paramList.add(PrescriptionInfoExtStatusEnum.Delivered.getValue());
+                    paramList.add(PrescriptionInfoExtStatusEnum.Delivered.getValue());
+                    break;
+                default:
+                    break;
+            }
+        }
+
         String Format_Date = "yyyy-MM-dd";
         SimpleDateFormat format = new SimpleDateFormat(Format_Date);
 
@@ -362,6 +382,7 @@ public class PrescriptionServices {
             String col6 = "药房";
             String col7 = "状态";
             String col8 = "支付状态";
+            String col8_1 = "配送状态";
             String col9 = "支付渠道";
             String col10 = "总金额";
             String col19 = "处方类型";
@@ -374,7 +395,7 @@ public class PrescriptionServices {
             String col17 = "作废状态";
             String col18 = "作废备注";
 
-            String[] columns = new String[]{col0, col1, col20, col2, col3, col4, col5, col6, col7, col8, col9, col10, col19,
+            String[] columns = new String[]{col0, col1, col20, col2, col3, col4, col5, col6, col7, col8, col8_1, col9, col10, col19,
                     col11, col12, col13, col14, col15, col16, col17, col18};
             int payTotal = 0, refundTotal = 0;
             Map<String, Integer> statisticalDataMap = new HashMap<>();
@@ -404,6 +425,9 @@ public class PrescriptionServices {
                     map.getStringListSafely(col6).add(pharmacyName);
                     map.getStringListSafely(col7).add(statusStr);
                     map.getStringListSafely(col8).add(PaymentStatusEnum.getPaymentStatus(p.getPaymentStatus()).getDisplayName());
+                    boolean delivered = PrescriptionInfoExtStatusEnum.checkDelivered(Checker.getIntegerValue(p.getExtStatus()));
+                    String deliveredStr = delivered ? "已配送": "未配送";
+                    map.getStringListSafely(col8_1).add(deliveredStr);
                     map.getStringListSafely(col9).add(PresPaymentChannelEnum.valueOf(Checker.getIntegerValue(p.getPaymentChannel())).getDisplayName());
                     String total = String.format("%.2f元", (p.getTotalPrice() / 100d));
                     if(p.getStatus() == 6){
@@ -876,7 +900,7 @@ public class PrescriptionServices {
             String col6 = "支付渠道";
             String[] columns = new String[]{col0, col1, col2, col3, col4, col5, col6};
             request.setPaymentStatus(PaymentStatusEnum.Success.getValue() + "");
-            request.setPaymentChannel(PaymentChannelEnum.WeChat.getValue() + "");
+//            request.setPaymentChannel(PaymentChannelEnum.WeChat.getValue() + "");
             List<PrescriptionInfo> prescriptionInfoList = downloadPrescriptionlistNew(request);
             ExcelDataMap map = new ExcelDataMap(columns);
             Map<String, Integer> statisticalDataMap = new HashMap<>();

+ 73 - 0
src/main/java/com/ywt/mg/web/controllers/hospital/HospCommonWxPushController.java

@@ -0,0 +1,73 @@
+package com.ywt.mg.web.controllers.hospital;
+
+import com.ywt.mg.core.MGRight;
+import com.ywt.mg.core.utils.Checker;
+import com.ywt.mg.core.utils.serializers.JsonSerializer;
+import com.ywt.mg.domain.models.ConstantDef;
+import com.ywt.mg.domain.models.pojo.ConstantRightDisplayDef;
+import com.ywt.mg.params.checkupBooking.QueryCheckUpOrderListRequest;
+import com.ywt.mg.services.AuthService;
+import com.ywt.mg.services.CommonWxPushService;
+import com.ywt.mg.services.DownloadRecordService;
+import com.ywt.mg.services.IdGenerator;
+import com.ywt.mg.web.BaseResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController("/hosp/commonWxPush")
+@RequestMapping({"/hosp/commonWxPush"})
+@MGRight
+public class HospCommonWxPushController {
+
+    private static Logger logger = LoggerFactory.getLogger(HospCommonWxPushController.class);
+
+    @Autowired
+    private IdGenerator idGenerator;
+
+    @Autowired
+    private DownloadRecordService downloadRecordService;
+
+    @Autowired
+    private AuthService authService;
+
+    @Autowired
+    private CommonWxPushService commonWxPushService;
+
+    @RequestMapping({"/downloadHisPatientId"})
+    public BaseResponse downloadHisPatientId() {
+        int currentAdminId = Checker.getIntegerValue(authService.getCurrentAdminId());
+        String downloadHisPatientidRightCode = ConstantRightDisplayDef.COMMON_WX_PUSH_DISPLAY_DOWNLOAD_HISPATIENTID;
+        boolean downloadHisPatientidRight = authService.checkCacheRight(downloadHisPatientidRightCode);
+        if (!downloadHisPatientidRight) {
+            logger.error("HospCommonWxPushController#downloadHisPatientId>>没有权限,请先设置权限,userId:{}", authService.getCurrentAdmin());
+        }
+//        request.setCurrentAdminId(currentAdminId);
+        // 插入记录
+
+        String hosp = "";
+//        if(request.getHosp()> 0){
+        Integer hospital = authService.getCurrentHospitalId();
+        hosp = hospital.toString();
+
+//        }
+        int downloadRecordId = idGenerator.genDownloadRecordId();
+        String name = "下载患者ID";
+        String fileName = "下载患者ID";
+        String excelSuffixFormat = ConstantDef.EXCEL_SUFFIX_FORMAT;
+        String paramUrl = "/hosp/commonWxPush/downloadHisPatientId";
+        String paramJson = JsonSerializer.toJson(hospital);
+        downloadRecordService.getOrInsertDownloadRecordByHosp(downloadRecordId, name, fileName + excelSuffixFormat, paramUrl, paramJson);
+        Thread t = new Thread() {
+            @Override
+            public void run() {
+             commonWxPushService.downloadHisPatientId(downloadRecordId, fileName, hospital);
+            }
+        };
+        t.start();
+        return new BaseResponse().succeed("后台下载中...");
+    }
+}