DYH2020 1 anno fa
parent
commit
1c5c827492

+ 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;
     }
 }

+ 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;
+    }
 }

+ 28 - 1
src/main/java/com/ywt/mg/services/PrescriptionServices.java

@@ -236,6 +236,29 @@ 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 < ? or ext_status > ? ) and ( ext_status & ? != ? ) ";
+                    paramList.add(PrescriptionInfoExtStatusEnum.Delivered.getValue());
+                    paramList.add(2 * PrescriptionInfoExtStatusEnum.Delivered.getValue());
+                    paramList.add(PrescriptionInfoExtStatusEnum.Delivered.getValue());
+                    paramList.add(PrescriptionInfoExtStatusEnum.Delivered.getValue());
+                    break;
+                case 1:
+                    whereSql += " and ext_status > ? and ( ext_status & ? = ? )";
+                    paramList.add(PrescriptionInfoExtStatusEnum.Delivered.getValue());
+                    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 +385,7 @@ public class PrescriptionServices {
             String col6 = "药房";
             String col7 = "状态";
             String col8 = "支付状态";
+            String col8_1 = "配送状态";
             String col9 = "支付渠道";
             String col10 = "总金额";
             String col19 = "处方类型";
@@ -374,7 +398,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 +428,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){