浏览代码

Merge branch 'dev-1.1.4' of 172.16.32.165:lihong/thmz_system into dev-tz-2.0

# Conflicts:
#	src/main/java/cn/hnthyy/thmz/interceptor/AuthenticationInterceptor.java
#	src/main/java/cn/hnthyy/thmz/mapper/thmz/DiscountMapper.java
#	src/main/java/cn/hnthyy/thmz/mapper/thmz/UserMapper.java
lihong 7 月之前
父节点
当前提交
ae25a05c2a
共有 100 个文件被更改,包括 4507 次插入273 次删除
  1. 70 7
      src/main/java/cn/hnthyy/thmz/Utils/AddressResolutionUtil.java
  2. 7 1
      src/main/java/cn/hnthyy/thmz/Utils/TokenUtil.java
  3. 219 0
      src/main/java/cn/hnthyy/thmz/Utils/Tools.java
  4. 23 0
      src/main/java/cn/hnthyy/thmz/comment/MenuPermission.java
  5. 46 1
      src/main/java/cn/hnthyy/thmz/common/Constants.java
  6. 86 31
      src/main/java/cn/hnthyy/thmz/controller/CommonController.java
  7. 3 3
      src/main/java/cn/hnthyy/thmz/controller/LoginController.java
  8. 30 0
      src/main/java/cn/hnthyy/thmz/controller/NavigationController.java
  9. 34 28
      src/main/java/cn/hnthyy/thmz/controller/TransactionController.java
  10. 4 1
      src/main/java/cn/hnthyy/thmz/controller/UserController.java
  11. 123 34
      src/main/java/cn/hnthyy/thmz/controller/api/MedicalViewApiController.java
  12. 8 0
      src/main/java/cn/hnthyy/thmz/controller/mz/ButtonController.java
  13. 3 5
      src/main/java/cn/hnthyy/thmz/controller/mz/ClinicController.java
  14. 147 0
      src/main/java/cn/hnthyy/thmz/controller/mz/DiscountController.java
  15. 14 1
      src/main/java/cn/hnthyy/thmz/controller/mz/MzBlRecordController.java
  16. 192 56
      src/main/java/cn/hnthyy/thmz/controller/mz/MzChargeDetailController.java
  17. 40 5
      src/main/java/cn/hnthyy/thmz/controller/mz/MzPatientMiController.java
  18. 177 24
      src/main/java/cn/hnthyy/thmz/controller/mz/MzPharmacyController.java
  19. 32 18
      src/main/java/cn/hnthyy/thmz/controller/mz/MzReceiptSerialController.java
  20. 1 0
      src/main/java/cn/hnthyy/thmz/controller/mz/MzZdYpYshController.java
  21. 65 0
      src/main/java/cn/hnthyy/thmz/controller/mz/MzZlItemRefundFeeController.java
  22. 62 13
      src/main/java/cn/hnthyy/thmz/controller/mz/MzyReqrecController.java
  23. 17 0
      src/main/java/cn/hnthyy/thmz/controller/mz/MzyZdChargeTypeController.java
  24. 1 0
      src/main/java/cn/hnthyy/thmz/controller/mz/WorkspaceConfigController.java
  25. 51 0
      src/main/java/cn/hnthyy/thmz/controller/mz/WpMzPrescriptionController.java
  26. 9 0
      src/main/java/cn/hnthyy/thmz/controller/mz/YpMzFytjController.java
  27. 78 0
      src/main/java/cn/hnthyy/thmz/controller/mz/YpZdDictController.java
  28. 75 0
      src/main/java/cn/hnthyy/thmz/controller/mzdzfp/BswController.java
  29. 32 0
      src/main/java/cn/hnthyy/thmz/controller/wxmall/WxmallPackagePurchasedItemController.java
  30. 37 0
      src/main/java/cn/hnthyy/thmz/controller/yk/YpBaseController.java
  31. 24 0
      src/main/java/cn/hnthyy/thmz/controller/zd/DictDataController.java
  32. 14 0
      src/main/java/cn/hnthyy/thmz/controller/zd/UnitCodeController.java
  33. 42 0
      src/main/java/cn/hnthyy/thmz/controller/zy/ZyActpatientController.java
  34. 4 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/Employee.java
  35. 4 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/MzBlRecord.java
  36. 9 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/MzChargeDetail.java
  37. 9 1
      src/main/java/cn/hnthyy/thmz/entity/his/mz/MzDepositFile.java
  38. 72 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/MzDrugTracCodg.java
  39. 25 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/MzOrderLock.java
  40. 2 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/MzPatientMi.java
  41. 4 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/MzReceiptSerial.java
  42. 2 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/MzYjReq.java
  43. 89 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/MzZlItemRefundFee.java
  44. 4 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/MzyZdChargeType.java
  45. 87 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/RxDiseinfo.java
  46. 179 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/RxDruginfo.java
  47. 190 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/RxMdtrtinfo.java
  48. 124 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/RxReceiptinfo.java
  49. 107 0
      src/main/java/cn/hnthyy/thmz/entity/his/mz/ZdRxMedicine.java
  50. 49 0
      src/main/java/cn/hnthyy/thmz/entity/his/wxmall/WxmallPackagePurchasedItem.java
  51. 43 0
      src/main/java/cn/hnthyy/thmz/entity/his/wxmall/WxmallPackageUseHistory.java
  52. 263 0
      src/main/java/cn/hnthyy/thmz/entity/his/yp/SelinfoSold.java
  53. 39 0
      src/main/java/cn/hnthyy/thmz/entity/his/yp/YpBarInfo.java
  54. 1 0
      src/main/java/cn/hnthyy/thmz/entity/his/yp/YpBase.java
  55. 2 0
      src/main/java/cn/hnthyy/thmz/entity/his/yp/YpInDetl.java
  56. 2 0
      src/main/java/cn/hnthyy/thmz/entity/his/yp/YpInDetlYf.java
  57. 30 7
      src/main/java/cn/hnthyy/thmz/entity/his/yp/YpManuBarCode.java
  58. 4 0
      src/main/java/cn/hnthyy/thmz/entity/his/yp/YpMzFytj.java
  59. 2 0
      src/main/java/cn/hnthyy/thmz/entity/his/yp/YpOutDetl.java
  60. 10 0
      src/main/java/cn/hnthyy/thmz/entity/his/yp/YpZdDict.java
  61. 2 0
      src/main/java/cn/hnthyy/thmz/entity/his/zd/JcZdItem.java
  62. 2 0
      src/main/java/cn/hnthyy/thmz/entity/his/zd/JyZdItem.java
  63. 2 0
      src/main/java/cn/hnthyy/thmz/entity/his/zd/ZdChargeItem.java
  64. 111 0
      src/main/java/cn/hnthyy/thmz/entity/his/zd/ZdTaxClassCode.java
  65. 4 1
      src/main/java/cn/hnthyy/thmz/entity/his/zd/ZdUnitCode.java
  66. 39 0
      src/main/java/cn/hnthyy/thmz/entity/jy/YbRegForRxParam.java
  67. 33 0
      src/main/java/cn/hnthyy/thmz/entity/mzdzfp/ChargeDetailDTO.java
  68. 34 0
      src/main/java/cn/hnthyy/thmz/entity/mzdzfp/FeeDetl.java
  69. 44 0
      src/main/java/cn/hnthyy/thmz/entity/mzdzfp/InvoiceDetail.java
  70. 48 0
      src/main/java/cn/hnthyy/thmz/entity/mzdzfp/MdtrtInfo.java
  71. 47 0
      src/main/java/cn/hnthyy/thmz/entity/mzdzfp/MzDzfpUpload.java
  72. 75 0
      src/main/java/cn/hnthyy/thmz/entity/mzdzfp/MzInvoiceInfo.java
  73. 34 0
      src/main/java/cn/hnthyy/thmz/entity/mzdzfp/ResultInfo.java
  74. 43 0
      src/main/java/cn/hnthyy/thmz/entity/mzdzfp/SetlInfo.java
  75. 60 0
      src/main/java/cn/hnthyy/thmz/entity/mzdzfp/SpecialAttrDTO.java
  76. 4 0
      src/main/java/cn/hnthyy/thmz/entity/thmz/Button.java
  77. 28 0
      src/main/java/cn/hnthyy/thmz/entity/thmz/Discount.java
  78. 2 0
      src/main/java/cn/hnthyy/thmz/entity/thmz/ReceiptSerialFee.java
  79. 4 0
      src/main/java/cn/hnthyy/thmz/entity/thmz/WorkspaceConfig.java
  80. 74 0
      src/main/java/cn/hnthyy/thmz/enums/InsutypeEnum.java
  81. 8 0
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/ChargeFeeVoMapper.java
  82. 1 1
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/EmployeeMapper.java
  83. 1 1
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzBillItemMapper.java
  84. 7 4
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzBlRecordMapper.java
  85. 73 12
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzChargeDetailMapper.java
  86. 18 5
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzDepositFileMapper.java
  87. 187 0
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzDrugTracCodgMapper.java
  88. 35 0
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzDzfpUploadMapper.java
  89. 12 0
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzOrderLockMapper.java
  90. 15 2
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzPatientMiMapper.java
  91. 17 2
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzPharmacyMapper.java
  92. 2 1
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzVisitTableMapper.java
  93. 126 0
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzZlItemRefundFeeMapper.java
  94. 2 2
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzZyReqMapper.java
  95. 1 1
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzfzPatientOrderMapper.java
  96. 4 0
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzyReqrecMapper.java
  97. 12 4
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzyZdChargeTypeMapper.java
  98. 9 1
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/RegionMapper.java
  99. 12 0
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/ShareholderCardMapper.java
  100. 153 0
      src/main/java/cn/hnthyy/thmz/mapper/his/mz/WpMzPrescriptionMapper.java

+ 70 - 7
src/main/java/cn/hnthyy/thmz/Utils/AddressResolutionUtil.java

@@ -1,5 +1,9 @@
 package cn.hnthyy.thmz.Utils;
 
+
+import cn.hutool.core.util.StrUtil;
+
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.regex.Matcher;
@@ -40,13 +44,72 @@ public class AddressResolutionUtil {
         return row;
     }
 
+    public static Map<String, String> addressResolutionNew(String address) {
+        Map<String, String> res = new HashMap<>();
+        if(StrUtil.isBlank(address)) return res;
+        if (address.indexOf("北京市") != -1) {
+            putProvinceAll(address, "北京市", res);
+        } else if (address.indexOf("天津市") != -1) {
+            putProvinceAll(address, "天津市", res);
+        } else if (address.indexOf("上海市") != -1) {
+            putProvinceAll(address, "上海市", res);
+        } else if (address.indexOf("重庆市") != -1) {
+            putProvinceAll(address, "重庆市", res);
+        } else if (address.indexOf("自治区") != -1) {
+            int proIndex = address.indexOf("自治区");
+            String province = address.substring(0, proIndex + 3);
+            res.put("province", province);
+            String cityAddress = address.substring(proIndex + 3);
+            putCityAll(res, cityAddress);
+        } else if (address.indexOf("省") != -1) {
+            int proIndex = address.indexOf("省");
+            String province = address.substring(0, proIndex + 1);
+            res.put("province", province);
+            String cityAddress = address.substring(proIndex + 1);
+            putCityAll(res, cityAddress);
+        } else {
+            putCityAll(res, address);
+        }
+        return res;
+    }
+
+    public static void putProvinceAll(String address, String cityAddress, Map<String, String> res) {
+        res.put("province", cityAddress);
+        String city = cityAddress + "城区";
+        res.put("province", city);
+        String dicStr = address.substring(address.indexOf(city) + 5);
+        putDistrictAndDetail(dicStr, res);
+    }
+
+    public static void putCityAll(Map<String, String> res, String cityAddress) {
+        int cityIndex = cityAddress.indexOf("市");
+        if (cityIndex > -1) {
+            String city = cityAddress.substring(0, cityIndex + 1);
+            res.put("city", city);
+            String districtStr = cityAddress.substring(cityIndex + 1);
+            putDistrictAndDetail(districtStr, res);
+        } else {
+            putDistrictAndDetail(cityAddress, res);
+        }
+    }
+
+    public static void putDistrictAndDetail(String cityAddress, Map<String, String> map) {
+        String district = "";
+        String detail = "";
+        int districtIndex = cityAddress.indexOf("县") > -1 ? cityAddress.indexOf("县") : cityAddress.indexOf("区");
+        if (districtIndex > -1) {
+            district = cityAddress.substring(0, districtIndex + 1);
+            detail = cityAddress.substring(districtIndex + 1);
+        } else {
+            detail = cityAddress;
+        }
+        map.put("district", district);
+        map.put("detail", detail);
+    }
+
     public static void main(String[] args) {
-        System.out.println(addressResolution("广东省深圳市福田区梅林街道办事处国际金融科技大厦"));
-        System.out.println(addressResolution("山东省德州市禹城市伦镇堂子街村235号"));
-        System.out.println(addressResolution("湖南省慈利县赵家岗乡天台村8组011号"));
-        System.out.println(addressResolution("泰和医院"));
-        String provinceCode="340827198806135413".substring(0,2)+"0000";
-        System.out.println(provinceCode);
-        System.out.println(addressResolution("湖南省慈利县赵家岗乡天台村8组011号,山东省德州市禹城市伦镇堂子街村235号"));
+        String address = "湖南省浏阳市金刚镇沙罗1515";
+        System.out.println(addressResolutionNew(address));
+        //System.out.println(addressResolution("湖南省长沙市开福区秀峰街道兴联社区万家冲组208号"));
     }
 }

+ 7 - 1
src/main/java/cn/hnthyy/thmz/Utils/TokenUtil.java

@@ -79,7 +79,13 @@ public class TokenUtil {
         String token = TokenUtil.getToken(HttpContextUtils.getHttpServletRequest());
         AssertUtil.isNotBlank(token,"业务处理失败,用户token不存在");
         DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
-        return (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
+        User user = (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
+        if(user == null){
+            user = new User();
+            user.setUserIdCode(Constants.BRZZJF_CODE);
+            user.setUserName("自助");
+        }
+        return user;
     }
 
 

+ 219 - 0
src/main/java/cn/hnthyy/thmz/Utils/Tools.java

@@ -1,12 +1,17 @@
 package cn.hnthyy.thmz.Utils;
 
+import cn.hnthyy.thmz.entity.his.mz.MzDepositFile;
 import cn.hnthyy.thmz.entity.his.mz.MzYjReq;
 import cn.hnthyy.thmz.entity.thmz.Config;
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.codec.Base64;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
@@ -22,6 +27,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
@@ -713,6 +719,16 @@ public class Tools {
         return result;
     }
 
+    public static String getHisOrdNum(String patientId,Integer times,Integer receiptNo){
+        return patientId + "_" + times + "_" + receiptNo;
+    }
+
+
+    public static String getEcToken(String readCard) {
+        Map<String, Object> res = (Map) JsonUtil.jsontoObject(readCard, Map.class);
+        return (String) res.get("ecToken");
+    }
+
     public static String beforeAddZeroStr(String str){
         if(StrUtil.isNotBlank(str) && str.length() == 1){
             return "0" + str;
@@ -720,11 +736,214 @@ public class Tools {
         return str;
     }
 
+    public static boolean isValidTime24H(String time){
+        Pattern pattern = Pattern.compile("([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");
+        Matcher matcher = pattern.matcher(time);
+        return matcher.matches();
+    }
+
+    /**
+     * @description:获取挂号时间段
+     * @author: lihong
+     * @date: 2025/1/14 15:02
+     * @param: requestDate
+     * @return: null
+     **/
+    public static String getAmPmDateDiff(Date requestDate,String ampm){
+          if("a".equals(ampm)){
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 08:00:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 08:29:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "08:00 至 08:30";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 08:30:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 08:59:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "08:30 至 09:00";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 09:00:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 09:29:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "09:00 至 09:30";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 09:30:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 09:59:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "09:30 至 10:00";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 10:00:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 10:29:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "10:00 至 10:30";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 10:30:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 11:00:00","yyyy-MM-dd HH:mm:ss"))){
+                  return "10:30 至 11:00";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 11:00:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 11:29:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "11:00 至 11:30";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 11:30:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 12:00:00","yyyy-MM-dd HH:mm:ss"))){
+                  return "11:30 至 12:00";
+              }
+          }
+          if("p".equals(ampm)){
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 14:00:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 14:29:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "14:00 至 14:30";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 14:30:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 14:59:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "14:30 至 15:00";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 15:00:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 15:29:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "15:00 至 15:30";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 15:30:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 15:59:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "15:30 至 16:00";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 16:00:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 16:29:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "16:00 至 16:30";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 16:30:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 16:59:59","yyyy-MM-dd HH:mm:ss"))){
+                  return "16:30 至 17:00";
+              }
+              if(DateUtil.isIn(requestDate,DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 17:00:00","yyyy-MM-dd HH:mm:ss"),DateUtil.parse(DateUtil.format(requestDate,"yyyy-MM-dd")+" 17:30:00","yyyy-MM-dd HH:mm:ss"))){
+                  return "17:00 至 17:30";
+              }
+          }
+          if("p4".equals(ampm)){
+              return "17:00 至 21:00";
+          }
+        if("n".equals(ampm)){
+            return "12:00 至 14:00";
+        }
+        if("d".equals(ampm)){
+            return "00:00 至 24:00";
+        }
+        if("e".equals(ampm)){
+            return "17:30 至 24:00";
+        }
+        if("l".equals(ampm)){
+            return "00:00 至 08:00";
+        }
+        if("a5".equals(ampm)){
+            return "08:00 至 15:00";
+        }
+        if("a6".equals(ampm)){
+            return "17:00 至 22:00";
+        }
+        if("a7".equals(ampm)){
+            return "22:00 至 08:00";
+        }
+        return "";
+    }
+
+
     public static boolean containsChinese(String str){
         return Pattern.compile("[\u4e00-\u9fa5]").matcher(str).find();
     }
 
     public static void main(String[] args) {
+        //Syste/m.out.println(DateUtil.offsetSecond(now,-(60*2+RandomUtil.randomInt(0, 30)*60)));
+        //System.out.println(splitMoth("2025-03",5));
+        //getCamelCaseInsertSql("mz_medical_main","patient_id, times, name, sex, birth_day, marry_code, country, nation, certificate_type, social_no, adress, phone_no, gms, allergen_name, qtgms, qtgmy, gh_date, bd_date, visit_date, dept_code, doctor_name, doctor_zc, visit_type, first_or_not, sy_or_not, mz_mtb, mz_hz_fj, jz_hz_qx, zyz_date, emr_chief_complaint, icd_name, icd_code, icd_name1, icd_code1, icd_name2, icd_code2, icd_name3, icd_code3, icd_name4, icd_code4, icd_name5, icd_code5, icd_name6, icd_code6, icd_name7, icd_code7, icd_name8, icd_code8, icd_name9, icd_code9, icd_name10, icd_code10, opr_date1, opr_name1, opr_code1, opr_doctor1, mzfs1, mz_doctor1, opr_scale1, opr_date2, opr_name2, opr_code2, opr_doctor2, mzfs2, mz_doctor2, opr_scale2, opr_date3, opr_name3, opr_code3, opr_doctor3, mzfs3, mz_doctor3, opr_scale3, opr_date4, opr_name4, opr_code4, opr_doctor4, mzfs4, mz_doctor4, opr_scale4, opr_date5, opr_name5, opr_code5, opr_doctor5, mzfs5, mz_doctor5, opr_scale5, total_fee, zf_fee, fee1, fee2, fee3, fee4, fee5, fee6, fee7, fee8, fee901, fee902, fee1001, fee1002, fee1003, fee11, fee12, fee13, fee14, fee15, fee16, fee17, fee18, fee19, fee20, fee21, fee22, fee23, fee24, fee25");
     }
 
+    public static List<Map<String,String>> splitMoth(String yearMoth ,int pageSize){
+        List<Map<String, String>> list = new ArrayList<>(10);
+        Date now = DateUtil.parseDate(yearMoth + "-01");
+        int lastDayOfMonth = DateUtil.getLastDayOfMonth(now);
+        List<Integer> arr = new ArrayList<>(31);
+        for (int i = 1; i <=lastDayOfMonth ; i++) {
+            arr.add(i);
+        }
+        List<List<Integer>> split = CollUtil.split(arr, pageSize);
+        for(List<Integer> item :split){
+            Map<String, String> map = new HashMap<>(2);
+            String startDay = item.get(0) >= 10 ? item.get(0)+"" : "0" +item.get(0) ;
+            String endDay = item.get(item.size()-1) >= 10 ? item.get(item.size()-1)+"" : "0" +item.get(item.size()-1) ;
+            map.put("startTime", yearMoth + "-" + startDay + " 00:00:00");
+            map.put("endTime", yearMoth + "-" + endDay + " 23:59:59");
+            list.add(map);
+        }
+        return list;
+    }
+
+    /**
+     * @description: 获取药品编码
+     * @author: lihong
+     * @date: 2025/2/20 16:10
+     * @param: prescriptionDetail
+     * @return: java.util.List<java.lang.String>
+     **/
+    public static List<String> getYpCodes(String prescriptionDetail) {
+        Map<String,Object> map = (Map<String,Object>) JsonUtil.jsontoObject(prescriptionDetail, Map.class);
+        List<Map<String, Object>> zyPrescription = (List<Map<String, Object>>) map.get("zyPrescription");
+        List<String> codes = new ArrayList<>();
+        putCodes(zyPrescription, codes);
+        Map<String, Object> xyPrescription = (Map<String, Object>) map.get("xyPrescription");
+        List<Map<String, Object>> pyPrescription = (List<Map<String, Object>>)xyPrescription.get("pyPrescription");
+        putCodes(pyPrescription,codes);
+        List<Map<String, Object>> jePrescription = (List<Map<String, Object>>)xyPrescription.get("jePrescription");
+        putCodes(jePrescription,codes);
+        List<Map<String, Object>> mjPrescription = (List<Map<String, Object>>)xyPrescription.get("mjPrescription");
+        putCodes(mjPrescription,codes);
+        List<Map<String, Object>> ycPrescription = (List<Map<String, Object>>)xyPrescription.get("ycPrescription");
+        putCodes(ycPrescription,codes);
+        return codes;
+    }
+
+    private static void putCodes(List<Map<String, Object>> zyPrescription, List<String> codes) {
+        if(CollUtil.isNotEmpty(zyPrescription)){
+            for(Map<String, Object> tempMap :zyPrescription){
+                List<Map<String, Object>> detail = (List<Map<String, Object>>)tempMap.get("detail");
+                for(Map<String, Object> detailMap : detail){
+                    String orderCode = (String)detailMap.get("orderCode");
+                    if(StrUtil.isNotBlank(orderCode)){
+                        String code = orderCode.split("_")[0];
+                        codes.add(code);
+                    }
+                }
+            }
+        }
+    }
+
+    public static void getCamelCaseInsertSql(String tableName,String underlineStr){
+        String[] split = underlineStr.split(",");
+        String startStr = "";
+
+        String str = "<script> insert into "+tableName + " ("+underlineStr+") values \n <foreach collection='list' item='item'  separator=','> \n (";
+        for (int i = 0; i < split.length ; i++) {
+            if(i ==split.length-1 ){
+                str += "#{item." +toCamelCase(split[i]).trim()+"}";
+            }else {
+                str += "#{item." +toCamelCase(split[i]).trim()+"},";
+            }
+        }
+        str += ")\n </foreach> \n </script>";
+
+        System.out.println(str);
+    }
+
+
+    /**
+     * 下划线转驼峰
+     * @param underlineStr
+     * @return
+     */
+    public static String toCamelCase(String underlineStr) {
+        if (underlineStr == null) {
+            return null;
+        }
+        // 分成数组
+        char[] charArray = underlineStr.toCharArray();
+        // 判断上次循环的字符是否是"_"
+        boolean underlineBefore = false;
+        StringBuffer buffer = new StringBuffer();
+        for (int i = 0, l = charArray.length; i < l; i++) {
+            // 判断当前字符是否是"_",如果跳出本次循环
+            if (charArray[i] == 95) {
+                underlineBefore = true;
+            } else if (underlineBefore) {
+                // 如果为true,代表上次的字符是"_",当前字符需要转成大写
+                buffer.append(charArray[i] -= 32);
+                underlineBefore = false;
+            } else {
+                // 不是"_"后的字符就直接追加
+                buffer.append(charArray[i]);
+            }
+        }
+        return buffer.toString();
+    }
+
+
+
 }

+ 23 - 0
src/main/java/cn/hnthyy/thmz/comment/MenuPermission.java

@@ -0,0 +1,23 @@
+package cn.hnthyy.thmz.comment;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface MenuPermission {
+    /**
+     * 菜单url
+     */
+    String value() default "";
+
+    /**
+     * 菜单名称
+     */
+    String name() default "";
+
+}

+ 46 - 1
src/main/java/cn/hnthyy/thmz/common/Constants.java

@@ -8,6 +8,14 @@ public class Constants {
      * 默认密码的MD%值 实际值1
      */
     public static final String DEFAULT_PASSWORD = "xMpCOKC5I4INzFCab3WEmw==";
+    /**
+     * 社会统一信用代码
+     */
+    public static final String USCI_CODE = "91430100663957823C";
+    /**
+     * 医疗服务 税收分类编码
+     */
+    public static final String TAX_SORT_CODE = "3070202000000000000";
     /**
      * 默认用户id
      */
@@ -155,6 +163,20 @@ public class Constants {
      * 套餐
      */
     public static final String TC = "TC";
+    /**
+     * 检查
+     */
+    public static final String JC = "JC";
+    /**
+     * 检验
+     */
+    public static final String JY = "JY";
+    /**
+     * 诊疗
+     */
+    public static final String ZL = "ZL";
+
+
 
 
     /**
@@ -193,6 +215,10 @@ public class Constants {
      * 代金券
      */
     public static final String DJZ = "K";
+    /**
+     * 抖音团购
+     */
+    public static final String DY_TG = "L";
     /**
      * 优惠活动
      */
@@ -407,10 +433,22 @@ public class Constants {
      * 简易门诊编码
      */
     public static final String JY_EXEC_CODE = "3110000";
+    /**
+     * 特殊门诊
+     */
+    public static final String TSMZ_CODE = "3110010";
     /**
      * 儿科编码
      */
     public static final String EK_CODE = "1040000";
+    /**
+     * 儿科门诊分类
+     */
+    public static final String EK_MZ_CLASS = "04";
+    /**
+     * 妇产科门诊分类
+     */
+    public static final String FCK_MZ_CLASS = "03";
     /**
      * 四舍五入 收费编码
      */
@@ -553,5 +591,12 @@ public class Constants {
      */
     public static final String JZ_CODE = "03";
 
-
+    //退款处理中
+    public static final String REFUND_PROCEEDING = "REFUND_PROCEEDING";
+    //退款成功
+    public static final String REFUND_SUCCEED = "REFUND_SUCCEED";
+    //退款失败
+    public static final String REFUND_FAILED = "REFUND_FAILED";
+    //退款异常
+    public static final String REFUND_ABNORMAL = "REFUND_ABNORMAL";
 }

+ 86 - 31
src/main/java/cn/hnthyy/thmz/controller/CommonController.java

@@ -1,32 +1,61 @@
 package cn.hnthyy.thmz.controller;
 
 import cn.hnthyy.thmz.Utils.AddressResolutionUtil;
-import cn.hnthyy.thmz.Utils.AssertUtil;
 import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.Utils.Tools;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.his.mz.CodeNameEntity;
 import cn.hnthyy.thmz.entity.his.mz.MzOrderFrequency;
-import cn.hnthyy.thmz.enums.*;
+import cn.hnthyy.thmz.entity.his.mz.MzOrderLock;
+import cn.hnthyy.thmz.enums.CertificateTypeEnum;
+import cn.hnthyy.thmz.enums.ClassCodeEnum;
+import cn.hnthyy.thmz.enums.NumberEnum;
+import cn.hnthyy.thmz.enums.OrderFrequencyEnum;
+import cn.hnthyy.thmz.enums.TemplateKindTypeEnum;
+import cn.hnthyy.thmz.enums.TemplateTypeEnum;
+import cn.hnthyy.thmz.mapper.his.mz.MzOrderLockMapper;
 import cn.hnthyy.thmz.service.his.RegionService;
-import cn.hnthyy.thmz.service.his.mz.*;
-import cn.hnthyy.thmz.service.his.zd.*;
+import cn.hnthyy.thmz.service.his.mz.MzBillItemService;
+import cn.hnthyy.thmz.service.his.mz.MzOrderFrequencyService;
+import cn.hnthyy.thmz.service.his.mz.MzZdCommonService;
+import cn.hnthyy.thmz.service.his.mz.MzZdDeptNoService;
+import cn.hnthyy.thmz.service.his.mz.MzZdSupplyTypeService;
+import cn.hnthyy.thmz.service.his.mz.MzZdWorkTimeService;
+import cn.hnthyy.thmz.service.his.mz.ZdChargeBaClassService;
+import cn.hnthyy.thmz.service.his.zd.DictDataService;
+import cn.hnthyy.thmz.service.his.zd.JcZdClassService;
+import cn.hnthyy.thmz.service.his.zd.MzYshZdFysmService;
+import cn.hnthyy.thmz.service.his.zd.YshZdPartCodeService;
+import cn.hnthyy.thmz.service.his.zd.ZdChargeItemService;
+import cn.hnthyy.thmz.service.his.zd.ZdIcdCodeService;
+import cn.hnthyy.thmz.service.his.zd.ZdMaritalStatusService;
+import cn.hnthyy.thmz.service.his.zd.ZdMzClassService;
 import cn.hnthyy.thmz.service.thmz.UserService;
+import cn.hnthyy.thmz.vo.MzDepositFileVo;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpStatus;
-import cn.hutool.http.HttpUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+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.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @Slf4j
 @RestController
@@ -63,6 +92,8 @@ public class CommonController {
     private ZdChargeBaClassService zdChargeBaClassService;
     @Autowired
     private MzOrderFrequencyService mzOrderFrequencyService;
+    @Resource
+    private MzOrderLockMapper mzOrderLockMapper;
     //websocket 地址前半部分
     @Value("${webSocketHost}")
     private String webSocketHost;
@@ -101,6 +132,14 @@ public class CommonController {
     }
 
 
+    @UserLoginToken
+    @RequestMapping(value = "/getDownFilePlus", method = {RequestMethod.GET})
+    public R getDownFilePlus() {
+        String dictVlaue = dictDataService.queryDictVlaue("2.9", "down_file_puls", null);
+        return R.ok().put("data", dictVlaue);
+    }
+
+
     /**
      * 查询门诊分类码
      *
@@ -1088,29 +1127,9 @@ public class CommonController {
                 resultMap.put("message", "身份证地址为空");
                 return resultMap;
             }
-            Map<String, String> result = AddressResolutionUtil.addressResolution(address);
-            String province = result.get("province");
-            String city = result.get("city");
-            String district = result.get("district");
-            CodeNameEntity codeNameEntity = regionService.queryByName(province, null);
-            if (codeNameEntity == null || StringUtils.isBlank(codeNameEntity.getName())) {
-                resultMap.put("code", -1);
-                resultMap.put("message", "根据身份证省份名称未查询到对应的省份信息");
-                return resultMap;
-            }
-            resultMap.put("provinceCode", codeNameEntity.getCode());
-            if (StringUtils.isBlank(district) &&  StringUtils.isNotBlank(city)) {
-                district = city;
-                //只有市,没有区,将市设置到区
-            }
-            CodeNameEntity cityCodeNameEntity = regionService.queryByName(district, codeNameEntity.getCode());
-            if(cityCodeNameEntity == null){
-                cityCodeNameEntity = regionService.queryByName(district, null);
-            }
-            if (cityCodeNameEntity != null && StringUtils.isNotBlank(cityCodeNameEntity.getName())) {
-                resultMap.put("cityCode", cityCodeNameEntity.getParentCode());
-                resultMap.put("districtCode", cityCodeNameEntity.getCode());
-            }
+            Map<String, String> result = AddressResolutionUtil.addressResolutionNew(address);
+            Map<String,Object> addressCodes = regionService.getAddressCodes(result);
+            resultMap.putAll(addressCodes);
             resultMap.put("detail", result.get("detail"));
             resultMap.put("code", 0);
             resultMap.put("message", "根据身份证号码与身份证地址获取级联地址成功");
@@ -1146,6 +1165,42 @@ public class CommonController {
         }
     }
 
+    /**
+     * @description: 解锁处方
+     * @author: lihong
+     * @date: 2024/10/29 10:07
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @PostMapping("/deleteOrderLock")
+    public R deleteOrderLock(@RequestBody MzDepositFileVo mzDepositFileVo){
+        MzOrderLock mzOrderLock = new MzOrderLock();
+        mzOrderLock.setHisOrderNum(Tools.getHisOrdNum(mzDepositFileVo.getPatientId(),mzDepositFileVo.getTimes(),Convert.toInt(mzDepositFileVo.getReceiptNo(),1)));
+        mzOrderLock.setLockFlag(0);
+        mzOrderLock.setUpdateId(TokenUtil.getUser().getUserIdCode());
+        mzOrderLock.setUpdateTime(new Date());
+        mzOrderLock.setYbzf(0);
+        mzOrderLockMapper.updateById(mzOrderLock);
+        return R.ok();
+    }
+
+    /**
+     * @description: 处方加锁
+     * @author: lihong
+     * @date: 2024/10/29 10:15
+     * @param: mzDepositFileVo
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @PostMapping("/addOrderLock")
+    public R addOrderLock(@RequestBody MzDepositFileVo mzDepositFileVo){
+        MzOrderLock mzOrderLock = new MzOrderLock();
+        mzOrderLock.setHisOrderNum(Tools.getHisOrdNum(mzDepositFileVo.getPatientId(),mzDepositFileVo.getTimes(),Convert.toInt(mzDepositFileVo.getReceiptNo(),1)));
+        mzOrderLock.setLockFlag(1);
+        mzOrderLock.setUpdateId(TokenUtil.getUser().getUserIdCode());
+        mzOrderLock.setUpdateTime(new Date());
+        mzOrderLockMapper.updateById(mzOrderLock);
+        return R.ok();
+    }
+
 
     @GetMapping("/queryProvinceCodes")
     public R queryProvinceCodes(){

+ 3 - 3
src/main/java/cn/hnthyy/thmz/controller/LoginController.java

@@ -94,7 +94,7 @@ public class LoginController {
         Employee employee = employeeService.queryByCodeRs(userParam.getUserCode());
         if (employee == null) {
             resultMap.put("code", -1);
-            resultMap.put("message", "登录失败,用户不存在,请联系管理员");
+            resultMap.put("message", "登录失败,用户名或密码错误");
             return resultMap;
         }
         if (user == null) {
@@ -117,8 +117,8 @@ public class LoginController {
             resultMap.put("message", "登录失败,账号状态为非在职,请联系管理员");
             return resultMap;
         }
-        //LoginErr loginErr = loginErrService.queryLoginErrByUserCode(user.getUserCode());
-        if(!userParam.getPassword().equals(user.getPassword())){
+        String password =  userService.queryPassword(userParam.getUserCode());
+        if(!userParam.getPassword().equals(password)){
             resultMap.put("code", -1);
             resultMap.put("message","用户名或密码错误!");
             return resultMap;

+ 30 - 0
src/main/java/cn/hnthyy/thmz/controller/NavigationController.java

@@ -321,6 +321,36 @@ public class NavigationController {
         }
         return "mz/refund_medicine";
     }
+    /**
+     * @description: 诊疗退费
+     * @author: lihong
+     * @date: 2024/11/18 10:54
+     * @param: httpServletRequest
+     * @return: java.lang.String
+     **/
+    @RequestMapping("/refund-zlItem")
+    public String refundZlItem(HttpServletRequest httpServletRequest) throws Exception {
+        List<String> urls = getRoleUrls(httpServletRequest);
+        if (!urls.contains("/thmz/refund-zlItem")) {
+            throw new Exception("您没有此模块的权限,请联系管理员开通!");
+        }
+        return "mz/refund_zlItem";
+    }
+    /**
+     * @description: 取消诊疗退费
+     * @author: lihong
+     * @date: 2024/11/18 10:55
+     * @param: httpServletRequest
+     * @return: java.lang.String
+     **/
+    @RequestMapping("/repeal-refund-zlItem")
+    public String repealRefundZlItem(HttpServletRequest httpServletRequest) throws Exception {
+        List<String> urls = getRoleUrls(httpServletRequest);
+        if (!urls.contains("/thmz/repeal-refund-zlItem")) {
+            throw new Exception("您没有此模块的权限,请联系管理员开通!");
+        }
+        return "mz/repeal_refund_zlItem";
+    }
 
 
     /**

+ 34 - 28
src/main/java/cn/hnthyy/thmz/controller/TransactionController.java

@@ -14,14 +14,18 @@ import cn.hnthyy.thmz.service.his.mz.MzyReqrecService;
 import cn.hnthyy.thmz.service.thmz.TransactionService;
 import cn.hnthyy.thmz.service.thmz.WindowsService;
 import cn.hnthyy.thmz.vo.MisPosVo;
+import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.json.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -42,13 +46,14 @@ public class TransactionController {
      *
      * @return
      */
-    @UserLoginToken
     @RequestMapping(value = "/sign", method = {RequestMethod.GET})
-    public Map<String, Object> sign(HttpServletRequest httpServletRequest) {
+    public Map<String, Object> sign(HttpServletRequest httpServletRequest,@RequestParam(required = false) String ip) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
-            String ipAddress = HttpUtil.getIPAddress(httpServletRequest);
-            Windows windowsDb = windowsService.queryLastWindowsIpAddress(ipAddress);
+            if(StrUtil.isBlank(ip)){
+                ip = HttpUtil.getIPAddress(httpServletRequest);
+            }
+            Windows windowsDb = windowsService.queryLastWindowsIpAddress(ip);
             if (windowsDb == null || StringUtils.isBlank(windowsDb.getMisPosRouterCode())) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "您暂未配置只能POS机的【路由识别码】,请配置完后重试!");
@@ -85,13 +90,14 @@ public class TransactionController {
      *
      * @return
      */
-    @UserLoginToken
     @RequestMapping(value = "/balance", method = {RequestMethod.GET})
-    public Map<String, Object> balance(HttpServletRequest httpServletRequest) {
+    public Map<String, Object> balance(HttpServletRequest httpServletRequest,@RequestParam(required = false) String ip) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
-            String ipAddress = HttpUtil.getIPAddress(httpServletRequest);
-            Windows windowsDb = windowsService.queryLastWindowsIpAddress(ipAddress);
+            if(StrUtil.isBlank(ip)){
+                ip = HttpUtil.getIPAddress(httpServletRequest);
+            }
+            Windows windowsDb = windowsService.queryLastWindowsIpAddress(ip);
             if (windowsDb == null || StringUtils.isBlank(windowsDb.getMisPosRouterCode())) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "您暂未配置只能POS机的【路由识别码】,请配置完后重试!");
@@ -129,7 +135,6 @@ public class TransactionController {
      *
      * @return
      */
-    @UserLoginToken
     @RequestMapping(value = "/consume", method = {RequestMethod.POST})
     public Map<String, Object> consume(@RequestBody MisPosVo misPosVo, HttpServletRequest httpServletRequest) {
         Map<String, Object> resultMap = new HashMap<>();
@@ -159,7 +164,7 @@ public class TransactionController {
                 resultMap.put("message", "请求类型参数传值错误!");
                 return resultMap;
             }
-            String ipAddress = HttpUtil.getIPAddress(httpServletRequest);
+            String ipAddress = StrUtil.isBlank(misPosVo.getIp()) ? HttpUtil.getIPAddress(httpServletRequest) : misPosVo.getIp();
             Windows windowsDb = windowsService.queryLastWindowsIpAddress(ipAddress);
             if (windowsDb == null || StringUtils.isBlank(windowsDb.getMisPosRouterCode())) {
                 resultMap.put("code", -1);
@@ -220,7 +225,6 @@ public class TransactionController {
      *
      * @return
      */
-    @UserLoginToken
     @RequestMapping(value = "/consumeCommon", method = {RequestMethod.POST})
     public Map<String, Object> consumeCommon(@RequestBody MisPosVo misPosVo, HttpServletRequest httpServletRequest) {
         Map<String, Object> resultMap = new HashMap<>();
@@ -240,7 +244,7 @@ public class TransactionController {
                 resultMap.put("message", "支付方式不能为空");
                 return resultMap;
             }
-            String ipAddress = HttpUtil.getIPAddress(httpServletRequest);
+            String ipAddress = StrUtil.isBlank(misPosVo.getIp()) ? HttpUtil.getIPAddress(httpServletRequest) : misPosVo.getIp();
             Windows windowsDb = windowsService.queryLastWindowsIpAddress(ipAddress);
             if (windowsDb == null || StringUtils.isBlank(windowsDb.getMisPosRouterCode())) {
                 resultMap.put("code", -1);
@@ -288,7 +292,6 @@ public class TransactionController {
      *
      * @return
      */
-    @UserLoginToken
     @RequestMapping(value = "/refund", method = {RequestMethod.POST})
     public Map<String, Object> refund(@RequestBody MisPosVo misPosVo, HttpServletRequest httpServletRequest) {
         Map<String, Object> resultMap = new HashMap<>();
@@ -344,7 +347,7 @@ public class TransactionController {
                 resultMap.put("message", "交易类型错误");
                 return resultMap;
             }
-            String ipAddress = HttpUtil.getIPAddress(httpServletRequest);
+            String ipAddress = StrUtil.isBlank(misPosVo.getIp()) ? HttpUtil.getIPAddress(httpServletRequest) : misPosVo.getIp();
             Windows windowsDb = windowsService.queryLastWindowsIpAddress(ipAddress);
             if (windowsDb == null || StringUtils.isBlank(windowsDb.getMisPosRouterCode())) {
                 resultMap.put("code", -1);
@@ -391,9 +394,8 @@ public class TransactionController {
      * @param httpServletRequest
      * @return
      */
-    @UserLoginToken
     @RequestMapping(value = "/reprint", method = {RequestMethod.GET})
-    public Map<String, Object> reprint(@RequestParam("traceNo") String traceNo,HttpServletRequest httpServletRequest) {
+    public Map<String, Object> reprint(@RequestParam("traceNo") String traceNo,@RequestParam(required = false) String ip,HttpServletRequest httpServletRequest) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
             if(StringUtils.isBlank(traceNo)){
@@ -401,8 +403,10 @@ public class TransactionController {
                 resultMap.put("message", "重印失败,交易凭证号为空!");
                 return resultMap;
             }
-            String ipAddress = HttpUtil.getIPAddress(httpServletRequest);
-            Windows windowsDb = windowsService.queryLastWindowsIpAddress(ipAddress);
+            if(StrUtil.isBlank(ip)){
+                ip = HttpUtil.getIPAddress(httpServletRequest);
+            }
+            Windows windowsDb = windowsService.queryLastWindowsIpAddress(ip);
             if (windowsDb == null || StringUtils.isBlank(windowsDb.getMisPosRouterCode())) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "您暂未配置只能POS机的【路由识别码】,请配置完后重试!");
@@ -441,13 +445,14 @@ public class TransactionController {
      *
      * @return
      */
-    @UserLoginToken
     @RequestMapping(value = "/settle", method = {RequestMethod.GET})
-    public Map<String, Object> settle(HttpServletRequest httpServletRequest) {
+    public Map<String, Object> settle(@RequestParam(required = false) String ip,HttpServletRequest httpServletRequest) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
-            String ipAddress = HttpUtil.getIPAddress(httpServletRequest);
-            Windows windowsDb = windowsService.queryLastWindowsIpAddress(ipAddress);
+            if(StrUtil.isBlank(ip)){
+                ip = HttpUtil.getIPAddress(httpServletRequest);
+            }
+            Windows windowsDb = windowsService.queryLastWindowsIpAddress(ip);
             if (windowsDb == null || StringUtils.isBlank(windowsDb.getMisPosRouterCode())) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "您暂未配置只能POS机的【路由识别码】,请配置完后重试!");
@@ -486,9 +491,8 @@ public class TransactionController {
      * @param httpServletRequest
      * @return
      */
-    @UserLoginToken
     @RequestMapping(value = "/query", method = {RequestMethod.GET})
-    public Map<String, Object> query(@RequestParam("plId") String plId,HttpServletRequest httpServletRequest) {
+    public Map<String, Object> query(@RequestParam("plId") String plId,@RequestParam(required = false) String ip,HttpServletRequest httpServletRequest) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
             if(StringUtils.isBlank(plId)){
@@ -496,8 +500,10 @@ public class TransactionController {
                 resultMap.put("message", "交易查询失败,订单号为空!");
                 return resultMap;
             }
-            String ipAddress = HttpUtil.getIPAddress(httpServletRequest);
-            Windows windowsDb = windowsService.queryLastWindowsIpAddress(ipAddress);
+            if(StrUtil.isBlank(ip)){
+                ip = HttpUtil.getIPAddress(httpServletRequest);
+            }
+            Windows windowsDb = windowsService.queryLastWindowsIpAddress(ip);
             if (windowsDb == null || StringUtils.isBlank(windowsDb.getMisPosRouterCode())) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "您暂未配置只能POS机的【路由识别码】,请配置完后重试!");

+ 4 - 1
src/main/java/cn/hnthyy/thmz/controller/UserController.java

@@ -4,6 +4,7 @@ import cn.hnthyy.thmz.Utils.JsonUtil;
 import cn.hnthyy.thmz.Utils.Md5Util;
 import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.Utils.TokenUtil;
+import cn.hnthyy.thmz.comment.MenuPermission;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.thmz.Role;
@@ -67,6 +68,7 @@ public class UserController {
         }
         DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
         User tokenUser = (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
+
         if (tokenUser == null || tokenUser.getId() == null) {
             resultMap.put("code", -1);
             resultMap.put("message", "用户信息修改失败,用户主键不能为空");
@@ -74,7 +76,7 @@ public class UserController {
         }
         if (StringUtils.isNotBlank(userParam.getOldPassword())) {
             try {
-                if (!Md5Util.checkPassword(userParam.getOldPassword(), tokenUser.getPassword())) {
+                if (!Md5Util.checkPassword(userParam.getOldPassword(), userService.queryPassword(tokenUser.getUserCode()))) {
                     resultMap.put("code", -1);
                     resultMap.put("message", "密码重置失败,原密码密码错误,请重新输入");
                     return resultMap;
@@ -241,6 +243,7 @@ public class UserController {
      *
      * @return
      */
+    @MenuPermission(value = "/thmz/user-manage",name = "用户管理")
     @UserLoginToken
     @RequestMapping(value = "/getUserPage", method = {RequestMethod.GET, RequestMethod.POST})
     public Map<String, Object> getUserPage(@RequestBody UserVo userVo) {

+ 123 - 34
src/main/java/cn/hnthyy/thmz/controller/api/MedicalViewApiController.java

@@ -1,10 +1,17 @@
 package cn.hnthyy.thmz.controller.api;
 
 
-import cn.hnthyy.thmz.Utils.*;
+import cn.hnthyy.thmz.Utils.AddressResolutionUtil;
+import cn.hnthyy.thmz.Utils.AssertUtil;
+import cn.hnthyy.thmz.Utils.CloneUtil;
+import cn.hnthyy.thmz.Utils.DateUtil;
+import cn.hnthyy.thmz.Utils.HttpUtil;
+import cn.hnthyy.thmz.Utils.JsonUtil;
+import cn.hnthyy.thmz.Utils.NumberToCN;
+import cn.hnthyy.thmz.Utils.R;
+import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.common.exception.BizException;
-import cn.hnthyy.thmz.common.validate.ValidatorUtils;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.haici.HaiciCharge;
 import cn.hnthyy.thmz.entity.haici.Haicipat;
@@ -14,22 +21,44 @@ import cn.hnthyy.thmz.entity.his.zd.ZdMzClass;
 import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode;
 import cn.hnthyy.thmz.entity.his.zy.ZyActpatient;
 import cn.hnthyy.thmz.entity.his.zy.ZyDepositFile;
-import cn.hnthyy.thmz.entity.thmz.*;
-import cn.hnthyy.thmz.enums.*;
+import cn.hnthyy.thmz.entity.mzdzfp.MzDzfpUpload;
+import cn.hnthyy.thmz.entity.thmz.Clinic;
+import cn.hnthyy.thmz.entity.thmz.Config;
+import cn.hnthyy.thmz.entity.thmz.DiscountVo;
+import cn.hnthyy.thmz.entity.thmz.HybirdTest;
+import cn.hnthyy.thmz.entity.thmz.PayInfo;
+import cn.hnthyy.thmz.entity.thmz.TcRefundFeeVo;
+import cn.hnthyy.thmz.entity.thmz.User;
+import cn.hnthyy.thmz.entity.thmz.WhiteList;
+import cn.hnthyy.thmz.enums.ConfirmFlagEnum;
+import cn.hnthyy.thmz.enums.GenderEnum;
+import cn.hnthyy.thmz.enums.PayMarkEnum;
+import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.pageDto.MzChargeDetailPageDto;
 import cn.hnthyy.thmz.pageDto.MzyReqrecPageDto;
 import cn.hnthyy.thmz.pageDto.ZdUnitCodePageDto;
 import cn.hnthyy.thmz.service.his.RegionService;
 import cn.hnthyy.thmz.service.his.ResponceTypeService;
 import cn.hnthyy.thmz.service.his.mz.*;
+import cn.hnthyy.thmz.service.his.zd.DictDataService;
 import cn.hnthyy.thmz.service.his.zd.ZdEmpTitleService;
 import cn.hnthyy.thmz.service.his.zd.ZdMzClassService;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import cn.hnthyy.thmz.service.his.zy.APatientMiService;
 import cn.hnthyy.thmz.service.his.zy.ZyActpatientService;
 import cn.hnthyy.thmz.service.his.zy.ZyDepositFileService;
-import cn.hnthyy.thmz.service.thmz.*;
-import cn.hnthyy.thmz.vo.*;
+import cn.hnthyy.thmz.service.thmz.ClinicService;
+import cn.hnthyy.thmz.service.thmz.ConfigService;
+import cn.hnthyy.thmz.service.thmz.HybirdTestService;
+import cn.hnthyy.thmz.service.thmz.TsmzService;
+import cn.hnthyy.thmz.service.thmz.UserService;
+import cn.hnthyy.thmz.service.thmz.WhiteListService;
+import cn.hnthyy.thmz.vo.MzDepositFileVo;
+import cn.hnthyy.thmz.vo.MzPrescriptionVo;
+import cn.hnthyy.thmz.vo.MzReceiptSerialVo;
+import cn.hnthyy.thmz.vo.PageViewVo;
+import cn.hnthyy.thmz.vo.SfjkMzbrmxVo;
+import cn.hnthyy.thmz.vo.SfjkMzbrxxVo;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
@@ -37,12 +66,26 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DataIntegrityViolationException;
-import org.springframework.web.bind.annotation.*;
-
+import org.springframework.web.bind.annotation.GetMapping;
+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.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 @RestController
@@ -101,8 +144,11 @@ public class MedicalViewApiController {
     private ConfigService configService;
     @Autowired
     private RegionService regionService;
-    @Autowired
-    private DiscountService discountService;
+    @Resource
+    private MzOrderDetailService mzOrderDetailService;
+    @Resource
+    private DictDataService dictDataService;
+
     //海慈身份证类型
     private static final String ID_CARD_TYPE = "11";
     //诊疗卡类型
@@ -265,24 +311,14 @@ public class MedicalViewApiController {
         mzPatientMi.setSex(MAN.equals(haicipat.getPatSex()) ? YesNoEnum.YES.code : 2);
         mzPatientMi.setAge(haicipat.getPatAge());
         mzPatientMi.setBirthDay(haicipat.getPatBirth());
-        Map<String, String> result = AddressResolutionUtil.addressResolution(haicipat.getPatAddress());
-        String province = result.get("province");
-        String city = result.get("city");
-        String district = result.get("district");
-        CodeNameEntity codeNameEntity = regionService.queryByName(province, null);
-        if (codeNameEntity != null && StringUtils.isNotBlank(codeNameEntity.getName())) {
-            mzPatientMi.setProvinceCode(codeNameEntity.getCode());
-        }
-        if ((district == null || StringUtils.isBlank(district) && (city != null && StringUtils.isNotBlank(city)))) {
-            district = city;
-            //只有市,没有区,将市设置到区
-        }
-        codeNameEntity = regionService.queryByName(district, codeNameEntity == null ? null : codeNameEntity.getCode());
-        if (codeNameEntity != null && StringUtils.isNotBlank(codeNameEntity.getName())) {
-            mzPatientMi.setCityCode(codeNameEntity.getParentCode());
-            mzPatientMi.setDistrictCode(codeNameEntity.getCode());
-        }
-        mzPatientMi.setDetail(result.get("detail"));
+        if(StrUtil.isNotBlank(haicipat.getPatAddress())){
+            Map<String, String> result = AddressResolutionUtil.addressResolutionNew(haicipat.getPatAddress());
+            Map<String, Object> addressCodes = regionService.getAddressCodes(result);
+            mzPatientMi.setProvinceCode(Convert.toStr(addressCodes.get("provinceCode")));
+            mzPatientMi.setCityCode(Convert.toStr(addressCodes.get("cityCode")));
+            mzPatientMi.setDistrictCode(Convert.toStr(addressCodes.get("districtCode")));
+            mzPatientMi.setDetail(result.get("detail"));
+        }
         mzPatientMi.setAddress(haicipat.getPatAddress());
         mzPatientMi.setPhoneNo(haicipat.getPatMobile());
         mzPatientMi.setSocialNo(haicipat.getPatIdNo());
@@ -586,14 +622,30 @@ public class MedicalViewApiController {
                 results.put("resultMessage", "未查询到待缴费记录");
                 return results;
             }
-            mzChargeDetailService.formatMzChargeDetail(mzChargeDetailList);
+            mzChargeDetailService.formatMzChargeDetail(mzChargeDetailList,false);
             List<Map<String, Object>> returnList = new ArrayList<>();
             for (MzChargeDetail mzChargeDetail : mzChargeDetailList) {
                 Clinic clinic = clinicService.queryByPatientIdAndTimesAndReceiptNo(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), mzChargeDetail.getReceiptNo());
                 if (clinic != null && StringUtils.isNotBlank(clinic.getOpId()) && Constants.HLWYY_CODE.equals(clinic.getOpId()) && !whiteList.getOpId().equals(clinic.getOpId())) {
                     continue;
                 }
+                // 0 普通门诊统筹处方  1 自费处方  2 门特处方
+                Integer vipFlag = 1;
+                if(clinic != null){
+                    vipFlag =  Convert.toInt(clinic.getZgmztczf(),0) == 0 ? 1 : 0;
+                }
+                MzOrderDetail mzOrderDetail = mzOrderDetailService.queryByPatientIdAndTimes(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes());
+                if(mzOrderDetail != null){
+                    if(Convert.toInt(mzOrderDetail.getOrderType(),1) == 1){
+                        vipFlag = 1;
+                    }else if(Convert.toInt(mzOrderDetail.getOrderType(),1) == 2){
+                        vipFlag = 0;
+                    }else if(Convert.toInt(mzOrderDetail.getOrderType(),1) == 3){
+                        vipFlag = 2;
+                    }
+                }
                 Map<String, Object> map = new HashMap<>();
+                map.put("vipFlag", vipFlag);
                 map.put("hisOrdNum", mzChargeDetail.getPatientId() + "_" + mzChargeDetail.getTimes() + "_" + mzChargeDetail.getReceiptNo());
                 map.put("patName", mzChargeDetail.getName());
                 map.put("payName", "");
@@ -828,7 +880,13 @@ public class MedicalViewApiController {
                 BigDecimal tempCouponAmt = calcuCouponAmt(haiciCharge);
                 setAllDepositFile(mzDepositFiles,haiciCharge, Constants.DJZ,tempCouponAmt);
             }
-            mzChargeDetailService.chargeFee(whiteList.getOpId(), mzDepositFileVo, whiteList.getOpId());
+           int receiptNo = mzChargeDetailService.chargeFee(whiteList.getOpId(), mzDepositFileVo, whiteList.getOpId());
+            requestDzfp(MzDzfpUpload.builder()
+                    .patientId(mzDepositFileVo.getPatientId())
+                    .times(mzDepositFileVo.getTimes())
+                    .typeFlag(1)
+                    .receiptNo(receiptNo)
+                    .build(),false);
             results.put("resultCode", 0);
             results.put("resultMessage", "缴费成功");
             results.put("guideListInfo", "");
@@ -848,6 +906,15 @@ public class MedicalViewApiController {
         }
     }
 
+    private void requestDzfp(MzDzfpUpload mzDzfpUpload,boolean ghFlag){
+        if(dictDataService.queryFpVersion() == 1){
+            MzReceiptSerial mzReceiptSerial = new MzReceiptSerial(mzDzfpUpload.getPatientId(), mzDzfpUpload.getTimes());
+            mzReceiptSerial.setReceiptNo(mzDzfpUpload.getReceiptNo());
+            dictDataService.getBswServer().asnyMzInvoice(mzReceiptSerial,ghFlag,mzDzfpUpload.getTypeFlag());
+        }
+    }
+
+
     private BigDecimal calcuCouponAmt(HaiciCharge haiciCharge) {
         BigDecimal temp = haiciCharge.getPayAmt().subtract(Convert.toBigDecimal(haiciCharge.getAcctpayAmt(), BigDecimal.ZERO)).subtract(Convert.toBigDecimal(haiciCharge.getCashpayAmt(), BigDecimal.ZERO)).subtract(Convert.toBigDecimal(haiciCharge.getFundpayAmt(), BigDecimal.ZERO));
         if(temp.compareTo(haiciCharge.getCouponAmt()) < 0 ){
@@ -956,7 +1023,13 @@ public class MedicalViewApiController {
                 }
                 if (CollUtil.isNotEmpty(mzDepositFiles)) {
                     mzDepositFileVo.setMzDepositFiles(mzDepositFiles);
-                    mzChargeDetailService.chargeFee(Constants.BRZZJF_CODE, mzDepositFileVo, Constants.BRZZJF_CODE);
+                   int receiptNo = mzChargeDetailService.chargeFee(Constants.BRZZJF_CODE, mzDepositFileVo, Constants.BRZZJF_CODE);
+                    requestDzfp(MzDzfpUpload.builder()
+                            .patientId(mzDepositFileVo.getPatientId())
+                            .times(mzDepositFileVo.getTimes())
+                            .typeFlag(1)
+                            .receiptNo(receiptNo)
+                            .build(),false);
                 } else {
                     throw new BizException("获取医保费用失败");
                 }
@@ -1098,6 +1171,12 @@ public class MedicalViewApiController {
             mzDepositFileVo.setRefundType(YesNoEnum.YES.code);
             User tokenUser = userService.queryUserByUserIdCode(Constants.BRZZJF_CODE);
             mzChargeDetailService.refundFee(tokenUser.getUserIdCode(), mzDepositFileVo, Constants.BRZZJF_CODE);
+            requestDzfp(MzDzfpUpload.builder()
+                    .patientId(mzDepositFileVo.getPatientId())
+                    .times(mzDepositFileVo.getTimes())
+                    .typeFlag(2)
+                    .receiptNo(mzDepositFileVo.getReceiptNo())
+                    .build(),false);
             results.put("resultCode", 0);
             results.put("resultMessage", "退费成功");
             results.put("guideListInfo", "");
@@ -1155,7 +1234,11 @@ public class MedicalViewApiController {
             results.put("resultMessage", "患者ID不能为空");
             return results;
         }
-        mzDepositFile.setOpId(whiteList.getOpId());
+        mzDepositFile.setOpId(null);
+        List<MzPatientMi> mzPatientMi = mzPatientMiService.queryBySocialNo(mzDepositFile.getPatientId(),null);
+        if(CollUtil.isNotEmpty(mzPatientMi)){
+            mzDepositFile.setPatientId(mzPatientMi.get(0).getPatientId());
+        }
         try {
             List<Map<String, Object>> mzChargeDetailList = mzDepositFileService.queryMzDepositFileForZZ(mzDepositFile);
             if (mzChargeDetailList == null || mzChargeDetailList.size() == 0) {
@@ -2319,6 +2402,12 @@ public class MedicalViewApiController {
             }
             mzyReqrec.setOpId(whiteList.getOpId());
             int num = mzyReqrecService.saveMzyReqrec(mzyReqrecPageDto, whiteList.getOpId());
+            requestDzfp(MzDzfpUpload.builder()
+                    .patientId(mzyReqrecPageDto.getMzyReqrec().getPatientId())
+                    .times(num)
+                    .typeFlag(1)
+                    .receiptNo(0)
+                    .build(),true);
             resultMap.put("resultCode", 0);
             resultMap.put("message", "保存挂号信息成功");
             return resultMap;

+ 8 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/ButtonController.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.controller.mz;
 
+import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.thmz.*;
@@ -7,6 +8,7 @@ import cn.hnthyy.thmz.service.thmz.ButtonService;
 import cn.hnthyy.thmz.service.thmz.MenuService;
 import cn.hnthyy.thmz.service.thmz.RoleButtonRelationService;
 import cn.hnthyy.thmz.vo.RoleButtonVo;
+import cn.hutool.core.collection.CollUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -231,5 +233,11 @@ public class ButtonController {
             return resultMap;
         }
     }
+    @GetMapping("/queryButtonByUserId")
+    @UserLoginToken
+    public R queryButtonByUserId(){
+        List<Button> buttons = buttonService.queryByUserId(TokenUtil.getUser().getId());
+        return R.ok().put("data", buttons);
+    }
 
 }

+ 3 - 5
src/main/java/cn/hnthyy/thmz/controller/mz/ClinicController.java

@@ -146,11 +146,9 @@ public class ClinicController {
                 serialNo = null;
             }
             //未接诊的需要变更接诊状态
-            if (serialNo != null && StringUtils.isNotBlank(serialNo)) {
-                int num = clinicService.inClinic(patientId, serialNo, turnToConsultationId,deptNo, tokenUser.getUserIdCode());
-                if (num > 0) {
-                    haiCiAdapterService.notify(serialNo, 2);
-                }
+            if (StringUtils.isNotBlank(serialNo)) {
+                clinicService.inClinic(patientId, serialNo, turnToConsultationId,deptNo, tokenUser.getUserIdCode());
+                haiCiAdapterService.notify(serialNo, 2);
             }
             resultMap.put("code", 0);
             resultMap.put("message", "接诊成功");

+ 147 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/DiscountController.java

@@ -2,12 +2,18 @@ package cn.hnthyy.thmz.controller.mz;
 
 import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.Utils.TokenUtil;
+import cn.hnthyy.thmz.Utils.Tools;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.thmz.Discount;
 import cn.hnthyy.thmz.entity.thmz.User;
+import cn.hnthyy.thmz.enums.NumberEnum;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.service.thmz.DiscountService;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.NumberUtil;
+import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -237,6 +244,146 @@ public class DiscountController {
                 resultMap.put("message", "停用标志不能为空");
                 return resultMap;
             }
+            if(discount.getTimeType()==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "活动时间类型不能为空");
+                return resultMap;
+            }
+            if(NumberEnum.ZERO.getCode().equals(discount.getTimeType())){
+                discount.setWeekDay("");
+                discount.setMonthDay("");
+                discount.setAlwaysDay("");
+                discount.setMonthNum("");
+                discount.setStartTime("");
+                discount.setEndTime("");
+            }
+            if(NumberEnum.ONE.getCode().equals(discount.getTimeType())){
+                if(StrUtil.isBlank(discount.getStartTime()) || StrUtil.isBlank(discount.getEndTime())){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每周执行,开始时间或结束时间不能为空");
+                    return resultMap;
+                }
+                try {
+                    if(!Tools.isValidTime24H(discount.getStartTime()) || !Tools.isValidTime24H(discount.getEndTime())){
+                        resultMap.put("code", -1);
+                        resultMap.put("message", "类型为每周执行,开始时间或结束时间格式不对");
+                        return resultMap;
+                    }
+                    Date now = new Date();
+                    Date starTime = DateUtil.parseDateTime(DateUtil.format(now, "yyyy-MM-dd") + " " + discount.getStartTime());
+                    Date endTime=DateUtil.parseDateTime(DateUtil.format(now, "yyyy-MM-dd") + " " + discount.getEndTime());
+                    if(starTime.getTime() > endTime.getTime()){
+                        resultMap.put("code", -1);
+                        resultMap.put("message", "类型为每周执行,开始时间不能大于结束时间");
+                        return resultMap;
+                    }
+                }catch (Exception e){
+                    log.error("开始时间或结束时间格式不对{}", e);
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每周执行,开始时间或结束时间格式不对");
+                    return resultMap;
+                }
+                if(StrUtil.isBlank(discount.getWeekDay())){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每周执行,每周几不能为空");
+                    return resultMap;
+                }
+                if(!NumberUtil.isInteger(discount.getWeekDay()) || Convert.toInt(discount.getWeekDay()) < 1 || Convert.toInt(discount.getWeekDay()) > 7 ){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "每周几格式不对,请填 1-7的数字");
+                    return resultMap;
+                }
+                if(StrUtil.isBlank(discount.getAlwaysDay()) && NumberUtil.isInteger(discount.getAlwaysDay()) && Convert.toInt(discount.getAlwaysDay()) > 0){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每周执行,持续天数不能为空不能为空并且为大于0的整数");
+                    return resultMap;
+                }
+                discount.setMonthDay("");
+                discount.setMonthNum("");
+            }
+            if(NumberEnum.ThREE.getCode().equals(discount.getTimeType())){
+                if(StrUtil.isBlank(discount.getStartTime()) || StrUtil.isBlank(discount.getEndTime())){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每年执行,开始时间或结束时间不能为空");
+                    return resultMap;
+                }
+                try {
+                    if(!Tools.isValidTime24H(discount.getStartTime()) || !Tools.isValidTime24H(discount.getEndTime())){
+                        resultMap.put("code", -1);
+                        resultMap.put("message", "类型为每年执行,开始时间或结束时间格式不对");
+                        return resultMap;
+                    }
+                    Date now = new Date();
+                    Date starTime = DateUtil.parseDateTime(DateUtil.format(now, "yyyy-MM-dd") + " " + discount.getStartTime());
+                    Date endTime=DateUtil.parseDateTime(DateUtil.format(now, "yyyy-MM-dd") + " " + discount.getEndTime());
+                    if(starTime.getTime() > endTime.getTime()){
+                        resultMap.put("code", -1);
+                        resultMap.put("message", "类型为每年执行,开始时间不能大于结束时间");
+                        return resultMap;
+                    }
+                }catch (Exception e){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每年执行,开始时间或结束时间格式不对");
+                    return resultMap;
+                }
+                if(StrUtil.isBlank(discount.getMonthDay())){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每年执行,几月几号不能为空");
+                    return resultMap;
+                }
+                try {
+                    DateUtil.parse(DateUtil.year(discount.getDiscountBeginTime())+"-" + discount.getMonthDay(), "yyyy-MM-dd");
+                }catch (Exception e){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每年执行,几月几号格式不对");
+                    return resultMap;
+                }
+                if(StrUtil.isBlank(discount.getAlwaysDay()) && NumberUtil.isInteger(discount.getAlwaysDay()) && Convert.toInt(discount.getAlwaysDay()) > 0){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每年执行,持续天数不能为空不能为空并且为大于0的整数");
+                    return resultMap;
+                }
+                discount.setWeekDay("");
+                discount.setMonthNum("");
+            }
+            if(NumberEnum.TWO.getCode().equals(discount.getTimeType())){
+                if(StrUtil.isBlank(discount.getStartTime()) || StrUtil.isBlank(discount.getEndTime())){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每月执行,开始时间或结束时间不能为空");
+                    return resultMap;
+                }
+                try {
+                    if(!Tools.isValidTime24H(discount.getStartTime()) || !Tools.isValidTime24H(discount.getEndTime())){
+                        resultMap.put("code", -1);
+                        resultMap.put("message", "类型为每月执行,开始时间或结束时间格式不对");
+                        return resultMap;
+                    }
+                    Date now = new Date();
+                    Date starTime = DateUtil.parseDateTime(DateUtil.format(now, "yyyy-MM-dd") + " " + discount.getStartTime());
+                    Date endTime=DateUtil.parseDateTime(DateUtil.format(now, "yyyy-MM-dd") + " " + discount.getEndTime());
+                    if(starTime.getTime() > endTime.getTime()){
+                        resultMap.put("code", -1);
+                        resultMap.put("message", "类型为每月执行,开始时间不能大于结束时间");
+                        return resultMap;
+                    }
+                }catch (Exception e){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每月执行,开始时间或结束时间格式不对");
+                    return resultMap;
+                }
+                if(StrUtil.isBlank(discount.getMonthNum())){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每月执行,每月几号不能为空");
+                    return resultMap;
+                }
+                if(StrUtil.isBlank(discount.getAlwaysDay()) && NumberUtil.isInteger(discount.getAlwaysDay()) && Convert.toInt(discount.getAlwaysDay()) > 0){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "类型为每月执行,持续天数不能为空不能为空并且为大于0的整数");
+                    return resultMap;
+                }
+                discount.setWeekDay("");
+                discount.setMonthDay("");
+            }
             User tokenUser = TokenUtil.getUser(httpServletRequest);
             if(discount.getDeptType() == 2){
                 discount.setDeptNo("");

+ 14 - 1
src/main/java/cn/hnthyy/thmz/controller/mz/MzBlRecordController.java

@@ -2,14 +2,18 @@ package cn.hnthyy.thmz.controller.mz;
 
 import cn.hnthyy.thmz.Utils.DateUtil;
 import cn.hnthyy.thmz.Utils.TokenUtil;
+import cn.hnthyy.thmz.Utils.Tools;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.his.mz.*;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.GenderEnum;
+import cn.hnthyy.thmz.enums.NumberEnum;
 import cn.hnthyy.thmz.service.his.mz.*;
 import cn.hnthyy.thmz.service.his.yp.YpZdDictService;
 import cn.hnthyy.thmz.service.his.zd.ZdAllergenService;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -50,7 +54,7 @@ public class MzBlRecordController {
      */
     @UserLoginToken
     @RequestMapping(value = "/getMzBlrecord", method = {RequestMethod.GET})
-    public Map<String, Object> getMzBlrecord(@RequestParam("patientId") String patientId, @RequestParam("times") Integer times) {
+    public Map<String, Object> getMzBlrecord(@RequestParam("patientId") String patientId, @RequestParam("times") Integer times,@RequestParam(required = false,value ="type" )Integer type) {
         Map<String, Object> results = new HashMap<>();
         if (StringUtils.isBlank(patientId)) {
             results.put("code", -1);
@@ -69,6 +73,14 @@ public class MzBlRecordController {
                 results.put("message", "查询门诊病历失败,没有对应的门诊病历数据");
                 return results;
             }
+            //1为编辑
+            if(!NumberEnum.ONE.getCode().equals(Convert.toStr(type, ""))){
+                List<String> codes = Tools.getYpCodes(mzBlRecord.getPrescriptionDetail());
+                String healthContent = ypZdDictService.getHealthContent(codes);
+                if(StrUtil.isNotBlank(healthContent)){
+                    mzBlRecord.setEmrJkjy(mzBlRecord.getEmrJkjy()+healthContent);
+                }
+            }
             results.put("code", 0);
             results.put("message", "查询门诊病历成功");
             results.put("mzBlRecord", mzBlRecord);
@@ -264,6 +276,7 @@ public class MzBlRecordController {
             dbMzBlRecord.setObstericalHistory(mzBlRecord.getObstericalHistory());
             dbMzBlRecord.setEmrPe(mzBlRecord.getEmrPe());
             dbMzBlRecord.setFzZl(mzBlRecord.getFzZl());
+            dbMzBlRecord.setCrbHistory(mzBlRecord.getCrbHistory());
             dbMzBlRecord.setWeight(mzBlRecord.getWeight());
             dbMzBlRecord.setTemperature(mzBlRecord.getTemperature());
             dbMzBlRecord.setSphygmus(mzBlRecord.getSphygmus());

+ 192 - 56
src/main/java/cn/hnthyy/thmz/controller/mz/MzChargeDetailController.java

@@ -19,6 +19,7 @@ import cn.hnthyy.thmz.entity.his.zd.ZdChequeType;
 import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode;
 import cn.hnthyy.thmz.entity.his.zy.ZyZdAuditItem;
 import cn.hnthyy.thmz.entity.thmz.Clinic;
+import cn.hnthyy.thmz.entity.thmz.Discount;
 import cn.hnthyy.thmz.entity.thmz.HybirdTest;
 import cn.hnthyy.thmz.entity.thmz.PayInfo;
 import cn.hnthyy.thmz.entity.thmz.TurnToConsultation;
@@ -27,27 +28,21 @@ import cn.hnthyy.thmz.entity.thmz.Windows;
 import cn.hnthyy.thmz.enums.ClinicStatusEnum;
 import cn.hnthyy.thmz.enums.GenderEnum;
 import cn.hnthyy.thmz.enums.MzfzStatusEnum;
+import cn.hnthyy.thmz.enums.NumberEnum;
 import cn.hnthyy.thmz.enums.PayMarkEnum;
 import cn.hnthyy.thmz.enums.YesNoEnum;
+import cn.hnthyy.thmz.mapper.his.mz.MzOrderLockMapper;
 import cn.hnthyy.thmz.pageDto.MzChargeDetailPageDto;
-import cn.hnthyy.thmz.service.his.ResponceTypeService;
 import cn.hnthyy.thmz.service.his.mz.*;
 import cn.hnthyy.thmz.service.his.yp.YpZdDictService;
 import cn.hnthyy.thmz.service.his.yp.YpZdDrugKindService;
+import cn.hnthyy.thmz.service.his.zd.DictDataService;
 import cn.hnthyy.thmz.service.his.zd.JcJyItemChargeService;
 import cn.hnthyy.thmz.service.his.zd.ZdChargeItemService;
 import cn.hnthyy.thmz.service.his.zd.ZdChequeTypeService;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import cn.hnthyy.thmz.service.his.zy.ZyZdAuditItemService;
-import cn.hnthyy.thmz.service.thmz.ClinicService;
-import cn.hnthyy.thmz.service.thmz.HaiCiAdapterService;
-import cn.hnthyy.thmz.service.thmz.HybirdTestService;
-import cn.hnthyy.thmz.service.thmz.RationalUseService;
-import cn.hnthyy.thmz.service.thmz.TransactionService;
-import cn.hnthyy.thmz.service.thmz.TsmzService;
-import cn.hnthyy.thmz.service.thmz.TurnToConsultationService;
-import cn.hnthyy.thmz.service.thmz.UserDeptRelationService;
-import cn.hnthyy.thmz.service.thmz.WindowsService;
+import cn.hnthyy.thmz.service.thmz.*;
 import cn.hnthyy.thmz.vo.ChargeFeeParamsVo;
 import cn.hnthyy.thmz.vo.MzDepositFileVo;
 import cn.hnthyy.thmz.vo.MzPrescriptionVo;
@@ -133,6 +128,17 @@ public class MzChargeDetailController {
     private TransactionService transactionService;
     @Autowired
     private ZdChequeTypeService zdChequeTypeService;
+    @Resource
+    private MzOrderLockMapper mzOrderLockMapper;
+    @Resource
+    private MzYjReqService mzYjReqService;
+    @Resource
+    DiscountService discountService;
+    @Resource
+    WpMzPrescriptionService wpMzPrescriptionService;
+    @Resource
+    DictDataService dictDataService;
+
     @Value("${healthEducationUrl}")
     private String healthEducationUrl;
     @Value("${wxPayQrUrl}")
@@ -218,7 +224,7 @@ public class MzChargeDetailController {
                 pageViewVo.setTotal(mzChargeDetailService.countMzChargeDetail(mzChargeDetailPageDto));
                 mzChargeDetails = mzChargeDetailService.queryMzChargeDetailWithPage(mzChargeDetailPageDto);
             }
-            mzChargeDetailService.formatMzChargeDetail(mzChargeDetails);
+            mzChargeDetailService.formatMzChargeDetail(mzChargeDetails,true);
             pageViewVo.setData(mzChargeDetails);
             resultMap.put("code", 0);
             resultMap.put("message", "查询费用列表信息成功");
@@ -407,6 +413,16 @@ public class MzChargeDetailController {
                 resultMap.put("message", "缴费失败,用户Token不存在");
                 return resultMap;
             }
+            for(MzDepositFile mzDepositFile : mzDepositFileVo.getMzDepositFiles()){
+                if(Constants.DY_TG.equals(mzDepositFile.getChequeType())){
+                    if(StrUtil.isBlank(mzDepositFile.getDyTgNo())){
+                        resultMap.put("code", -1);
+                        resultMap.put("message", "付费方式为抖音团购,必须输入抖音团购码");
+                        return resultMap;
+                    }
+                    mzDepositFile.setContractId(Convert.toLong(mzDepositFile.getDyTgNo()));
+                }
+            }
             DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
             User tokenUser = (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
             List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialService.queryTallyReceiptSerialByIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
@@ -429,6 +445,11 @@ public class MzChargeDetailController {
                 resultMap.put("receiptNo", receiptNo);
             }
              else  if(CollUtil.isNotEmpty(mzDepositFiles)){
+                 if(mzDepositFiles.stream().anyMatch(item->Constants.ZZWX.equals(item.getChequeType()))){
+                     resultMap.put("code", -1);
+                     resultMap.put("message", "缴费失败,已经缴费,缴费方式为微信缴费,请不要重复缴费!");
+                     return resultMap;
+                 }
                 //    修改收费人
                 mzChargeDetailService.updateOpId(HttpUtil.getIPAddress(httpServletRequest),TokenUtil.getUser().getUserIdCode(),mzDepositFileVo);
                 resultMap.put("receiptNo", 1);
@@ -548,16 +569,23 @@ public class MzChargeDetailController {
             }
             List<MzChargeDetail> removeList = new ArrayList<>();
             if (mzChargeDetailList != null && mzChargeDetailList.size() > 0) {
-                MzChargeDetailYb mzChargeDetailYb = new MzChargeDetailYb();
-                mzChargeDetailYb.setPatientId(mzChargeDetail.getPatientId());
-                mzChargeDetailYb.setTimes(mzChargeDetail.getTimes());
-                mzChargeDetailYb.setReceiptNo(mzChargeDetail.getReceiptNo());
+                //MzChargeDetailYb mzChargeDetailYb = new MzChargeDetailYb();
+                //mzChargeDetailYb.setPatientId(mzChargeDetail.getPatientId());
+                //mzChargeDetailYb.setTimes(mzChargeDetail.getTimes());
+                //mzChargeDetailYb.setReceiptNo(mzChargeDetail.getReceiptNo());
                 // int count = mzChargeDetailYbService.queryTmCount(mzChargeDetailYb);
                 for (MzChargeDetail md : mzChargeDetailList) {
                     if ("TC".equals(md.getBillItemCode()) || Constants.SSWRF.equals(md.getBillItemCode())) {
                         removeList.add(md);
                         continue;
                     }
+                    if(md.getReqNo() != null && md.getReqNo() != 0 && !Constants.CLF.equals(md.getBillItemCode()) && !Constants.ZLF.equals(md.getBillItemCode())){
+                        md.setYjName(md.getTcName());
+                        MzYjReq mzYjReq = mzYjReqService.queryMzYjReqByReqNo(Convert.toStr(md.getReqNo()));
+                        if(mzYjReq != null){
+                            md.setYjName(mzYjReq.getOrderName());
+                        }
+                    }
                     if (mzBillItemMap != null) {
                         md.setBillItemCode(mzBillItemMap.get(md.getBillItemCode()));
                     }
@@ -651,6 +679,15 @@ public class MzChargeDetailController {
             User tokenUser = (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
             List<MzChargeDetail> mzChargeDetails = mzChargeDetailService.getNewListForRefundFee(tokenUser.getUserIdCode(), mzDepositFileVo, YesNoEnum.NO);
             PageViewVo pageViewVo = new PageViewVo();
+            Boolean mipOrderFlag = haiCiAdapterService.isMipOrder(Tools.getHisOrdNum(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo()));
+            if(mzChargeDetails != null && mzChargeDetails.size() > 0 ){
+                if(mipOrderFlag){
+                    throw new MzException("医保移动支付退款,只能全部退款,不能部分退费");
+                }
+                if(Convert.toBigDecimal(oriMzChargeDetail.getNotDiscountAmount(),BigDecimal.ZERO).subtract(Convert.toBigDecimal(oriMzChargeDetail.getAmount(),BigDecimal.ZERO)).compareTo(new BigDecimal("0.01")) > 0){
+                    throw new MzException("优惠打折项目,只能全部退款,不能部分退费");
+                }
+            }
             if (mzChargeDetails == null || mzChargeDetails.size() == 0) {
                 MzChargeDetail returnMzChargeDetail = new MzChargeDetail();
                 returnMzChargeDetail.setPatientId(mzDepositFileVo.getPatientId());
@@ -664,6 +701,7 @@ public class MzChargeDetailController {
                     BigDecimal acctPay = ybAmountMap.get("acct_pay");
                     refundFee = (refundFee == null ? BigDecimal.ZERO : refundFee).subtract(fundPaySumamt == null ? BigDecimal.ZERO : fundPaySumamt).subtract(acctPay == null ? BigDecimal.ZERO : acctPay);
                 }
+                returnMzChargeDetail.setMipOrderFlag(mipOrderFlag ? 1 : 0);
                 returnMzChargeDetail.setRefundFee(refundFee);
                 pageViewVo.setTotal(0);
                 pageViewVo.setData(Arrays.asList(returnMzChargeDetail));
@@ -678,10 +716,13 @@ public class MzChargeDetailController {
             returnMzChargeDetail.setRefundFee(oriAmount.subtract(returnMzChargeDetail.getAmount()).setScale(2, BigDecimal.ROUND_HALF_UP));
             List<MzChargeDetail> realMzChargeDetails = Arrays.asList(returnMzChargeDetail);
             pageViewVo.setTotal(realMzChargeDetails.size());
-            mzChargeDetailService.formatMzChargeDetail(realMzChargeDetails);
+            mzChargeDetailService.formatMzChargeDetail(realMzChargeDetails,true);
             int ybCount = mzPatientMiService.queryCountYbZf(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
             if(CollUtil.isNotEmpty(realMzChargeDetails)){
-                realMzChargeDetails.forEach(item->item.setYbZfFlag(ybCount > 0 ? "1" : "0"));
+                realMzChargeDetails.forEach(item->{
+                    item.setMipOrderFlag(mipOrderFlag ? 1 : 0);
+                    item.setYbZfFlag(ybCount > 0 ? "1" : "0");
+                });
             }
             pageViewVo.setData(realMzChargeDetails);
             resultMap.put("code", 0);
@@ -860,8 +901,21 @@ public class MzChargeDetailController {
                 return resultMap;
             }
             Map<String, Object> map ;
-
-            if(StrUtil.isBlank(mzDepositFileVo.getReadCardResult())){
+            Boolean mipOrder = haiCiAdapterService.isMipOrder(Tools.getHisOrdNum(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo()));
+            if(mipOrder){
+                if(!"01".equals(mzDepositFileVo.getReadCardType())){
+                    throw new MzException("该订单是移动医保支付,请读取电子凭证!");
+                }
+                if(StrUtil.isBlank(mzDepositFileVo.getReadCardResult())){
+                    throw new MzException("该订单是移动医保支付,读取电子凭证内容不能为空!");
+                }
+                mzDepositFileVo.setRefundType(1);
+                mzDepositFileVo.setEcToken(Tools.getEcToken(mzDepositFileVo.getReadCardResult()));
+                log.info("ecToken={}",mzDepositFileVo.getEcToken());
+                mzDepositFileVo.setMipOrdeFlag(YesNoEnum.YES.code);
+                map = mzChargeDetailService.refundFee(tokenUser.getUserIdCode(), mzDepositFileVo, ipAddress);
+            }
+            else if(StrUtil.isBlank(mzDepositFileVo.getReadCardResult())){
                 map = mzChargeDetailService.refundFee(tokenUser.getUserIdCode(), mzDepositFileVo, ipAddress);
             }
             else {
@@ -906,10 +960,10 @@ public class MzChargeDetailController {
                     }
                 }
             }
+            resultMap.put("mipOrdeFlag", mzDepositFileVo.getMipOrdeFlag());
             resultMap.put("refundMzDepositFiles", refundMzDepositFiles);
             resultMap.put("patientId", mzDepositFileVo.getPatientId());
             resultMap.put("message", "退费操作成功");
-
             List<MzDepositFile> needRefundList = (List<MzDepositFile>) map.get("needRefundList");
             if (YesNoEnum.YES.code.equals(mzDepositFileVo.getRefundType()) && needRefundList != null && needRefundList.size() > 0 && StringUtils.isNotBlank(windowsDb.getMisPosRouterCode())) {
                 for (MzDepositFile mzDepositFile : needRefundList) {
@@ -1544,7 +1598,7 @@ public class MzChargeDetailController {
                 }
                 DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
                 User tokenUser = (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
-                PayInfo payInfo = tsmzService.calculateCost(tokenUser.getUserIdCode(), mzChargeDetailYb.getPatientId(), mzChargeDetailYb.getTimes(), mzChargeDetailYb.getReceiptNo(),mzChargeDetailYb.getAcctUsedFlag());
+                PayInfo payInfo = tsmzService.calculateCost(tokenUser.getUserIdCode(), mzChargeDetailYb.getPatientId(), mzChargeDetailYb.getTimes(), mzChargeDetailYb.getReceiptNo(),null);
                 if (payInfo == null) {
                     resultMap.put("code", -1);
                     resultMap.put("message", "获取门诊统筹/特门费用失败");
@@ -1857,6 +1911,28 @@ public class MzChargeDetailController {
                 return resultMap;
             }
             clinic = commonResult.getClinic();
+            if (mzPrescriptionVo.getMzBlRecord() != null && (StrUtil.isBlank(mzPrescriptionVo.getMzBlRecord().getEmrJkjy()) || mzPrescriptionVo.getMzBlRecord().getEmrJkjy().length() < 10)) {
+                throw new MzException("健康教育为必填且不能少于10个字符!");
+            }
+            //一般项目体重,体温等是否必填 0 否 1是
+            String dictVlaue = dictDataService.queryDictVlaue("3.3", "ybxm_flag", "0");
+            if(NumberEnum.ONE.getCode().equals(dictVlaue)){
+                if(mzPrescriptionVo.getMzBlRecord() != null && mzPrescriptionVo.getMzBlRecord().getWeight() == null){
+                    throw new MzException("体重不能为空!");
+                }
+                if(mzPrescriptionVo.getMzBlRecord() != null && mzPrescriptionVo.getMzBlRecord().getTemperature() == null){
+                    throw new MzException("体温不能为空!");
+                }
+                if(mzPrescriptionVo.getMzBlRecord() != null && mzPrescriptionVo.getMzBlRecord().getSphygmus() == null){
+                    throw new MzException("脉搏不能为空!");
+                }
+                if(mzPrescriptionVo.getMzBlRecord() != null && mzPrescriptionVo.getMzBlRecord().getBreathe() == null){
+                    throw new MzException("呼吸不能为空!");
+                }
+                if(mzPrescriptionVo.getMzBlRecord() != null && (mzPrescriptionVo.getMzBlRecord().getPressureHigh() == null || mzPrescriptionVo.getMzBlRecord().getPressureFloor() == null)){
+                    throw new MzException("血压不能为空!");
+                }
+            }
             Clinic insertClinic = mzChargeDetailService.savePrescriptionAndCharge(mzPrescriptionVo, clinic);
             if (insertClinic != null && insertClinic.getId() != null) {
                 resultMap.put("code", 0);
@@ -1885,10 +1961,19 @@ public class MzChargeDetailController {
     }
 
     void rollBackSaveClinc(Clinic clinic) {
-        if (clinic != null) {
-            Clinic dbClinic = clinicService.queryById(clinic.getId());
-            if (dbClinic == null) {
-                clinicService.saveClinicWithId(clinic);
+        if (clinic != null ) {
+            if(StrUtil.isNotBlank(clinic.getPatientId()) && clinic.getTimes() != null){
+                MzVisitTable mzVisitTable = mzVisitTableService.queryByPatientIdAndTimes(clinic.getPatientId(), clinic.getTimes());
+                if(mzVisitTable == null ){
+                    if(clinic.getId() != null){
+                        clinicService.delClinicById(clinic.getId());
+                    }
+                }
+                else {
+                    if(clinic.getId() == null){
+                        clinicService.saveClinic(clinic);
+                    }
+                }
             }
         }
     }
@@ -1916,8 +2001,46 @@ public class MzChargeDetailController {
                 mzPrescriptionVo.setDoctorCode(Constants.BRZZJF_CODE);
             }
             Tools.setReqNo(mzPrescriptionVo.getMzYjReqList());
+            Map<String, Object> tempPrescription = mzChargeDetailService.getAmountForTempPrescription(mzPrescriptionVo);
+            List<String> chargeItemCodes = new ArrayList<>();
+            discountService.getChargeItemCodes(chargeItemCodes,mzPrescriptionVo);
+            List<Discount> discounts = discountService.containsTcItem(chargeItemCodes);
+            BigDecimal discountAmount = Convert.toBigDecimal(tempPrescription.get("discountAmount"), BigDecimal.ZERO);
+            if(CollUtil.isNotEmpty(discounts) && discountAmount.compareTo(new BigDecimal("1")) <= 0){
+                //优惠警告信息
+                List<String> discountWarningMessageList = new ArrayList<>();
+                for(Discount discount: discounts){
+                    if(StrUtil.isNotBlank(discount.getDeptNo())){
+                        List<String> deptList = CollUtil.newArrayList(discount.getDeptNo().split(","));
+                        List<String> deptNameList = new ArrayList<>();
+                        for (String dept :deptList){
+                            ZdUnitCode zdUnitCode = zdUnitCodeService.queryByCode(dept);
+                            if(zdUnitCode != null){
+                                deptNameList.add(zdUnitCode.getName());
+                            }
+                        }
+                        String msg = "";
+                        if(!deptList.contains(mzPrescriptionVo.getVisitDeptCode())){
+                            msg += "该处方包含优惠套餐("+discount.getName()+"),但是申请科室不符(该优惠套餐只有科室["+CollUtil.join(deptNameList,",")+"]享受折扣优惠,请检查是否申请科室是否正确),如果不要套餐优惠折扣请忽略;";
+                        }
+                        if(Convert.toInt(mzPrescriptionVo.getZgmztczf(),0) == 1){
+                            msg += "该处方包含优惠套餐("+discount.getName()+"),已选择门诊统筹处方不享受折扣优惠,如要优惠折扣,门诊统筹请选否,如果不要套餐优惠折扣请忽略";
+                        }
+                        if(StrUtil.isNotBlank(msg)){
+                            discountWarningMessageList.add(msg);
+                        }
+                    }
+                }
+                if(CollUtil.isNotEmpty(discountWarningMessageList)){
+                    resultMap.put("discountWarningMessage",CollUtil.join(discountWarningMessageList,";"));
+                }
+            }
+            String ypHealthEducation = mzChargeDetailService.getYpHealthEducation(mzPrescriptionVo.getMzChargeDetailList());
+            if(StrUtil.isNotBlank(ypHealthEducation)){
+                resultMap.put("ypHealthEducation", ypHealthEducation);
+            }
             resultMap.put("code", 0);
-            resultMap.put("data", mzChargeDetailService.getAmountForTempPrescription(mzPrescriptionVo));
+            resultMap.put("data",tempPrescription);
             resultMap.put("message", "计算临时处方的中药,西药,诊疗以及总金额成功");
             return resultMap;
         } catch (MzException e) {
@@ -1974,6 +2097,7 @@ public class MzChargeDetailController {
             }
             resultMap.put("yjReqCount", jcJyItemChargeService.queryCountByPatientId(patientId));
             resultMap.put("mzPatientMi", mzPatientMi);
+            resultMap.put("ypCfPrint", dictDataService.queryDictValueByYpCfPrint());
             resultMap.put("message", "获取病人某次处方信息成功");
             return resultMap;
         } catch (MzException e) {
@@ -2047,14 +2171,19 @@ public class MzChargeDetailController {
             results = getChargeDetailFee(patientId, times, 1, null, httpServletRequest);
             BigDecimal selfAmount = (BigDecimal) results.get("totalAmount");
             if (selfAmount != null) {
+                String wxPayUrl = wxPayQrUrl.replace("patientId", patientId);
                 String payQrcode = haiCiAdapterService.genMzPayQrcode(selfAmount.multiply(BigDecimal.valueOf(100)).intValue(), patientId, patientId + "_" + times + "_1");
                 if (payQrcode != null) {
                     results.put("payQrcode", payQrcode);
                 }
                 results.put("healthEducationUrl", healthEducationUrl);
-                String wxPayUrl = wxPayQrUrl.replace("patientId", patientId);
                 results.put("wxPayQrUrl", wxPayUrl);
             }
+            if(Convert.toInt(results.get("code")) == 0){
+                // 获取指引单项目指引数据
+                List<Map<String,Object>> guideCardData = mzChargeDetailService.getChargeDetailForGuideCard(patientId,times);
+                results.put("guideCardData", guideCardData);
+            }
             return results;
         } catch (Exception e) {
             if (results == null) {
@@ -2136,21 +2265,21 @@ public class MzChargeDetailController {
                 List<String> selfPayList = new ArrayList<>();
                 results.put("selfPayList", selfPayList);
                 results.put("zfcns_time", DateUtil.fomart(new Date(),"yyyy-MM-dd HH:mm:ss"));
-                StringBuilder stringBuilder = new StringBuilder();
+                //StringBuilder stringBuilder = new StringBuilder();
 //                int patientDuringSiSettle = tsmzService.isPatientDuringSiSettle(mzChargeDetail.getPatientId());
 //                while (patientDuringSiSettle != 0) {
 //                    Thread.sleep(1000);
 //                    patientDuringSiSettle = tsmzService.isPatientDuringSiSettle(mzChargeDetail.getPatientId());
 //                }
-                Clinic clinic = clinicService.queryByPatientIdAndTimesAndReceiptNo(patientId, times, 0);
-                Integer countYbZf = (clinic == null || clinic.getZgmztczf() == null) ? YesNoEnum.NO.code : clinic.getZgmztczf();
-                if (YesNoEnum.YES.code.equals(countYbZf)) {
-                    MzVisitTable mzVisitTable = mzVisitTableService.queryByPatientIdAndTimes(patientId, times);
-                    if (mzVisitTable == null) {
-                        throw new MzException("病人就诊记录不存在!");
-                    }
-                    results.put("icdText", mzVisitTable.getIcdTextNew());
-                }
+//                Clinic clinic = clinicService.queryByPatientIdAndTimesAndReceiptNo(patientId, times, 0);
+//                Integer countYbZf = (clinic == null || clinic.getZgmztczf() == null) ? YesNoEnum.NO.code : clinic.getZgmztczf();
+//                if (YesNoEnum.YES.code.equals(countYbZf)) {
+//                    MzVisitTable mzVisitTable = mzVisitTableService.queryByPatientIdAndTimes(patientId, times);
+//                    if (mzVisitTable == null) {
+//                        throw new MzException("病人就诊记录不存在!");
+//                    }
+//                    results.put("icdText", mzVisitTable.getIcdTextNew());
+//                }
                 for (MzChargeDetail mz : mzChargeDetailList) {
                     if (Arrays.asList(Constants.TC, Constants.SSWRF).contains(mz.getBillItemCode())) {
                         continue;
@@ -2185,21 +2314,23 @@ public class MzChargeDetailController {
                     BigDecimal tempAmount = unitPrice.multiply(quantity).multiply(drugWin);
                     totalAmount = totalAmount.add(tempAmount);
                     map.put("itemTotalFee", amount.add(tempAmount));
-                    if (setPaySelfListForUnpaid(results, selfPayList, stringBuilder, countYbZf, mz)) {
-                        return results;
-                    }
+                    //if (setPaySelfListForUnpaid(results, selfPayList, stringBuilder, countYbZf, mz)) {
+                    //    return results;
+                    //}
                 }
                 totalAmount = totalAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
                 BigDecimal selfAmount = totalAmount;
-                User tokenUser = TokenUtil.getUser(httpServletRequest);
-                PayInfo payInfo = tsmzService.preSettle(tokenUser.getUserIdCode(), patientId, times);
-                if (payInfo != null && payInfo.getCode() == 0) {
-                    //个人医保账户支付
-                    results.put("acctPay", payInfo.getAcctPay());
-                    //医保统筹报销
-                    results.put("fundPay", payInfo.getFundPay());
-                    selfAmount = totalAmount.subtract(payInfo.getAcctPay()).subtract(payInfo.getFundPay());
-                }
+                //User tokenUser = TokenUtil.getUser(httpServletRequest);
+                //PayInfo payInfo = tsmzService.preSettle(tokenUser.getUserIdCode(), patientId, times);
+                //if (payInfo != null && payInfo.getCode() == 0) {
+                //    //个人医保账户支付
+                //    results.put("acctPay", payInfo.getAcctPay());
+                //    //医保统筹报销
+                //    results.put("fundPay", payInfo.getFundPay());
+                //    selfAmount = totalAmount.subtract(payInfo.getAcctPay()).subtract(payInfo.getFundPay());
+                //}
+                results.put("acctPay", 0);
+                results.put("fundPay", 0);
                 results.put("code", 0);
                 results.put("message", "查询门诊订单金额与支付明细成功");
                 results.put("totalAmount", totalAmount);
@@ -2964,11 +3095,17 @@ public class MzChargeDetailController {
     public R queryPrescriptionModifyPermission(@RequestBody Map<String,Object> query){
         String patientId = Convert.toStr(query.get("patientId"));
         Integer times = Convert.toInt(query.get("times"));
-        //修改处方时撤销医保费用
-        tsmzService.retractFees(TokenUtil.getUser().getUserCode(),patientId, times , 1);
-        boolean flag =tsmzService.queryModifyPermission(patientId,times,TokenUtil.getUser().getUserCode());
+        MzOrderLock mzOrderLock = mzOrderLockMapper.selectById(Tools.getHisOrdNum(patientId,times,1));
+        if(mzOrderLock != null && Convert.toInt(mzOrderLock.getLockFlag(),0) == 1){
+            return R.error("处方在缴费中,不能修改处方");
+        }
+        Integer countYbJs = mzPatientMiService.countYbJs(patientId, times);
+        if(Convert.toInt(countYbJs,0) > 0) {
+            return R.error("处方已经结算,不能修改处方,如要修改请找医保科取消医保结算再修改");
+        }
+        boolean flag = wpMzPrescriptionService.isUpdateOrDelete(patientId, times);
         if(!flag){
-            return R.error("不可以修改处方");
+            return R.error("该外配药处方已经上传医保,不能修改处方!");
         }
         return R.ok();
     }
@@ -2996,12 +3133,11 @@ public class MzChargeDetailController {
         String patientId = Convert.toStr(query.get("patientId"));
         Integer times = Convert.toInt(query.get("times"));
         String admdvs = Convert.toStr(query.get("admdvs"));
-        String socialNo = Convert.toStr(query.get("socialNo"));
         AssertUtil.isNotBlank(patientId,"门诊号不能为空");
         AssertUtil.isNotBlank(times,"就诊次数不能为空");
         AssertUtil.isNotBlank(admdvs,"参保地不能为空");
-        AssertUtil.isNotBlank(socialNo,"身份证号码不能为空");
-       Map<String,Object> res = tsmzService.queryNewInsuinfo(TokenUtil.getUser().getUserIdCode(), patientId, times,admdvs,socialNo);
+        MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
+        Map<String,Object> res = tsmzService.queryNewInsuinfo(TokenUtil.getUser().getUserIdCode(), patientId, times,admdvs,mzPatientMi.getSocialNo());
         return res;
     }
 

+ 40 - 5
src/main/java/cn/hnthyy/thmz/controller/mz/MzPatientMiController.java

@@ -17,11 +17,13 @@ import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.service.his.ResponceTypeService;
 import cn.hnthyy.thmz.service.his.mz.MzPatientMiService;
 import cn.hnthyy.thmz.service.his.mz.MzSerialNoService;
+import cn.hnthyy.thmz.service.his.mz.MzVisitTableService;
 import cn.hnthyy.thmz.service.his.mz.ShareholderCardService;
 import cn.hnthyy.thmz.service.his.zy.APatientMiService;
 import cn.hnthyy.thmz.service.his.zy.ZyActpatientService;
 import cn.hnthyy.thmz.service.thmz.HybirdTestService;
 import cn.hnthyy.thmz.service.thmz.TsmzService;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.IdcardUtil;
@@ -53,6 +55,8 @@ public class MzPatientMiController {
     private MzSerialNoService mzSerialNoService;
     @Resource
     private ShareholderCardService shareholderCardService;
+    @Resource
+    private MzVisitTableService mzVisitTableService;
 
     /**
      * 根据病人就诊卡号查询病人信息
@@ -215,10 +219,14 @@ public class MzPatientMiController {
                 return resultMap;
             }
             List<MzPatientMi> mzPatientMis = mzPatientMiService.queryBySocialNo(socialNo, null);
-//            MzPatientMi mzPatientMi = null;
-//            if(mzPatientMis!=null && mzPatientMis.size()>0){
-//                mzPatientMi=mzPatientMis.get(0);
-//            }
+            if(CollUtil.isNotEmpty(mzPatientMis)){
+                for(MzPatientMi mp : mzPatientMis){
+                  Date maxDate = mzVisitTableService.queryLastVisitDate(mp.getPatientId());
+                  if(maxDate != null){
+                      mp.setLastVisitDate(DateUtil.fomart(maxDate,"yyyy-MM-dd HH:mm:ss"));
+                  }
+                }
+            }
             resultMap.put("code", 0);
             resultMap.put("message", "根据病人身份证号码查询病人信息成功");
             resultMap.put("data", mzPatientMis);
@@ -236,7 +244,16 @@ public class MzPatientMiController {
     public R queryMzPatientInfoBykeyWard(@RequestBody Map<String,Object> query){
         String keyWard = Convert.toStr(query.get("keyWard"));
         if(StrUtil.isBlank(keyWard)) return R.ok().put("data", null);
-        return R.ok().put("data",mzPatientMiService.queryMzPatientInfoBykeyWard(keyWard));
+        List<MzPatientMi> mzPatientMis = mzPatientMiService.queryMzPatientInfoBykeyWard(keyWard);
+        if(CollUtil.isNotEmpty(mzPatientMis)){
+            for(MzPatientMi item :mzPatientMis){
+                Date date = mzVisitTableService.queryLastVisitDate(item.getPatientId());
+                if(date != null){
+                    item.setLastVisitDate(DateUtil.fomart(date,"yyyy-MM-dd HH:mm:ss"));
+                }
+            }
+        }
+        return R.ok().put("data",mzPatientMis);
     }
 
 
@@ -847,6 +864,24 @@ public class MzPatientMiController {
         return R.ok();
     }
 
+    @PostMapping("/updateDiscountLv")
+    public R updateDiscountLv(@RequestBody Map<String,Object> params){
+        String patientId = Convert.toStr(params.get("patientId"));
+        String discountLv = Convert.toStr(params.get("discountLv"));
+        AssertUtil.isNotBlank(patientId,"门诊号不能为空");
+        AssertUtil.isNotBlank(discountLv,"优惠优先级不能为空");
+        shareholderCardService.updateDiscountLvByPatientId(patientId, discountLv);
+        return R.ok();
+    }
+    @PostMapping("/queryDiscountLv")
+    public R queryDiscountLv(@RequestBody Map<String,Object> params){
+        String patientId = Convert.toStr(params.get("patientId"));
+        AssertUtil.isNotBlank(patientId,"门诊号不能为空");
+        String data = shareholderCardService.queryDiscountLvByPatientId(patientId);
+        return R.ok().put("data",Convert.toStr(data,"0"));
+    }
+
+
     //@GetMapping("/insertNewGdkPatientInfo")
     //public R insertNewGdkPatientInfo(){
     //    shareholderCardService.insertNewGdkPatientInfo();

+ 177 - 24
src/main/java/cn/hnthyy/thmz/controller/mz/MzPharmacyController.java

@@ -4,38 +4,72 @@ import cn.hnthyy.thmz.Utils.DateUtil;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.MzException;
-import cn.hnthyy.thmz.entity.his.mz.*;
+import cn.hnthyy.thmz.entity.his.mz.Employee;
+import cn.hnthyy.thmz.entity.his.mz.MzBlRecord;
+import cn.hnthyy.thmz.entity.his.mz.MzChargeDetail;
+import cn.hnthyy.thmz.entity.his.mz.MzDrugTracCodg;
+import cn.hnthyy.thmz.entity.his.mz.MzOrderFrequency;
+import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
+import cn.hnthyy.thmz.entity.his.mz.MzVisitTable;
+import cn.hnthyy.thmz.entity.his.mz.MzZdSupplyType;
+import cn.hnthyy.thmz.entity.his.mz.PatientAllergenInfo;
 import cn.hnthyy.thmz.entity.his.yp.YpBaseYf;
 import cn.hnthyy.thmz.entity.his.yp.YpPdQueue;
 import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
+import cn.hnthyy.thmz.entity.his.zd.MzZdInstructionCode;
 import cn.hnthyy.thmz.entity.his.zd.ZdCommon;
 import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode;
 import cn.hnthyy.thmz.entity.thmz.RadSendRecord;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.ConfirmFlagEnum;
 import cn.hnthyy.thmz.enums.SocketSenderTypeEnum;
-import cn.hnthyy.thmz.mapper.his.zd.ZdAllergenMapper;
-import cn.hnthyy.thmz.service.his.mz.*;
+import cn.hnthyy.thmz.service.his.mz.EmployeeService;
+import cn.hnthyy.thmz.service.his.mz.MzBlRecordService;
+import cn.hnthyy.thmz.service.his.mz.MzChargeDetailService;
+import cn.hnthyy.thmz.service.his.mz.MzDrugTracCodgService;
+import cn.hnthyy.thmz.service.his.mz.MzOrderFrequencyService;
+import cn.hnthyy.thmz.service.his.mz.MzPatientMiService;
+import cn.hnthyy.thmz.service.his.mz.MzPharmacyService;
+import cn.hnthyy.thmz.service.his.mz.MzVisitTableService;
+import cn.hnthyy.thmz.service.his.mz.MzZdSupplyTypeService;
+import cn.hnthyy.thmz.service.his.mz.PatientAllergenInfoService;
 import cn.hnthyy.thmz.service.his.yp.YpBaseYfService;
 import cn.hnthyy.thmz.service.his.yp.YpPdQueueService;
 import cn.hnthyy.thmz.service.his.yp.YpZdDictService;
 import cn.hnthyy.thmz.service.his.yp.YpZdManufactoryService;
 import cn.hnthyy.thmz.service.his.zd.MzYshZdFysmService;
+import cn.hnthyy.thmz.service.his.zd.MzZdInstructionCodeService;
 import cn.hnthyy.thmz.service.his.zd.ZdAllergenService;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import cn.hnthyy.thmz.service.thmz.DispensingSocketService;
 import cn.hnthyy.thmz.service.thmz.DispensingWindowsService;
-import cn.hnthyy.thmz.vo.*;
+import cn.hnthyy.thmz.vo.ChargeDetailInfoVo;
+import cn.hnthyy.thmz.vo.ChargeDetailPharmacyVo;
+import cn.hnthyy.thmz.vo.ChargeFeeParamsVo;
+import cn.hnthyy.thmz.vo.MzRefundMedicineVo;
+import cn.hnthyy.thmz.vo.MzSendMedicineVo;
+import cn.hnthyy.thmz.vo.PharmacyCellVo;
+import cn.hnthyy.thmz.vo.YpMzFytjVo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateUtils;
 import org.json.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -73,8 +107,6 @@ public class MzPharmacyController {
     private MzBlRecordService mzBlRecordService;
     @Autowired
     private MzYshZdFysmService mzYshZdFysmService;
-    @Autowired
-    private MzDrugWinService mzDrugWinService;
 
     @Autowired
     private YpPdQueueService ypPdQueueService;
@@ -82,6 +114,10 @@ public class MzPharmacyController {
     private PatientAllergenInfoService patientAllergenInfoService;
     @Autowired
     private ZdAllergenService zdAllergenService;
+    @Autowired
+    private MzDrugTracCodgService mzDrugTracCodgService;
+    @Autowired
+    private MzZdInstructionCodeService mzZdInstructionCodeService;
     /**
      * 查询处方信息
      *
@@ -235,6 +271,7 @@ public class MzPharmacyController {
                     if (stringObjectMap.get("charge_item_code").equals(objectMap.get("charge_item_code"))
                             && stringObjectMap.get("item_no").equals(objectMap.get("item_no"))) {
                         objectMap.put("dec_amount", stringObjectMap.get("quantity"));
+                        objectMap.put("refund_medicine_remark", stringObjectMap.get("refund_medicine_remark"));
                     }
                 }
             }
@@ -266,10 +303,14 @@ public class MzPharmacyController {
                 return resultMap;
             }
             resultMap = mzPharmacyService.refundMedicineProcessing(mzRefundMedicineVos, tokenUser.getUserIdCode());
+
+            //将药品追溯码数据转移到退药表
+            mzDrugTracCodgService.changeDrugCodgDataToTy(mzRefundMedicineVos);
+
             return resultMap;
         } catch (Exception e) {
             e.printStackTrace();
-            log.error("退药处理失败,错误信息{}", e);
+            log.error("退药处理失败,错误信息{}", e.getMessage());
             resultMap.put("code", -1);
             resultMap.put("message", "退药处理失败");
             return resultMap;
@@ -284,7 +325,8 @@ public class MzPharmacyController {
     @UserLoginToken
     @RequestMapping(value = "/cancelRefundMedicineProcessing", method = {RequestMethod.GET})
     public Map<String, Object> cancelRefundMedicineProcessing(@RequestParam("realNo") Integer realNo, @RequestParam("groupNo") String groupNo
-            , @RequestParam("receiptNo") Integer receiptNo , @RequestParam("orderNo") Integer orderNo, HttpServletRequest httpServletRequest) throws MzException {
+            , @RequestParam("receiptNo") Integer receiptNo, @RequestParam("orderNo") Integer orderNo, @RequestParam("patientId") String patientId,
+            @RequestParam("times") Integer times,HttpServletRequest httpServletRequest) throws MzException {
         User tokenUser = TokenUtil.getUser(httpServletRequest);
         Map<String, Object> resultMap = new HashMap<>();
         try {
@@ -306,6 +348,18 @@ public class MzPharmacyController {
                 resultMap.put("code", 0);
                 resultMap.put("message", "撤销退药记录状态成功");
             }
+
+            //将药品追溯码退药表数据转移到正式表中
+            MzDrugTracCodg codg = new MzDrugTracCodg();
+            codg.setPatientId(patientId);
+            codg.setTimes(times);
+            //退费处方需要将发票号转正
+            codg.setReceiptNo(Math.abs(receiptNo));
+            codg.setRealNo(realNo);
+            codg.setOrderNo(orderNo);
+            codg.setGroupNo(groupNo);
+            mzDrugTracCodgService.changeDrugCodgDataFormTy(codg);
+
             return resultMap;
         } catch (Exception e) {
             e.printStackTrace();
@@ -566,7 +620,11 @@ public class MzPharmacyController {
             mzPharmacyService.updateMzDrugWinPatientNum(mzChargeDetail, 1);
 
             // 删除当天排队人信息
-            ypPdQueueService.deleteYpPdStatus(mzChargeDetail.getPatientId());
+            // 查看这次处方是否已经全部发药完成
+            List<MzChargeDetail> fy = mzPharmacyService.getMzCfWfy(mzChargeDetail);
+            if(null == fy || fy.isEmpty()){
+                ypPdQueueService.deleteYpPdStatus(mzChargeDetail.getPatientId());
+            }
 
             return resultMap;
         } catch (Exception e) {
@@ -615,35 +673,48 @@ public class MzPharmacyController {
 
     /**
      * 配药处理
-     *
-     * @param mzChargeDetail
-     * @return
+     * @param list
+     * @return map
      */
     @UserLoginToken
     @RequestMapping(value = "/dispensingMedicineProcessing", method = {RequestMethod.POST})
-    public Map<String, Object> dispensingMedicineProcessing(@RequestBody MzChargeDetail mzChargeDetail) {
+    public Map<String, Object> dispensingMedicineProcessing(@RequestBody List<MzDrugTracCodg> list, HttpServletRequest httpServletRequest) throws MzException {
+        User tokenUser = TokenUtil.getUser(httpServletRequest);
         Map<String, Object> resultMap = new HashMap<>();
         try {
-            if (mzChargeDetail == null) {
+            if (null == list) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "配药处理失败,参数为空");
                 return resultMap;
             }
-            if (StringUtils.isBlank(mzChargeDetail.getPatientId())) {
+            if (list.isEmpty()) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "配药失败,参数为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(list.get(0).getPatientId())) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "配药处理失败,病人ID为空");
                 return resultMap;
             }
-            if (mzChargeDetail.getOrderNo() == null) {
+            if (list.get(0).getOrderNo() == null) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "配药处理失败,处方号为空");
                 return resultMap;
             }
-            if (mzChargeDetail.getTimes() == null) {
+            if (list.get(0).getTimes() == null) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "配药处理失败,次数为空");
                 return resultMap;
             }
+
+            //保存药品追溯码
+            mzDrugTracCodgService.saveMzDrugTracCodgData(list, tokenUser);
+
+            MzChargeDetail mzChargeDetail = new MzChargeDetail();
+            mzChargeDetail.setPatientId(list.get(0).getPatientId());
+            mzChargeDetail.setTimes(list.get(0).getTimes());
+            mzChargeDetail.setOrderNo(list.get(0).getOrderNo());
             int num = mzPharmacyService.dispensingMedicineProcessing(mzChargeDetail);
             if (num > 0) {
                 resultMap.put("code", 0);
@@ -651,12 +722,74 @@ public class MzPharmacyController {
                 dispensingSocketService.sendToMedicineAndSendMedicine(mzChargeDetail.getPatientId(),SocketSenderTypeEnum.DISPENSING_MEDICINE.code);
                 return resultMap;
             }
+
             resultMap.put("code", -1);
-            resultMap.put("message", "没有需要配药处理的处方,请检查!");
+            resultMap.put("message", "配药处理失败,请检查!");
             return resultMap;
         } catch (Exception e) {
-            e.printStackTrace();
-            log.error("配药处理失败,错误信息{}", e);
+            log.error("配药处理失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "配药处理失败");
+            return resultMap;
+        }
+    }
+
+    /**
+     * @Description 查看配药信息
+     * @Author hsh
+     * @param mzDrugTracCodg
+     * @return map
+     * @Date 2024/10/22 15:33
+     */
+    @RequestMapping(value = "/getMzDrugTracCodgData", method = {RequestMethod.POST})
+    public Map<String, Object> getMzDrugTracCodgData(@RequestBody MzDrugTracCodg mzDrugTracCodg) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (null == mzDrugTracCodg) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "配药处理失败,参数为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(mzDrugTracCodg.getPatientId())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "配药处理失败,病人ID为空");
+                return resultMap;
+            }
+            if (mzDrugTracCodg.getOrderNo() == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "配药处理失败,处方号为空");
+                return resultMap;
+            }
+            if (mzDrugTracCodg.getTimes() == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "配药处理失败,次数为空");
+                return resultMap;
+            }
+            //防止退药处方,需将发票号转为正数
+            mzDrugTracCodg.setReceiptNo(Math.abs(mzDrugTracCodg.getReceiptNo()));
+            List<MzDrugTracCodg> list = mzDrugTracCodgService.getMzDrugTracCodgData(mzDrugTracCodg);
+            List<MzSendMedicineVo> mzChargeDetailVo = mzDrugTracCodgService.getMzChargeDetailByCode(mzDrugTracCodg);
+            if (!list.isEmpty()) {
+                MzVisitTable visit = mzVisitTableService.queryByPatientIdAndTimes(mzDrugTracCodg.getPatientId(), mzDrugTracCodg.getTimes());
+                String icdText = StringUtils.isBlank(visit.getIcdText()) ? "" : visit.getIcdText();
+                MzBlRecord mzBlRecord = mzBlRecordService.queryMzBlRecordByPatientIdAndTimes(mzDrugTracCodg.getPatientId(), mzDrugTracCodg.getTimes());
+                if (null != mzBlRecord && StringUtils.isNotBlank(mzBlRecord.getTentativeDiagnosis())) {
+                    icdText += (StringUtils.isBlank(icdText) ? "" : ",") + mzBlRecord.getTentativeDiagnosis();
+                }
+                list.get(0).setIcdText(icdText);
+                list.get(0).setChargeDate(mzChargeDetailVo.get(0).getChargeDate());
+                String warnDeptName = zdUnitCodeService.queryDeptNameByIdInCache(mzChargeDetailVo.get(0).getWarnDept());
+                list.get(0).setWarnDeptName(warnDeptName);
+                Employee employee = employeeService.queryByUserCode(mzChargeDetailVo.get(0).getDoctorCode());
+                list.get(0).setEmployeeName(employee.getEmployeeName());
+                list.get(0).setName(StringUtils.trim(mzChargeDetailVo.get(0).getName()));
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "查询发药处理的处方详细信息成功");
+            resultMap.put("data", list);
+            return resultMap;
+        } catch (Exception e) {
+            log.error("配药处理失败,错误信息{}", e.getMessage());
             resultMap.put("code", -1);
             resultMap.put("message", "配药处理失败");
             return resultMap;
@@ -751,7 +884,16 @@ public class MzPharmacyController {
                     map.put("frequencyName", chargeDetail.getFrequency());
                 }
                 map.put("jzFlag", chargeDetail.getJzFlag());//急诊标记
-                map.put("instructionText", chargeDetail.getInstructionText());//嘱托说明
+                if(StringUtils.isNotBlank(chargeDetail.getInstructionCode())){
+                    MzZdInstructionCode zt = mzZdInstructionCodeService.selectMzZdInstructionByCode(chargeDetail.getInstructionCode());
+                    if(null == zt || StringUtils.isBlank(zt.getInstructionText())){
+                        map.put("instructionText", chargeDetail.getInstructionText());//嘱托说明
+                    } else {
+                        map.put("instructionText", zt.getInstructionText());//嘱托说明
+                    }
+                } else {
+                    map.put("instructionText", chargeDetail.getInstructionText());//嘱托说明
+                }
                 map.put("tryResult", chargeDetail.getTryResult());//皮试结果
                 map.put("tryFlag", chargeDetail.getTryFlag());//是否需要皮试
                 map.put("drugWin", chargeDetail.getDrugWin());
@@ -767,6 +909,7 @@ public class MzPharmacyController {
                 map.put("specification", ypZdDict.getSpecification());//规格
                 map.put("drugFlag", ypZdDict.getDrugFlag());//毒麻标志
                 map.put("psFlag", ypZdDict.getPsFlag());//是否需要皮试
+                map.put("packRetprice", ypZdDict.getPackRetprice());//药品零售价
                 YpBaseYf ypBaseYf = ypBaseYfService.queryYpBaseYf(chargeDetail.getChargeItemCode(), chargeDetail.getSerial(), chargeDetail.getGroupNo());
                 map.put("location",ypBaseYf.getLocation()==null?"":ypBaseYf.getLocation());
                 map.put("stockAmount",ypBaseYf.getStockAmount());
@@ -883,7 +1026,16 @@ public class MzPharmacyController {
                         map.put("frequencyName", chargeDetail.getFrequency());
                     }
                     map.put("jzFlag", chargeDetail.getJzFlag());//急诊标记
-                    map.put("instructionText", chargeDetail.getInstructionText());//嘱托说明
+                    if(StringUtils.isNotBlank(chargeDetail.getInstructionCode())){
+                        MzZdInstructionCode zt = mzZdInstructionCodeService.selectMzZdInstructionByCode(chargeDetail.getInstructionCode());
+                        if(null == zt || StringUtils.isBlank(zt.getInstructionText())){
+                            map.put("instructionText", chargeDetail.getInstructionText());//嘱托说明
+                        } else {
+                            map.put("instructionText", zt.getInstructionText());//嘱托说明
+                        }
+                    } else {
+                        map.put("instructionText", chargeDetail.getInstructionText());//嘱托说明
+                    }
                     map.put("tryResult", chargeDetail.getTryResult());//皮试结果
                     map.put("tryFlag", chargeDetail.getTryFlag());//是否需要皮试
                     map.put("drugWin", chargeDetail.getDrugWin());
@@ -899,6 +1051,7 @@ public class MzPharmacyController {
                     map.put("specification", ypZdDict.getSpecification());//规格
                     map.put("drugFlag", ypZdDict.getDrugFlag());//毒麻标志
                     map.put("psFlag", ypZdDict.getPsFlag());//是否需要皮试
+                    map.put("packRetprice", ypZdDict.getPackRetprice());//药品零售价
                     YpBaseYf ypBaseYf = ypBaseYfService.queryYpBaseYf(chargeDetail.getChargeItemCode(), chargeDetail.getSerial(), chargeDetail.getGroupNo());
                     map.put("location",ypBaseYf.getLocation()==null?"":ypBaseYf.getLocation());
                     String manufactoryName = ypZdManufactoryService.queryYpZdManufactoryByCode(ypZdDict.getManuCode());

+ 32 - 18
src/main/java/cn/hnthyy/thmz/controller/mz/MzReceiptSerialController.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.controller.mz;
 
+import cn.hnthyy.thmz.Utils.AssertUtil;
 import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
@@ -175,25 +176,7 @@ public class MzReceiptSerialController {
             resultMap.put("code", 0);
             resultMap.put("message", "根据病人编号和就诊次数查询其当次缴费对应的所有发票成功");
             //将打印标志改为已经打印
-            //mzChargeDetailService.modifyPrintFlag(patientId,timesList);
             List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialService.queryAllSerialForThisTime(patientId, times, receiptNo);
-//            if(mzReceiptSerial == null){
-//                mzReceiptSerialService.repairDataFromBack(patientId, times, receiptNo);
-//                mzReceiptSerial = mzReceiptSerialService.queryAllSerialForThisTime(patientId, times, receiptNo);
-//            }
-//            if (StringUtils.isBlank(mzReceiptSerial.getChequeType())) {
-//                resultMap.put("code", -1);
-//                resultMap.put("message", "当前病人发票表中的收费类型为空,无法打印发票,请及时联系管理员");
-//                log.info("当前病人发票表中的收费类型为空,无法打印发票,请及时联系管理员,patientId={},time={},receiptNo={}", patientId, times,receiptNo);
-//                return resultMap;
-//            }
-//            if(Arrays.asList(Constants.YBJZ,Constants.BYJZ).contains(mzReceiptSerial.getChequeType())){
-//                resultMap.put("code", -1);
-//                String type = Constants.YBJZ.equals(mzReceiptSerial.getChequeType())?"本院记账":"医保记账";
-//                resultMap.put("message", type+"发票无法打印发票,请及时联系管理员");
-//                log.info(type+"发票无法打印发票,请及时联系管理员,patientId={},time={},receiptNo={},chequeType={}", patientId, times,receiptNo,mzReceiptSerial.getChequeType());
-//                return resultMap;
-//            }
             MzReceiptSerial returnMzReceiptSerial = mzReceiptSerialService.printReceiptSerial(mzReceiptSerials, tokenUser);
             List<Integer> timesList = new ArrayList<>();
             List<MzReceiptSerialVo> mzReceiptSerialVos = mzReceiptSerialService.getMzReceiptSerialVos(returnMzReceiptSerial, timesList, returnMzReceiptSerial.getReceiptBill());
@@ -222,6 +205,37 @@ public class MzReceiptSerialController {
         }
     }
 
+    @UserLoginToken
+    @PostMapping("/getNewAllSerialForThisTime")
+    public R getNewAllSerialForThisTime(@RequestBody MzReceiptSerial mzReceiptSerial){
+        AssertUtil.isNotBlank(mzReceiptSerial.getPatientId(),"门诊号不能为空");
+        AssertUtil.isNotBlank(mzReceiptSerial.getTimes(),"就诊次数不能为空");
+        AssertUtil.isNotBlank(mzReceiptSerial.getReceiptNo(),"缴费次数能为空");
+        MzDepositFile mz = new MzDepositFile(mzReceiptSerial.getPatientId(), mzReceiptSerial.getTimes());
+        mz.setReceiptNo(mzReceiptSerial.getReceiptNo());
+        List<MzDepositFile> mzDepositFiles = mzDepositFileService.queryMzDepositFile(mz);
+        //非本院记账 和非医保记账金额
+        BigDecimal totalPay = BigDecimal.ZERO;
+        //所有付款方式总金额
+        BigDecimal fullTotalPay = BigDecimal.ZERO;
+        List<ZdChequeType> chequeTypes = zdChequeTypeService.queryAllZdChequeType();
+        Map<String, Integer> printFlagMap = chequeTypes.stream().collect(Collectors.toMap(ZdChequeType::getCode, ZdChequeType::getPrintFlag));
+        if (mzDepositFiles != null && mzDepositFiles.size() > 0) {
+            for (MzDepositFile mzDepositFile : mzDepositFiles) {
+                if (Convert.toInt(printFlagMap.get(mzDepositFile.getChequeType()),0) == 1) {
+                    totalPay = totalPay.add(mzDepositFile.getAmount());
+                }
+                fullTotalPay=fullTotalPay.add(mzDepositFile.getAmount());
+            }
+        }
+        if (BigDecimal.ZERO.compareTo(totalPay) == 0) {
+            return R.error("当前病人没有实际缴费,暂时不打印发票");
+        }
+        List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialService.queryAllSerialForThisTime(mzReceiptSerial.getPatientId(), mzReceiptSerial.getTimes(), mzReceiptSerial.getReceiptNo());
+        mzReceiptSerialService.printNewReceiptSerial(mzReceiptSerials);
+        return R.ok();
+    }
+
 //    /**
 //     * 将发票列表转换成发票视图列表
 //     *

+ 1 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/MzZdYpYshController.java

@@ -58,6 +58,7 @@ public class MzZdYpYshController {
     public Map<String, Object> getYpListByCommonParams(@RequestParam("commonParams") String commonParams, @RequestParam("groupNo") String groupNo) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
+
             if (StringUtils.isBlank(groupNo)) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "药房编码不能为空");

+ 65 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/MzZlItemRefundFeeController.java

@@ -0,0 +1,65 @@
+package cn.hnthyy.thmz.controller.mz;
+
+import cn.hnthyy.thmz.Utils.R;
+import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.his.mz.MzChargeDetail;
+import cn.hnthyy.thmz.entity.his.mz.MzZlItemRefundFee;
+import cn.hnthyy.thmz.service.his.mz.MzZlItemRefundFeeService;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 门诊诊疗退费申请/取消
+ * @Author:lihong
+ * @Date: 2024/11/18
+ */
+@Slf4j
+@RestController
+public class MzZlItemRefundFeeController {
+    @Resource
+    private MzZlItemRefundFeeService service;
+
+    @UserLoginToken
+    @PostMapping("/queryZlItemRefundFeePage")
+    public R queryZlItemRefundFeePage(@RequestBody Map<String,Object> param){
+        List<MzChargeDetail> data= service.queryZlItemRefundFeePage(param);
+        return R.ok().put("data", data);
+    }
+
+
+    @UserLoginToken
+    @PostMapping("/queryRefundZlItemDetail")
+    public R queryRefundZlItemDetail(@RequestBody Map<String,Object> param){
+        List<MzZlItemRefundFee> data= service.queryRefundZlItemDetail(param);
+        return R.ok().put("data", data);
+    }
+
+    @UserLoginToken
+    @PostMapping("/saveRefundZlItemData")
+    public R saveRefundZlItemData(@RequestBody List<MzZlItemRefundFee> param){
+        service.saveRefundZlItemData(param);
+        return R.ok();
+    }
+
+    @UserLoginToken
+    @PostMapping("/queryRepealZlItemRefundFeeList")
+    public R queryRepealZlItemRefundFeeList(@RequestBody Map<String,Object> param){
+        List<MzZlItemRefundFee> data= service.queryRepealZlItemRefundFeeList(param);
+        return R.ok().put("data", data);
+    }
+
+    @UserLoginToken
+    @PostMapping("/repealZlItemRefundFee")
+    public R repealZlItemRefundFee(@RequestBody Map<String,Object> param){
+        service.repealZlItemRefundFee(param);
+        return R.ok();
+    }
+
+}

+ 62 - 13
src/main/java/cn/hnthyy/thmz/controller/mz/MzyReqrecController.java

@@ -1,11 +1,23 @@
 package cn.hnthyy.thmz.controller.mz;
 
-import cn.hnthyy.thmz.Utils.*;
+import cn.hnthyy.thmz.Utils.AssertUtil;
+import cn.hnthyy.thmz.Utils.DateUtil;
+import cn.hnthyy.thmz.Utils.ExcelUtil;
+import cn.hnthyy.thmz.Utils.HttpUtil;
+import cn.hnthyy.thmz.Utils.NumberToCN;
+import cn.hnthyy.thmz.Utils.R;
+import cn.hnthyy.thmz.Utils.TokenUtil;
+import cn.hnthyy.thmz.Utils.Tools;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.common.exception.BizException;
 import cn.hnthyy.thmz.entity.MzException;
-import cn.hnthyy.thmz.entity.his.mz.*;
+import cn.hnthyy.thmz.entity.his.mz.Employee;
+import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
+import cn.hnthyy.thmz.entity.his.mz.MzReceiptSerial;
+import cn.hnthyy.thmz.entity.his.mz.MzZdWorkTime;
+import cn.hnthyy.thmz.entity.his.mz.MzyReqrec;
+import cn.hnthyy.thmz.entity.his.mz.MzyZdChargeType;
 import cn.hnthyy.thmz.entity.his.zd.ZdChequeType;
 import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode;
 import cn.hnthyy.thmz.entity.thmz.User;
@@ -13,7 +25,12 @@ import cn.hnthyy.thmz.entity.thmz.Windows;
 import cn.hnthyy.thmz.enums.PayMarkEnum;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.pageDto.MzyReqrecPageDto;
-import cn.hnthyy.thmz.service.his.mz.*;
+import cn.hnthyy.thmz.service.his.mz.EmployeeService;
+import cn.hnthyy.thmz.service.his.mz.MzPatientMiService;
+import cn.hnthyy.thmz.service.his.mz.MzZdWorkTimeService;
+import cn.hnthyy.thmz.service.his.mz.MzyReqrecService;
+import cn.hnthyy.thmz.service.his.mz.MzyZdChargeTypeService;
+import cn.hnthyy.thmz.service.his.zd.DictDataService;
 import cn.hnthyy.thmz.service.his.zd.ZdChequeTypeService;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import cn.hnthyy.thmz.service.his.zy.ZyActpatientService;
@@ -23,14 +40,20 @@ import cn.hnthyy.thmz.service.thmz.WindowsService;
 import cn.hnthyy.thmz.vo.MzyReqrecVo;
 import cn.hnthyy.thmz.vo.PageViewVo;
 import cn.hnthyy.thmz.vo.ThmzmxsrParamsVo;
-import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.json.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+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.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
@@ -65,6 +88,8 @@ public class MzyReqrecController {
     @SuppressWarnings("all")
     @Autowired
     private ZyActpatientService zyActpatientService;
+    @Resource
+    private DictDataService dictDataService;
 
     /**
      * 保存挂号信息
@@ -161,6 +186,16 @@ public class MzyReqrecController {
             mzyReqrec.setWebId(tokenUser.getUserIdCode());
             String ipAddress = HttpUtil.getIPAddress(httpServletRequest);
             int num = mzyReqrecService.saveMzyReqrec(mzyReqrecPageDto, ipAddress);
+            if(dictDataService.queryFpVersion() == 1){
+                if(PayMarkEnum.CHARGED.code.equals(mzyReqrecPageDto.getPayMark())){
+                    ZdChequeType zdChequeType = zdChequeTypeService.queryChequeTypeByCode(mzyReqrec.getPaymode());
+                    if (zdChequeType != null && zdChequeType.getPrintFlag() != null && zdChequeType.getPrintFlag() == 1) {
+                        MzReceiptSerial mzReceiptSerial = new MzReceiptSerial(mzyReqrecPageDto.getMzyReqrec().getPatientId(),num);
+                        mzReceiptSerial.setOperatorId(tokenUser.getUserName());
+                        dictDataService.getBswServer().asnyMzInvoice(mzReceiptSerial,true,1);
+                    }
+                }
+            }
             resultMap.put("code", 0);
             resultMap.put("times", num);
             resultMap.put("message", "保存挂号信息成功");
@@ -646,7 +681,7 @@ public class MzyReqrecController {
                         return resultMap;
                     }
                 }
-                if (!(YesNoEnum.YES.code.equals(mzyReqrec.getRefundType()) &&Arrays.asList(Constants.BYJZ, Constants.YLK, Constants.JHZF,Constants.DJZ,Constants.YH_HD,Constants.GCP).contains(dbMzyReqrec.getPaymode()))) {
+                if (!(YesNoEnum.YES.code.equals(mzyReqrec.getRefundType()) &&Arrays.asList(Constants.BYJZ, Constants.YLK, Constants.JHZF,Constants.DJZ,Constants.YH_HD,Constants.GCP,Constants.DY_TG).contains(dbMzyReqrec.getPaymode()))) {
                     dbMzyReqrec.setPaymode(Constants.CASH);
                 }
                 ZdChequeType zdChequeType = zdChequeTypeService.queryChequeTypeByCode(dbMzyReqrec.getPaymode());
@@ -701,6 +736,11 @@ public class MzyReqrecController {
                 resultMap.put("message", "打印当前挂号的发票信息失败,用户Token不存在");
                 return resultMap;
             }
+            if (Constants.HLWYY_CODE.equals(tokenUser.getUserIdCode())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "互联网医院平台挂号无法在门诊窗口打印发票,请让患者联系互联网医院平台!");
+                return resultMap;
+            }
             MzyReqrec mzyReqrec;
             if (times == -1) {
                 mzyReqrec = mzyReqrecService.queryLastMzyReqrecByPatientId(patientId);
@@ -712,10 +752,13 @@ public class MzyReqrecController {
                 resultMap.put("message", "当前病人不存在挂号信息");
                 return resultMap;
             }
-            if (StringUtils.isNotBlank(mzyReqrec.getPrinterId())) {
-                resultMap.put("code", -1);
-                resultMap.put("message", "当前挂号信息已经打印过发票,请勿重复操作");
-                return resultMap;
+            int fpVersion = dictDataService.queryFpVersion();
+            if(fpVersion == 0){
+                if (StringUtils.isNotBlank(mzyReqrec.getPrinterId())) {
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "当前挂号信息已经打印过发票,请勿重复操作");
+                    return resultMap;
+                }
             }
             if(StrUtil.isNotBlank(mzyReqrec.getPaymode())){
                 ZdChequeType zdChequeType = zdChequeTypeService.queryChequeTypeByCode(mzyReqrec.getPaymode());
@@ -734,7 +777,7 @@ public class MzyReqrecController {
                 if(Constants.NIGHT.equals(mzyReqrec.getAmpm()) && StrUtil.isNotBlank(zdUnitCode.getOfficePos1())){
                     officePos = zdUnitCode.getOfficePos1();
                 }
-                resultMap.put("officePos", officePos);
+                resultMap.put("officePos", Convert.toStr(officePos,""));
             }
             Employee employee = employeeService.queryByUserCode(mzyReqrec.getDoctorCode());
             if (employee != null) {
@@ -750,7 +793,11 @@ public class MzyReqrecController {
                 resultMap.put("message", "号段不存在");
                 return resultMap;
             }
-            mzyReqrec.setAmpm(mzZdWorkTime.getName());
+            if(fpVersion == 1){
+                mzyReqrec.setAmpm(Tools.getAmPmDateDiff(mzyReqrec.getRequestDay(),mzyReqrec.getAmpm()));
+            }else {
+                mzyReqrec.setAmpm(mzZdWorkTime.getName());
+            }
             BigDecimal totalFee = mzyReqrec.getReqFee().add(mzyReqrec.getClinicFee()).add(mzyReqrec.getOthFee()).add(mzyReqrec.getBrochureFee()).add(mzyReqrec.getBlbFee() == null ? BigDecimal.ZERO : mzyReqrec.getBlbFee()).add(mzyReqrec.getZlkFee() == null ? BigDecimal.ZERO : mzyReqrec.getZlkFee());
             if (totalFee.compareTo(BigDecimal.ZERO) == 0) {
                 resultMap.put("code", -2);
@@ -779,7 +826,9 @@ public class MzyReqrecController {
                 resultMap.put("day", day.toString());
             }
             mzyReqrec.setPrinterId(tokenUser.getUserIdCode());
-            mzyReqrecService.printMzyReqrecRecept(mzyReqrec);
+            if(fpVersion == 0){
+                mzyReqrecService.printMzyReqrecRecept(mzyReqrec);
+            }
             resultMap.put("code", 0);
             resultMap.put("data", mzyReqrec);
             resultMap.put("user", tokenUser);

+ 17 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/MzyZdChargeTypeController.java

@@ -225,4 +225,21 @@ public class MzyZdChargeTypeController {
         }
     }
 
+    @UserLoginToken
+    @RequestMapping(value = "/getZdChargeItemByMz", method = {RequestMethod.GET, RequestMethod.POST})
+    public Map<String, Object> getZdChargeItemByMz() {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            resultMap.put("code", 0);
+            resultMap.put("message", "查询所有的门诊收费类别成功");
+            resultMap.put("data", mzyZdChargeTypeService.selectZdChargeItemByMz());
+            return resultMap;
+        } catch (Exception e) {
+            log.error("查询所有的门诊收费类别失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询所有的门诊收费类别失败");
+            return resultMap;
+        }
+    }
+
 }

+ 1 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/WorkspaceConfigController.java

@@ -124,6 +124,7 @@ public class WorkspaceConfigController {
                 workspaceConfig.setCheckboxFlag(YesNoEnum.YES.code);
                 workspaceConfig.setZlPrintFlag(YesNoEnum.NO.code);
                 workspaceConfig.setFzZlFlag(YesNoEnum.NO.code);
+                workspaceConfig.setCrbHistoryFlag(YesNoEnum.NO.code);
             }
             resultMap.put("code", 0);
             resultMap.put("message", "查询当前医生的工作台配置成功");

+ 51 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/WpMzPrescriptionController.java

@@ -0,0 +1,51 @@
+package cn.hnthyy.thmz.controller.mz;
+
+import cn.hnthyy.thmz.Utils.R;
+import cn.hnthyy.thmz.service.his.mz.WpMzPrescriptionService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+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 javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2025/1/6
+ */
+@Slf4j
+@RestController
+@RequestMapping("/wpMzPrescription")
+public class WpMzPrescriptionController {
+    @Resource
+    private WpMzPrescriptionService service;
+
+    @GetMapping("/queryYpZdDosage")
+    public R queryYpZdDosage(){
+        return R.ok().put("data", service.queryYpZdDosage());
+    }
+
+    @GetMapping("/queryZdRxAllByLabel")
+    public R queryZdRxAllByLabel(String label){
+        return R.ok().put("data", service.queryZdRxAllByLabel(label,null));
+    }
+    /**
+     * @description: 查询外配药品目录  keyWard
+     * @author: lihong
+     * @date: 2025/1/7 9:13
+     * @param: keyWard
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @PostMapping("/queryRxMedicine")
+    public R queryRxMedicine(@RequestBody Map<String,String> param){
+        return R.ok().put("data", service.queryRxMedicine(param.get("keyWard")));
+    }
+
+
+
+}

+ 9 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/YpMzFytjController.java

@@ -185,18 +185,27 @@ public class YpMzFytjController {
             if(StringUtils.isBlank(chargeFeeParamsVo.getSerialNo())){
                 resultMap.put("code", -1);
                 resultMap.put("message", "流水号不能为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(chargeFeeParamsVo.getRefundMedicineRemark())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "退药原因不能为空");
+                return resultMap;
             }
             if(StringUtils.isBlank(chargeFeeParamsVo.getGroupNoOut())){
                 resultMap.put("code", -1);
                 resultMap.put("message", "药房编码不能为空");
+                return resultMap;
             }
             if(StringUtils.isBlank(chargeFeeParamsVo.getOrderNo())){
                 resultMap.put("code", -1);
                 resultMap.put("message", "处方号不能为空");
+                return resultMap;
             }
             if(chargeFeeParamsVo.getChargeItemCodeAndDecAmounts()==null || chargeFeeParamsVo.getChargeItemCodeAndDecAmounts().size()==0){
                 resultMap.put("code", -1);
                 resultMap.put("message", "退药记录不能为空");
+                return resultMap;
             }
             User tokenUser = TokenUtil.getUser(httpServletRequest);
             chargeFeeParamsVo.setOpId(tokenUser.getUserIdCode());

+ 78 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/YpZdDictController.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.controller.mz;
 
 import cn.hnthyy.thmz.Utils.HttpUtil;
+import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.his.yp.YpBaseYf;
@@ -251,4 +252,81 @@ public class YpZdDictController {
             return resultMap;
         }
     }
+
+    /**
+     * 保存药品商品码
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/saveDrugBarCodeByBarCode", method = {RequestMethod.GET})
+    public R saveDrugBarCodeByBarCode(@RequestParam("chargeCode") String chargeCode, @RequestParam("barCode") String barCode){
+        if(null == chargeCode || StringUtils.isBlank(chargeCode)){
+            R.error().put("code", -1);
+            R.error().put("message", "保存药品商品码失败, 药品编码缺失!");
+            return R.error();
+        }
+        if(null == barCode || StringUtils.isBlank(barCode)){
+            R.error().put("code", -1);
+            R.error().put("message", "保存药品商品码失败, 药品商品码缺失!");
+            return R.error();
+        }
+        int count = ypZdDictService.saveDrugBarCodeByBarCode(chargeCode, barCode);
+        if(count > 0){
+            R.ok().put("code", "0");
+            R.ok().put("message", "保存药品商品码成功!");
+            return R.ok();
+        }
+        R.error().put("code", -1);
+        R.error().put("message", "保存药品商品码失败!");
+        return R.error();
+    }
+
+    /**
+     * 保存药品临购/长购
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/saveDrugBuyOptions", method = {RequestMethod.GET})
+    public R saveDrugBuyOptions(@RequestParam("chargeCode") String chargeCode, @RequestParam("buyFlag") String buyFlag){
+        if(null == chargeCode || StringUtils.isBlank(chargeCode)){
+            R.error().put("code", -1);
+            R.error().put("message", "保存药品临购/长购失败, 药品编码缺失!");
+            return R.error();
+        }
+        if(null == buyFlag || StringUtils.isBlank(buyFlag)){
+            R.error().put("code", -1);
+            R.error().put("message", "保存药品临购/长购失败, 药品临购/长购缺失!");
+            return R.error();
+        }
+        int count = ypZdDictService.saveDrugBuyOptions(chargeCode, buyFlag);
+        if(count > 0){
+            R.ok().put("code", "0");
+            R.ok().put("message", "保存药品临购/长购成功!");
+            return R.ok();
+        }
+        R.error().put("code", -1);
+        R.error().put("message", "保存药品临购/长购失败!");
+        return R.error();
+    }
+
+    /**
+     * 保存药品健康宣教
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/saveDrugHealthFlag", method = {RequestMethod.GET})
+    public R saveDrugHealthFlag(@RequestParam("chargeCode") String chargeCode, @RequestParam("healthFlag") String healthFlag, @RequestParam("healthContent") String healthContent){
+        if(null == chargeCode || StringUtils.isBlank(chargeCode)){
+            R.error().put("code", -1);
+            R.error().put("message", "保存药品健康宣教失败, 药品编码缺失!");
+            return R.error();
+        }
+        int count = ypZdDictService.saveDrugHealthFlag(chargeCode, healthFlag, healthContent);
+        if(count > 0){
+            R.ok().put("code", "0");
+            R.ok().put("message", "保存药品健康宣教成功!");
+            return R.ok();
+        }
+        R.error().put("code", -1);
+        R.error().put("message", "保存药品健康宣教失败!");
+        return R.error();
+    }
+
 }

+ 75 - 0
src/main/java/cn/hnthyy/thmz/controller/mzdzfp/BswController.java

@@ -0,0 +1,75 @@
+package cn.hnthyy.thmz.controller.mzdzfp;
+
+import cn.hnthyy.thmz.Utils.AssertUtil;
+import cn.hnthyy.thmz.Utils.R;
+import cn.hnthyy.thmz.entity.his.mz.MzReceiptSerial;
+import cn.hnthyy.thmz.entity.mzdzfp.MzDzfpUpload;
+import cn.hnthyy.thmz.service.his.zd.DictDataService;
+import cn.hutool.core.convert.Convert;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+/**
+ * @Description: 电子发票
+ * @Author:lihong
+ * @Date: 2025/3/13
+ */
+@RestController
+@Slf4j
+public class BswController {
+    @Resource
+    private DictDataService dictDataService;
+    
+
+    @PostMapping("/uploadZyInvoice")
+    public R zyBlueInvoice(@RequestBody MzDzfpUpload mzDzfpUpload){
+        return dictDataService.getBswServer().uploadZyInvoice(mzDzfpUpload);
+    }
+
+
+    /**
+     * @description: 发票版式文件查询
+     * @author: lihong
+     * @date: 2025/3/13 11:37
+     * @param: param
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @PostMapping("/queryInvoiceFile")
+    public R queryInvoiceFile(@RequestBody MzDzfpUpload mzDzfpUpload){
+        return  dictDataService.getBswServer().queryInvoiceFile(mzDzfpUpload);
+    }
+
+    /**
+     * @description: typeFlag  1 门诊蓝字发票  2 门诊红字发票  ghFlag true 挂号
+     * @author: lihong
+     * @date: 2025/3/20 15:45
+     * @param: param
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @PostMapping("/uploadMzInvoice")
+    public R uploadMzInvoice(@RequestBody Map<String,Object> param){
+        String patientId = Convert.toStr(param.get("patientId"));
+        String times = Convert.toStr(param.get("times"));
+        AssertUtil.isNotBlank(patientId,"门诊号不能为空");
+        AssertUtil.isNotBlank(times,"就诊次数不能为空");
+        Integer typeFlag = Convert.toInt(param.get("typeFlag"));
+        Boolean ghFlag = Convert.toBool(param.get("ghFlag"));
+        AssertUtil.isNotBlank(ghFlag,"挂号类型标识不能为空");
+        AssertUtil.isNotBlank(typeFlag,"电子发票类型不能为空");
+        MzReceiptSerial mzReceiptSerial = new MzReceiptSerial(Convert.toStr(param.get("patientId")), Convert.toInt(param.get("times")));
+        mzReceiptSerial.setReceiptNo(Convert.toInt(param.get("receiptNo")));
+        if(typeFlag == 1){
+            return  dictDataService.getBswServer().getMzBlueInvoice(mzReceiptSerial,ghFlag);
+        }else if(typeFlag == 2){
+            return  dictDataService.getBswServer().getMzRedInvoice(mzReceiptSerial, ghFlag);
+        }
+        return R.error("电子发票类型不能不在范围内");
+    }
+
+
+}

+ 32 - 0
src/main/java/cn/hnthyy/thmz/controller/wxmall/WxmallPackagePurchasedItemController.java

@@ -0,0 +1,32 @@
+package cn.hnthyy.thmz.controller.wxmall;
+
+import cn.hnthyy.thmz.Utils.AssertUtil;
+import cn.hnthyy.thmz.Utils.R;
+import cn.hnthyy.thmz.entity.his.wxmall.WxmallPackagePurchasedItem;
+import cn.hnthyy.thmz.service.his.wxmall.WxmallPackagePurchasedItemService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2025/4/22
+ */
+@Slf4j
+@RestController
+public class WxmallPackagePurchasedItemController {
+    @Resource
+    private WxmallPackagePurchasedItemService service;
+
+    @PostMapping("/queryWxmallPackagePurchasedItem")
+    public R queryWxmallPackagePurchasedItem(@RequestBody WxmallPackagePurchasedItem packagePurchasedItem){
+        AssertUtil.isNotBlank(packagePurchasedItem.getPatNo(),"门诊号不能为空");
+        List<WxmallPackagePurchasedItem> data = service.queryWxmallPackagePurchasedItem(packagePurchasedItem.getPatNo());
+        return R.ok().put("data", data);
+    }
+}

+ 37 - 0
src/main/java/cn/hnthyy/thmz/controller/yk/YpBaseController.java

@@ -123,4 +123,41 @@ public class YpBaseController {
             return resultMap;
         }
     }
+
+    /**
+     * @Description 根据商品码检索药品信息
+     * @Author hsh
+     * @param
+     * @return
+     * @Date 2024/11/11 9:04
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getYpZdDictBaseByBarCode",method = {RequestMethod.POST})
+    public Map<String,Object> getYpZdDictBaseByBarCode(@RequestBody YpZdDictVo ypZdDictVo){
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(null == ypZdDictVo || StringUtils.isBlank(ypZdDictVo.getSearchText())){
+                resultMap.put("code", 0);
+                resultMap.put("message", "查询药品成功");
+                resultMap.put("data", "");
+                return resultMap;
+            }
+
+            // 替换因拼音隔音符号导致的问题
+            if(null != ypZdDictVo.getSearchText()){
+                ypZdDictVo.setSearchText(ypZdDictVo.getSearchText().replace("'", ""));
+            }
+            //根据药品条形码
+            List<YpZdDictVo> list = ypBaseService.queryYpZdBaseByBarCodeLike(ypZdDictVo);
+            resultMap.put("code", 0);
+            resultMap.put("message", "查询药品成功");
+            resultMap.put("data", list);
+            return resultMap;
+        } catch (Exception e) {
+            log.error("查询药品失败,错误信息{}", e);
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询药品失败");
+            return resultMap;
+        }
+    }
 }

+ 24 - 0
src/main/java/cn/hnthyy/thmz/controller/zd/DictDataController.java

@@ -6,10 +6,13 @@ import cn.hnthyy.thmz.entity.his.zd.DictData;
 import cn.hnthyy.thmz.service.his.zd.DictDataService;
 import cn.hutool.core.util.StrUtil;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Map;
+
 /**
  * @Description:
  * @Author:lihong
@@ -30,5 +33,26 @@ public class DictDataController {
         service.updateDictVlaue(dictData);
         return R.ok("更新成功");
     }
+    /**
+     * @description: 查询门诊处方 药品打印配置
+     * @author: lihong
+     * @date: 2025/2/11 9:32
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @GetMapping("/queryDictValueByYpCfPrint")
+    public R queryDictValueByYpCfPrint(){
+        Map<String, Object> res = service.queryDictValueByYpCfPrint();
+        return R.ok().put("data", res);
+    }
+    /**
+     * @description: 查询发票版本
+     * @author: lihong
+     * @date: 2025/4/17 11:37
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @GetMapping("/queryFpVersion")
+    public R queryFpVersion(){
+        return R.ok().put("data", service.queryFpVersion());
+    }
 
 }

+ 14 - 0
src/main/java/cn/hnthyy/thmz/controller/zd/UnitCodeController.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.controller.zd;
 
+import cn.hnthyy.thmz.Utils.AssertUtil;
 import cn.hnthyy.thmz.Utils.ExcelUtil;
 import cn.hnthyy.thmz.Utils.JsonUtil;
 import cn.hnthyy.thmz.Utils.PyWbUtil;
@@ -17,6 +18,7 @@ import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import cn.hnthyy.thmz.service.thmz.UserDeptRelationService;
 import cn.hnthyy.thmz.service.thmz.UserService;
 import cn.hnthyy.thmz.vo.PageViewVo;
+import cn.hutool.core.util.StrUtil;
 import com.auth0.jwt.interfaces.DecodedJWT;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -252,6 +254,18 @@ public class UnitCodeController {
     }
 
 
+    @PostMapping("/saveDeptAddress")
+    @UserLoginToken
+    public R saveDeptAddress(@RequestBody ZdUnitCode zdUnitCode){
+        AssertUtil.isNotBlank(zdUnitCode.getOriginalCode(),"修改的科室编码不能为空!");
+        AssertUtil.isNotBlank(zdUnitCode.getOfficePos(),"就诊地点不能为空");
+        if(StrUtil.isBlank(zdUnitCode.getOfficePos1())){
+            zdUnitCode.setOfficePos1("");
+        }
+        zdUnitCodeService.modifyZdUnitCode(zdUnitCode);
+        return R.ok();
+    }
+
 
     /**
      * 保存科室字典

+ 42 - 0
src/main/java/cn/hnthyy/thmz/controller/zy/ZyActpatientController.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.controller.zy;
 
 import cn.hnthyy.thmz.Utils.DateUtil;
+import cn.hnthyy.thmz.Utils.JsonUtil;
 import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.Utils.Tools;
@@ -9,19 +10,24 @@ import cn.hnthyy.thmz.entity.his.zy.APatientMi;
 import cn.hnthyy.thmz.entity.his.zy.ZyActpatient;
 import cn.hnthyy.thmz.entity.his.zy.ZyLedgerFile;
 import cn.hnthyy.thmz.entity.his.zy.ZyReceipt;
+import cn.hnthyy.thmz.entity.jy.ResultVo;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.GenderEnum;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.service.his.ResponceTypeService;
+import cn.hnthyy.thmz.service.his.zd.DictDataService;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import cn.hnthyy.thmz.service.his.zy.ZyActpatientService;
 import cn.hnthyy.thmz.service.his.zy.ZyLedgerFileService;
 import cn.hnthyy.thmz.service.his.zy.ZyReceiptService;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpRequest;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
 import java.util.HashMap;
@@ -58,6 +64,10 @@ public class ZyActpatientController {
             zyActpatient.setOpIdCode(tokenUser.getUserIdCode());
             int num=zyActpatientService.saveZyActpatientFull(zyActpatient);
             if(num==1){
+                ResultVo doorPatient = zyActpatientService.createDoorPatient(zyActpatient.getInpatientNo());
+                if(doorPatient != null && doorPatient.getCode() != 200 && doorPatient.getCode() != -2){
+                    resultMap.put("waringMessage","创建患者门诊信息警告信息:"+doorPatient.getMessage()+",可以等会再重试创建门禁");
+                }
                 resultMap.put("code", 0);
                 resultMap.put("message", "保存入院信息成功");
                 return resultMap;
@@ -73,6 +83,22 @@ public class ZyActpatientController {
             return resultMap;
         }
     }
+    /**
+     * @description: 创建门禁患者信息
+     * @author: lihong
+     * @date: 2025/1/13 10:48
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @GetMapping("/createDoorPatient")
+    public R createDoorPatient(String patNo){
+        ResultVo resultVo = zyActpatientService.createDoorPatient(patNo);
+        if(resultVo.getCode() == 200){
+            return R.ok();
+        }else {
+            return R.error("创建门禁患者信息失败:"+resultVo.getMessage());
+        }
+    }
+
     /**
      * @description:删除住院登记记录
      * @author: lihong
@@ -84,6 +110,7 @@ public class ZyActpatientController {
     @PostMapping(value = "/deleteZyActpatient")
     public R deleteZyActpatient(@RequestBody ZyActpatient zyActpatient){
         zyActpatientService.deleteZyActpatient(zyActpatient);
+        zyActpatientService.deleteDoor(zyActpatient.getInpatientNo());
         return R.ok();
     }
 
@@ -486,4 +513,19 @@ public class ZyActpatientController {
         }
     }
 
+    /**
+     * @description: 门诊病人是否在院  1 在院 0 不在院
+     * @author: lihong
+     * @date: 2025/1/10 10:11
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @GetMapping("/zaiYuanByPatientId")
+    public R zaiYuanByPatientId(String patientId){
+        ZyActpatient zyActpatient = zyActpatientService.queryZyActpatientByPatientId(patientId);
+        if(zyActpatient != null){
+            return R.ok().put("data", "1");
+        }
+        return R.ok().put("data", "0");
+    }
+
 }

+ 4 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/Employee.java

@@ -33,4 +33,8 @@ public class Employee {
     private String wbCode;
     //医生的医保赋码
     private String ybCode;
+    //中药处方权 0:未授权,1:授权
+    private Integer doctorZy;
+    //双通道药品权限
+    private Integer dualchnlFlag;
 }

+ 4 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzBlRecord.java

@@ -23,6 +23,8 @@ public class MzBlRecord extends PageBean {
     private Date visitDate;
     //医生编码
     private String doctorCode;
+    //医生名称
+    private String doctorName;
     //部门编码
     private String deptCode;
 
@@ -71,6 +73,8 @@ public class MzBlRecord extends PageBean {
     private String personalHistory;
     //辅助资料
     private String fzZl;
+    //传染病史
+    private String crbHistory;
     //家族史
     private String familyHistory;
     //婚育史

+ 9 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzChargeDetail.java

@@ -131,6 +131,8 @@ public class MzChargeDetail implements Serializable,Comparable<MzChargeDetail> {
     private String tcNo;
     //套餐名称
     private String tcName;
+    //医技项目名称
+    private String yjName;
     //套餐细目标志
     private String detailFlag;
     //自付比例
@@ -233,6 +235,10 @@ public class MzChargeDetail implements Serializable,Comparable<MzChargeDetail> {
     private Integer isHide;
     //患者的处方是否有医保报销支付(门诊统筹) >0 有医保报销
     private Integer countYbZf;
+    //处方锁定标识 1 锁定 0未锁
+    private Integer orderLockFlag;
+    //医保移动支付标识 0 不是 1是
+    private Integer mipOrderFlag;
     //患者的处方是否可以进行医保补录 1 可以 非数据库字段
     private Integer mztcbl;
     //药房发药药品批次
@@ -243,6 +249,9 @@ public class MzChargeDetail implements Serializable,Comparable<MzChargeDetail> {
     private String visitTypeName;
     //处方类型
     private String orderTypeName;
+    //0-报销,2-自费
+    private String hospApprFlag;
+    private Integer tfFlag;
     public MzChargeDetail(String patientId, Integer times) {
         this.patientId = patientId;
         this.times = times;

+ 9 - 1
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzDepositFile.java

@@ -54,7 +54,7 @@ public class MzDepositFile extends PageBean implements Serializable {
     private String hisrefundnum;
     //金额字符串
     private String amountStr;
-    //合同id
+    //合同id 借用 抖音团购号
     private Long contractId;
     //付款方式名称
     private String chequeTypeName;
@@ -64,6 +64,14 @@ public class MzDepositFile extends PageBean implements Serializable {
     private String transDate;
     //凭证号
     private String traceNo;
+    //抖音团购号
+    private String dyTgNo;
+    //退费标识  1退费
+    private Integer tfFlag;
+    //申请科室
+    private String warnCode;
+    //开处方医生
+    private String doctorCode;
     public MzDepositFile() {
     }
     public MzDepositFile(String patientId, Integer times) {

+ 72 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzDrugTracCodg.java

@@ -0,0 +1,72 @@
+package cn.hnthyy.thmz.entity.his.mz;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @ClassName MzDrugTracCodg
+ * @Author hsh
+ * @Date 2024/10/19 9:58
+ * @Version 1.0
+ * @Description 门诊药品追溯码信息表
+ **/
+@Data
+public class MzDrugTracCodg implements Serializable {
+
+    //药品追溯码(最小包装单位的一码)
+    private String drugTracCodg;
+    //病人ID码
+    private String patientId;
+    //次数
+    private Integer times;
+    //是发票分票号,现在不用了,默认为1就好 没有缴费是0 缴费了是1
+    private Integer receiptNo;
+    //处方号
+    private Integer orderNo;
+    //项目数
+    private Integer itemNo;
+    //药品编码
+    private String chargeItemCode;
+    //药品包装
+    private String serial;
+    //药房编码
+    private String groupNo;
+    //标志
+    private String flag;
+    //发药时间
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss:SSS")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss:SSS",timezone="GMT+8")
+    private Date confirmTime;
+    //配药人id
+    private String confirmId;
+    //配药人
+    private String confirmName;
+    //发票流水号
+    private Integer realNo;
+    //品名
+    private String drugName;
+    //规格
+    private String specification;
+    //生产厂家
+    private String abbrName;
+    //单价
+    private BigDecimal unitPrice;
+    //诊断
+    private String icdText;
+    //科室名称
+    private String warnDeptName;
+    //医生名称
+    private String employeeName;
+    //收费时间
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss:SSS")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss:SSS",timezone="GMT+8")
+    private Date chargeDate;
+    //病人姓名
+    private String name;
+
+}

+ 25 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzOrderLock.java

@@ -0,0 +1,25 @@
+package cn.hnthyy.thmz.entity.his.mz;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description: 门诊处方锁表
+ * @Author:lihong
+ * @Date: 2024/10/24
+ */
+@Data
+public class MzOrderLock implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /** 处方订单号  patientId_times_receiptNo 拼接而成 */
+    @TableId
+    private String hisOrderNum;
+    /** 0 未锁定 1锁定不能修改处方 */
+    private Integer lockFlag;
+    private Date updateTime;
+    private String updateId;
+    private Integer ybzf;
+}

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzPatientMi.java

@@ -100,6 +100,8 @@ public class MzPatientMi extends PageParams {
     private String updateUser;
     //修改时间
     private Date updateTime;
+    //最后就诊时间
+    private String lastVisitDate;
 
     public void setAge(Integer age) {
         this.age = age;

+ 4 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzReceiptSerial.java

@@ -121,6 +121,10 @@ public class MzReceiptSerial implements Serializable {
     private String name;
     //做版本控制,防止发票号被并发修改
     private String bz;
+    //申请科室
+    private String warnCode;
+    //开处放医生
+    private String doctorCode;
 //    public void setCharge1(BigDecimal charge1) {
 //        this.charge1 = charge1;
 //        if(totalCharge==null){

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzYjReq.java

@@ -103,6 +103,8 @@ public class MzYjReq extends PageBean {
     private String execName;
     //检验物名称
     private String inspectName;
+    //注意事项
+    private String comment8;
 
     public MzYjReq() {
     }

+ 89 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzZlItemRefundFee.java

@@ -0,0 +1,89 @@
+package cn.hnthyy.thmz.entity.his.mz;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import com.baomidou.mybatisplus.annotation.TableName;
+/**
+ * 诊疗项目退费申请(MzZlItemRefundFee)表实体类
+ *
+ * @author lihong
+ * @since 2024-11-18 09:57:09
+ */
+@SuppressWarnings("serial")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@TableName("mz_zl_item_refund_fee")
+public class MzZlItemRefundFee implements Serializable {
+    private static final long serialVersionUID = 1L;
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+    private String patientId;
+    private String name;
+
+    private Integer times;
+          
+    private Integer receiptNo;
+          
+    private Integer orderNo;
+          
+    private Integer itemNo;
+     /**
+     * 项目编码
+     */     
+    private String chargeItemCode;
+          
+    private String chargeItemName;
+    /**
+     * 原来数量
+     */
+    @TableField(exist = false)
+    private BigDecimal quantity;
+    @TableField(exist = false)
+    private BigDecimal unitPrice;
+     /**
+     * 退费数量
+     */     
+    private BigDecimal decAmount;
+     /**
+     * 0 已申请 1 已取消
+     */     
+    private Integer confirmFlag;
+    @TableField(exist = false)
+    private String confirmFlagName;
+     /**
+     * 申请人
+     */
+
+    private String opId;
+    /**
+     * 申请人姓名
+     */
+    @TableField(exist = false)
+    private String opName;
+     /**
+     * 申请时间
+     */     
+    private Date opTime;
+     /**
+     * 修改人
+     */     
+    private String updateId;
+     /**
+     * 修改时间
+     */     
+    private Date updateTime;
+
+    }
+

+ 4 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzyZdChargeType.java

@@ -39,4 +39,8 @@ public class MzyZdChargeType {
     private String isrubric;
     //提示内容
     private String rubricTxt;
+    //收费编码
+    private String chargeCode;
+    //收费类别
+    private String chargeCodeName;
 }

+ 87 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/RxDiseinfo.java

@@ -0,0 +1,87 @@
+package cn.hnthyy.thmz.entity.his.mz;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.Date;
+/**
+ * (TRxDiseinfo)表实体类 诊断
+ *
+ * @author lihong
+ * @since 2025-01-03 15:57:11
+ */
+@SuppressWarnings("serial")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class RxDiseinfo implements Serializable {
+    private static final long serialVersionUID =  1L;
+    /**
+     * 处方编号
+     */
+    private String hospRxno;
+
+     /**
+     * 诊断类别(from zd_rx_all where label='rx_diag_type')
+     */     
+    private String diagType;
+     /**
+     * 主诊断标志(0-否、1-是)
+     */     
+    private String maindiagFlag;
+     /**
+     * 诊断排序号
+     */     
+    private Integer diagSrtNo;
+     /**
+     * 诊断代码
+     */     
+    private String diagCode;
+     /**
+     * 诊断名称
+     */     
+    private String diagName;
+     /**
+     * 诊断科室名称
+     */     
+    private String diagDept;
+     /**
+     * 诊断科室代码
+     */     
+    private String diagDeptCode;
+     /**
+     * 诊断医生医保编码
+     */     
+    private String diagDrNo;
+     /**
+     * 诊断医生姓名
+     */     
+    private String diagDrName;
+     /**
+     * 诊断时间
+     */     
+    private Date diagTime;
+     /**
+     * 中医病名代码(diagType不为西医诊断时上传)
+     */     
+    private String tcmDiseCode;
+     /**
+     * 中医病名(diagType不为西医诊断时上传)
+     */     
+    private String tcmDiseName;
+     /**
+     * 中医证候代码(diagType不为西医诊断时上传)
+     */     
+    private String tcmsympCode;
+     /**
+     * 中医证候(diagType不为西医诊断时上传)
+     */     
+    private String tcmsymp;
+
+    }
+

+ 179 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/RxDruginfo.java

@@ -0,0 +1,179 @@
+package cn.hnthyy.thmz.entity.his.mz;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+/**
+ * 电子处方药品(TRxDruginfo)表实体类 药品信息
+ *
+ * @author lihong
+ * @since 2025-01-03 15:56:23
+ */
+@SuppressWarnings("serial")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class RxDruginfo  implements Serializable {
+
+    private static final long serialVersionUID =  1L;
+    private String hospRxno;
+
+     /**
+     * 医保药品编码
+     */     
+    private String medListCodg;
+     /**
+     * 院内药品编码
+     */     
+    private String fixmedinsHilistId;
+     /**
+     * 医疗机构制剂标志(0-否、1-是,默 认否)
+     */     
+    private Integer hospPrepFlag;
+     /**
+     * 处方项目分类代码(from zd_rx_all where label='rx_item_type')
+     */     
+    private Integer rxItemTypeCode;
+     /**
+     * 处方项目分类名称
+     */     
+    private String rxItemTypeName;
+     /**
+     * 中药类别代码(中药处方必填,中药饮片固定传3)
+     */     
+    private Integer tcmdrugTypeCode;
+     /**
+     * 中药类别名称
+     */     
+    private String tcmdrugTypeName;
+     /**
+     * 草药脚注
+     */     
+    private String tcmherbFoote;
+     /**
+     * 药物类型代码(label = rx_medn_type)
+     */     
+    private String mednTypeCode;
+     /**
+     * 药物类型名称
+     */     
+    private String mednTypeName;
+     /**
+     * 主要用药标志(0-否、1-是)
+     */     
+    private Integer mainMedcFlag;
+     /**
+     * 加急标志(0-否、1-是)
+     */     
+    private Integer urgtFlag;
+     /**
+     * 基本药物标志(0-否、1-是)
+     */     
+    private Integer basMednFlag;
+     /**
+     * 是否进口药品(0-否、1-是)
+     */     
+    private Integer impDrugFlag;
+     /**
+     * 是否OTC药品(0-否、1-是)
+     */     
+    private Integer otcFlag;
+     /**
+     * 药品通用名
+     */     
+    private String drugGenname;
+     /**
+     * 药品剂型
+     */     
+    private String drugDosform;
+     /**
+     * 药品规格
+     */     
+    private String drugSpec;
+     /**
+     * 药品商品名(非必填,可按通用名开方)
+     */     
+    private String drugProdname;
+     /**
+     * 生产厂家
+     */     
+    private String prdrName;
+     /**
+     * 用药途径代码(rx_item_type_code为西药、中成药时必填)(from zd_rx_all where label='rx_used_way')
+     */     
+    private Integer medcWayCodg;
+     /**
+     * 用药途径名称
+     */     
+    private String medcWayDscr;
+     /**
+     * 用药开始时间
+     */     
+    private Date medcBegntime;
+     /**
+     * 用药结束时间
+     */     
+    private Date medcEndtime;
+     /**
+     * 用药天数
+     */     
+    private Integer medcDays;
+     /**
+     * 单次剂量单位(rx_item_type_code为西药、中成药时必填)
+     */     
+    private String sinDosunt;
+     /**
+     * 单次用量(rx_item_type_code为西药、中成药时必填)
+     */     
+    private BigDecimal sinDoscnt;
+     /**
+     * 使用频次编码(rx_item_type_code为西药、中成药时必填)(from zd_rx_all where label='rx_used_frqu')
+     */     
+    private Integer usedFrquCodg;
+     /**
+     * 使用频次名称 (rxItemTypeCode为西药、中成药时必填);
+     */     
+    private String usedFrquName;
+     /**
+     * 药品总用药量单位(即发药计价单位,如”片“,”盒“)
+     */     
+    private String drugDosunt;
+     /**
+     * 药品发药总量(根据单次剂量及单位、频次等和drugDosunt按院内“药品单位转换系数“换算)
+     */     
+    private BigDecimal drugCnt;
+     /**
+     * 药品单价
+     */     
+    private BigDecimal drugPric;
+     /**
+     * 药品总金额
+     */     
+    private BigDecimal drugSumamt;
+     /**
+     * 医院审批标志(1-报销,2-自费)
+     */     
+    private Integer hospApprFlag;
+     /**
+     * 自费原因类型(hospApprFlag=2时必填)(from zd_rx_all where label='rx_self_pay_rea')
+     */     
+    private Integer selfPayRea;
+     /**
+     * 自费原因描述(自费原因类型为6时必填)
+     */     
+    private String realDscr;
+
+    /**
+     * 是否双通道标志(0-否,1-是) 非数据库字段
+     */
+    private Integer dualchnlFlag;
+
+    }
+

+ 190 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/RxMdtrtinfo.java

@@ -0,0 +1,190 @@
+package cn.hnthyy.thmz.entity.his.mz;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+/**
+ * 电子处方就诊信息(TRxMdtrtinfo)表实体类 就诊信息
+ *
+ * @author lihong
+ * @since 2025-01-03 15:56:49
+ */
+@SuppressWarnings("serial")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class RxMdtrtinfo implements Serializable {
+
+    private static final long serialVersionUID =  1L;
+    private String hospRxno;
+
+     /**
+     * 门诊/住院号 
+     */     
+    private String iptOtpNo;
+     /**
+     * 门诊住院标识(1-门诊、2-住院,默认为1)
+     */     
+    private Integer otpIptFlag;
+     /**
+     * 患者姓名
+     */     
+    private String patnName;
+     /**
+     * 人员证件类型(from zd_rx_all where label='rx_psn_cert_type')
+     */     
+    private String psnCertType;
+     /**
+     * 证件号码
+     */     
+    private String certno;
+     /**
+     * 年龄
+     */     
+    private BigDecimal patnAge;
+     /**
+     * 患者身高
+     */     
+    private BigDecimal patnHgt;
+     /**
+     * 患者体重
+     */     
+    private BigDecimal patnWt;
+     /**
+     * 性别
+     */     
+    private String gend;
+     /**
+     * 计划生育手术类别
+     */     
+    private String birctrlType;
+     /**
+     * 计划生育手术或生育日期
+     */     
+    private Date birctrlMatnDate;
+     /**
+     * 生育类别
+     */     
+    private String matnType;
+     /**
+     * 妊娠(孕周
+     */     
+    private Integer gesoVal;
+     /**
+     * 新生儿标志(0-否、1-是)
+     */     
+    private String nwbFlag;
+     /**
+     * 新生儿日、月龄
+     */     
+    private String nwbAge;
+     /**
+     * 哺乳期标志(0-否、1-是)
+     */     
+    private String suckPrdFlag;
+     /**
+     * 过敏史
+     */     
+    private String algsHis;
+     /**
+     * 开方科室编码
+     */     
+    private String prscDeptCode;
+     /**
+     * 开方科室名称
+     */     
+    private String prscDeptName;
+     /**
+     * 开方医保医师代 码
+     */     
+    private String drCode;
+     /**
+     * 开方医师姓名
+     */     
+    private String prscDrName;
+     /**
+     * 开方医师证件类型(from zd_rx_all where label='rx_psn_cert_type')
+     */     
+    private String prscDrCertType;
+     /**
+     * 开方医师证件号码
+     */     
+    private String prscDrCertno;
+     /**
+     * 医生职称编码(from zd_rx_all where label='rx_dr_profttl')
+     */     
+    private String drProfttlCodg;
+     /**
+     * 医生职称名称
+     */     
+    private String drProfttlName;
+     /**
+     * 医生科室编码
+     */     
+    private String drDeptCode;
+     /**
+     * 医生科室名称
+     */     
+    private String drDeptName;
+     /**
+     * 科别
+     */     
+    private String caty;
+     /**
+     * 就诊时间
+     */     
+    private Date mdtrtTime;
+     /**
+     * 病种编码(medType为门诊慢特病时必传)
+     */     
+    private String diseCodg;
+     /**
+     * 病种名称
+     */     
+    private String diseName;
+     /**
+     * 特殊病种标志(0-否、1-是)
+     */     
+    private String spDiseFlag;
+     /**
+     * 主诊断代码
+     */     
+    private String maindiagCode;
+     /**
+     * 主诊断名称
+     */     
+    private String maindiagName;
+     /**
+     * 疾病病情描述
+     */     
+    private String diseCondDscr;
+     /**
+     * 医保费用结算类型(from zd_rx_all where label='rx_setl_type')
+     */     
+    private String hiFeesetlType;
+     /**
+     * 医保费用类别名称
+     */     
+    private String hiFeesetlName;
+     /**
+     * 挂号费
+     */     
+    private BigDecimal rgstFee;
+     /**
+     * 医疗费总额
+     */     
+    private BigDecimal medfeeSumamt;
+     /**
+     * 是否初诊(0-否、1-是)
+     */     
+    private String fstdiagFlag;
+
+    }
+

+ 124 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/RxReceiptinfo.java

@@ -0,0 +1,124 @@
+package cn.hnthyy.thmz.entity.his.mz;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+/**
+ * (TRxReceiptinfo)表实体类 处方信息
+ *
+ * @author lihong
+ * @since 2025-01-03 15:55:16
+ */
+@SuppressWarnings("serial")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class RxReceiptinfo implements Serializable {
+    private static final long serialVersionUID =  1L;
+    /**
+     * 处方编号
+     */
+    private String hospRxno;
+     /**
+     * 门诊号/住院号
+     */     
+    private String patNo;
+     /**
+     * 就诊次数
+     */     
+    private Integer times;
+     /**
+     * 续方的原处方编号
+     */     
+    private String initRxno;
+     /**
+     * 处方类别代码(from zd_rx_all where label='rx_type')
+     */     
+    private Integer rxTypeCode;
+     /**
+     * 开方时间
+     */     
+    private Date prscTime;
+     /**
+     * 非中药时为处方药品类目数量,中药时为药品总剂数
+     */     
+    private Integer rxDrugCnt;
+     /**
+     * 中药汤剂处方整剂用法编号(from zd_rx_all where label='rx_used_way')
+     */     
+    private Integer rxUsedWayCodg;
+     /**
+     * 中药汤剂处方整剂用法名称
+     */     
+    private String rxUsedWayName;
+     /**
+     * 中药汤剂处方整剂频次编号(from zd_rx_all where label='rx_used_frqu')
+     */     
+    private Integer rxFrquCodg;
+     /**
+     * 中药汤剂处方整剂频次名称
+     */     
+    private String rxFrquName;
+     /**
+     * 中药汤剂处方整剂剂量单位
+     */     
+    private String rxDosunt;
+     /**
+     * 中药汤剂处方整剂单次剂量数
+     */     
+    private BigDecimal rxDoscnt;
+     /**
+     * 中药汤剂处方整剂医嘱说明
+     */     
+    private String rxDrordDscr;
+     /**
+     * 处方有效天数
+     */     
+    private Integer valiDays;
+     /**
+     * 有效截止时间(开方时间+处方有效天数)
+     */     
+    private Date valiEndTime;
+     /**
+     * 复用(多次)使用标志(0-否、1-是)
+     */     
+    private Integer reptFlag;
+     /**
+     * 最大使用次数
+     */     
+    private Integer maxReptCnt;
+     /**
+     * 已使用次数
+     */     
+    private Integer reptdCnt;
+     /**
+     * 使用最小间隔(天数)
+     */     
+    private Integer minInrvDays;
+     /**
+     * 续方标志(0-否、1-是,默认为否)
+     */     
+    private Integer rxCotnFlag;
+     /**
+     * 长期处方标志(0-否、1-是,默认为否)
+     */     
+    private Integer longRxFlag;
+
+    /**
+     * 住院号
+     */
+    private String zyNo;
+    /**
+     * 住院次数
+     */
+    private Integer zyTimes;
+
+    }
+

+ 107 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/ZdRxMedicine.java

@@ -0,0 +1,107 @@
+package cn.hnthyy.thmz.entity.his.mz;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.Date;
+/**
+ * 电子处方药品字典(ZdRxMedicine)表实体类
+ *
+ * @author lihong
+ * @since 2025-01-03 10:38:28
+ */
+@SuppressWarnings("serial")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class ZdRxMedicine  implements Serializable {
+    private static final long serialVersionUID =  1L;
+    private String id;
+
+     /**
+     * 医疗目录编码
+     */     
+    private String medListCodg;
+     /**
+     * 国家药品编号
+     */     
+    private String natDrugNo;
+     /**
+     * 通用名
+     */     
+    private String genname;
+     /**
+     * 商品名
+     */     
+    private String prodname;
+     /**
+     * 注册名
+     */     
+    private String regName;
+     /**
+     * 目录类别(101-西药中成药,102-中药饮品,103-自制剂,104-民族药)
+     */     
+    private String listType;
+     /**
+     * 目录类别名称
+     */     
+    private String listTypeName;
+     /**
+     * 规格名称
+     */     
+    private String specName;
+     /**
+     * 生产厂家
+     */     
+    private String prdrName;
+     /**
+     * 批准文号
+     */     
+    private String aprvno;
+     /**
+     * 剂型名称
+     */     
+    private String dosformName;
+     /**
+     * 最小包装单位
+     */     
+    private String minPacunt;
+     /**
+     * 统筹区编号
+     */     
+    private String poolareaNo;
+     /**
+     * 统筹区名称
+     */     
+    private String poolareaName;
+     /**
+     * 是否双通道标志(0-否,1-是)
+     */     
+    private Integer dualchnlFlag;
+     /**
+     * 最小制剂单位
+     */     
+    private String minPrepunt;
+     /**
+     * 开始时间
+     */     
+    private Date begntime;
+     /**
+     * 结束时间
+     */     
+    private Date endtime;
+     /**
+     * 拼音码
+     */     
+    private String pyCode;
+     /**
+     * 页码数(每页数据量100)
+     */     
+    private Integer pageNo;
+
+    }
+

+ 49 - 0
src/main/java/cn/hnthyy/thmz/entity/his/wxmall/WxmallPackagePurchasedItem.java

@@ -0,0 +1,49 @@
+package cn.hnthyy.thmz.entity.his.wxmall;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.util.Date;
+/**
+ * (TWxmallPackagePurchasedItem)表实体类
+ *
+ * @author lihong
+ * @since 2025-04-22 09:23:09
+ */
+@SuppressWarnings("serial")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class WxmallPackagePurchasedItem {
+    private String id;
+    //微信交易号
+    private String wxTradeNo;
+          
+    private String patNo;
+          
+    private String packageId;
+          
+    private String hisCode;
+          
+    private String hisName;
+    //购买的数据量
+    private Integer quantity;
+    //可使用数量
+    private Integer usableQuantity;
+    //最后使用时间
+    private Date lastUseTime;
+    //单价
+    private BigDecimal price;
+    //总价
+    private String costAmt;
+    // JY 检验 JC 检查 ZL 诊疗
+    private String type;
+    //原价
+    private BigDecimal originPrice;
+
+    }
+

+ 43 - 0
src/main/java/cn/hnthyy/thmz/entity/his/wxmall/WxmallPackageUseHistory.java

@@ -0,0 +1,43 @@
+package cn.hnthyy.thmz.entity.his.wxmall;
+
+import java.util.Date;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+/**
+ * (TWxmallPackageUseHistory)表实体类
+ *
+ * @author lihong
+ * @since 2025-04-22 09:23:53
+ */
+@SuppressWarnings("serial")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class WxmallPackageUseHistory {
+    private String id;
+    private String patNo;
+          
+    private Integer times;
+          
+    private String wxTradeNo;
+          
+    private String packageId;
+    //WxmallPackagePurchasedItem 的 id
+    private String packageItemId;
+          
+    private Integer useQuantity;
+          
+    private Date useTime;
+          
+    private String doctorCode;
+
+
+    }
+

+ 263 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/SelinfoSold.java

@@ -0,0 +1,263 @@
+package cn.hnthyy.thmz.entity.his.yp;
+
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @ClassName SelinfoSold
+ * @Author hsh
+ * @Date 2024/10/31 16:16
+ * @Version 1.0
+ * @Description 药品销售
+ **/
+@Data
+public class SelinfoSold {
+
+    /**
+     * 医疗目录编码(如果没有就填默认值NMLC999)
+     * */
+    private String medListCodg;
+
+
+    /**
+     * 定点医药机构目录编号
+     * */
+    private String fixmedinsHilistId;
+
+
+    /**
+     * 定点医药机构目录名称
+     * */
+    private String fixmedinsHilistName;
+
+
+    /**
+     * 定点医药机构批次流水号
+     * */
+    private String fixmedinsBchno;
+
+
+    /**
+     * 开方医师证件类型
+     * */
+    private String prscDrCertType;
+
+
+    /**
+     * 开方医师证件号码
+     * */
+    private String prscDrCertno;
+
+
+    /**
+     * 开方医师姓名
+     * */
+    private String prscDrName;
+
+
+    /**
+     * 药师证件类型
+     * */
+    private String pharCertType;
+
+
+    /**
+     * 药师证件号码
+     * */
+    private String pharCertno;
+
+
+    /**
+     * 药师姓名
+     * */
+    private String pharName;
+
+
+    /**
+     * 药师执业资格证号
+     * */
+    private String pharPracCertNo;
+
+
+    /**
+     * 医保费用结算类型
+     * */
+    private String hiFeesetlType;
+
+
+    /**
+     * 结算ID
+     * */
+    private String setlId;
+
+
+    /**
+     * 就医流水号
+     * */
+    private String mdtrtSn;
+
+
+    /**
+     * 人员编号
+     * */
+    private String psnNo;
+
+
+    /**
+     * 人员证件类型
+     * */
+    private String psnCertType;
+
+
+    /**
+     * 证件号码
+     * */
+    private String certno;
+
+
+    /**
+     * 人员姓名
+     * */
+    private String psnName;
+
+
+    /**
+     * 生产批号
+     * */
+    private String manuLotnum;
+
+
+    /**
+     * 生产日期
+     * */
+    private String manuDate;
+
+
+    /**
+     * 有效期止
+     * */
+    private String expyEnd;
+
+
+    /**
+     * 处方药标志
+     * */
+    private String rxFlag;
+
+
+    /**
+     * 拆零标志
+     * */
+    private String trdnFlag;
+
+
+    /**
+     * 最终成交单价
+     * */
+    private String finlTrnsPric;
+
+
+    /**
+     * 处方号
+     * */
+    private String rxno;
+
+
+    /**
+     * 外购处方标志
+     * */
+    private String rxCircFlag;
+
+
+    /**
+     * 零售单据号
+     * */
+    private String rtalDocno;
+
+
+    /**
+     * 销售出库单据号
+     * */
+    private String stooutNo;
+
+
+    /**
+     * 批次号
+     * */
+    private String bchno;
+
+
+    /**
+     * 药品追溯码
+     * */
+    private String drugTracCodg;
+
+
+    /**
+     * 药品条形码
+     * */
+    private String drugProdBarc;
+
+
+    /**
+     * 货架位
+     * */
+    private String shelfPosi;
+
+
+    /**
+     * 销售/退货数量
+     * */
+    private String selRetnCnt;
+
+
+    /**
+     * 销售/退货时间
+     * */
+    private String selRetnTime;
+
+
+    /**
+     * 销售/退货经办人姓名
+     * */
+    private String selRetnOpterName;
+
+
+    /**
+     * 备注
+     * */
+    private String memo;
+
+    /**
+     * 开方医师编号(医保结算必填,非电子处方不校验)
+     * */
+    private String prscDrNo;
+
+    /**
+     * 医保药师编号(医保结算必填)
+     * */
+    private String pharNo;
+
+    /**
+     * 就诊结算类型(1-医保结算 2-自费结算)
+     * */
+    private String mdtrtSetlType;
+
+    /**
+     * 药品追溯码集合
+     * */
+    private List<String> drugtracinfo;
+
+    /**
+     * 上传标志(0: 未上传  1:已上传  -1: 上传失败)
+     * */
+    private String upFlag;
+
+    /**
+     * 创建时间
+     * */
+    private Date createTime;
+
+}

+ 39 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpBarInfo.java

@@ -0,0 +1,39 @@
+package cn.hnthyy.thmz.entity.his.yp;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @ClassName YpBarInfo
+ * @Author hsh
+ * @Date 2024/11/6 15:45
+ * @Version 1.0
+ * @Description 药品商品码信息
+ **/
+@Data
+public class YpBarInfo {
+
+    // 药品编码
+    private String chargeCode;
+    // 药品商品码
+    private String barCode;
+    // 品名
+    private String chargeName;
+    // 规格
+    private String specification;
+    // 厂家编码
+    private String manuCode;
+    // 厂家名称
+    private String manuName;
+    // 零售价
+    private BigDecimal packRetprice;
+    // 批准文号
+    private String pzwh;
+    // 标志(1:默认值; -1:无效)
+    private String barFlag;
+    // 创建时间
+    private Date createDate;
+
+}

+ 1 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpBase.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.entity.his.yp;
 
 
+import cn.hnthyy.thmz.annotation.NotColumn;
 import lombok.Data;
 
 import java.math.BigDecimal;

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpInDetl.java

@@ -128,4 +128,6 @@ public class YpInDetl {
   //药品国家医保编码
   @NotColumn
   private String nationalCode;
+  //药品追溯码(定点医药机构批次流水号)
+  private String drugTracCodg;
 }

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpInDetlYf.java

@@ -102,4 +102,6 @@ public class YpInDetlYf{
   private String inputName;
   //购买总价
   private BigDecimal buyTotalPrice;
+  //药品追溯码(整箱的集装箱外追溯码)
+  private String drugTracCodg;
 }

+ 30 - 7
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpManuBarCode.java

@@ -2,6 +2,8 @@ package cn.hnthyy.thmz.entity.his.yp;
 
 import lombok.Data;
 
+import java.util.Date;
+
 /**
  * 入库药品批号和条码关系实体类
  */
@@ -9,19 +11,40 @@ import lombok.Data;
 public class YpManuBarCode {
 
 	/**
-	 * 入库单号
+	 * 药品编码
 	 */
-  private String inDocuNo;
+  	private String chargeCode;
 	/**
-	 * 药品编码
+	 * 药品追溯码
+	 */
+	private String drugTracCodg;
+	/**
+	 * 药品条形码
+	 */
+	private String barCode;
+	/**
+	 * 入库单号
 	 */
-  private String chargeCode;
+	private String inDocuNo;
 	/**
 	 * 批次编码
 	 */
-  private String manuNo;
+  	private String manuNo;
+	/**
+	 * 拆零标志(0:默认值,未拆零, 整箱;1:拆零)
+	 */
+  	private String clFlag;
+	/**
+	 * 创建人id
+	 */
+	private String createId;
+	/**
+	 * 创建时间
+	 */
+	private Date createDate;
 	/**
-	 * 条码号
+	 * 追溯码条目数
 	 */
-  private String barCode;
+	private Integer quantity;
+
 }

+ 4 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpMzFytj.java

@@ -69,6 +69,10 @@ public class YpMzFytj implements Serializable {
      * 标识:1已发药 2.待退药 3.已退药
      */
     private Integer confirmFlag;
+    /**
+     * 退药原因 refund_medicine_remark
+     */
+    private String refundMedicineRemark;
     //草药副数
     private Integer cyFy;
     //申请科室

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpOutDetl.java

@@ -98,4 +98,6 @@ public class YpOutDetl extends PageBean {
   //药品国家医保编码
   @NotColumn
   private String nationalCode;
+  //药品追溯码(整箱的集装箱外追溯码)
+  private String drugTracCodg;
 }

+ 10 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpZdDict.java

@@ -272,6 +272,8 @@ public class YpZdDict {
     //药品医保编码
     @NotColumn
     private String nationalCode;
+    @NotColumn
+    private String nationalName;
     //处方限制天数
     @NotColumn
     private Integer prescriptionLimitDays;
@@ -292,4 +294,12 @@ public class YpZdDict {
 
     @NotColumn
     private String groupNo;
+    // 药品商品码
+    private String barCode;
+    // 药品临购/长购 1:临购  2:长购
+    private String buyFlag;
+    // 药品健康宣教 1: 是健康宣教
+    private String healthFlag;
+    // 药品健康宣教内容
+    private String healthContent;
 }

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/zd/JcZdItem.java

@@ -48,4 +48,6 @@ public class JcZdItem extends PageBean implements Serializable {
     private Integer minAgeRestriction;
     //最大年龄限制
     private Integer maxAgeRestriction;
+    //报告时限
+    private String timeLimit;
 }

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/zd/JyZdItem.java

@@ -66,4 +66,6 @@ public class JyZdItem extends PageBean implements Serializable {
     private Integer minAgeRestriction;
     //最大年龄限制包含等于
     private Integer maxAgeRestriction;
+    //报告时限
+    private String timeLimit;
 }

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/zd/ZdChargeItem.java

@@ -148,4 +148,6 @@ public class ZdChargeItem {
     private String groupNo;
     //病案统计编码
     private String zdChargeBaClass;
+    // 重点监测项目 0:否 1:是
+    private String focusMonitorFlag;
 }

+ 111 - 0
src/main/java/cn/hnthyy/thmz/entity/his/zd/ZdTaxClassCode.java

@@ -0,0 +1,111 @@
+package cn.hnthyy.thmz.entity.his.zd;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+/**
+ * 税收分类编码(ZdTaxClassCode)表实体类
+ *
+ * @author lihong
+ * @since 2025-03-21 09:37:49
+ */
+@SuppressWarnings("serial")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class ZdTaxClassCode  {
+    private String taxTimestamp;
+          
+    private Integer totalCount;
+          
+    private String parentCode;
+     /**
+     * 商品和服务税收分类合并编码
+     */     
+    private String taxSortCode;
+     /**
+     * 是否差额征税
+     */     
+    private String isDiffTax;
+     /**
+     * 是否征税
+     */     
+    private String isTax;
+     /**
+     * 商品和服务名称
+     */     
+    private String taxSortName;
+     /**
+     * 商品和服务分类简称
+     */     
+    private String taxShortName;
+     /**
+     * 说明
+     */     
+    private String remark;
+     /**
+     * 增值税税率
+     */     
+    private String vatRate;
+     /**
+     * 增值税政策依据
+     */     
+    private String vatPolicy;
+     /**
+     * 增值税特殊管理
+     */     
+    private String vatSpecialManage;
+     /**
+     * 征收率
+     */     
+    private String levyRate;
+     /**
+     * 增值税特殊内容代码
+     */     
+    private String vatSpecialCode;
+     /**
+     * 消费税管理
+     */     
+    private String consumTaxManage;
+     /**
+     * 消费税政策依据
+     */     
+    private String consumTaxPolicy;
+     /**
+     * 消费税特殊内容代码
+     */     
+    private String consumTaxSpecialCode;
+     /**
+     * 关键字
+     */     
+    private String keyword;
+     /**
+     * 是否汇总项
+     */     
+    private String isCollect;
+     /**
+     * 对应统计局编码 (2011年版)或国民行业代码
+     */     
+    private String statOfficeCode;
+     /**
+     * 停用日期
+     */     
+    private Date txEndDate;
+     /**
+     * 启用日期
+     */     
+    private Date txStartDate;
+     /**
+     * 海关进出口商品品目
+     */     
+    private String impoExpoCata;
+
+
+
+}
+

+ 4 - 1
src/main/java/cn/hnthyy/thmz/entity/his/zd/ZdUnitCode.java

@@ -76,7 +76,10 @@ public class ZdUnitCode {
     //科室描述
     private String deptDescribe;
     //夜诊地点
-    private String OfficePos1;
+    private String officePos1;
+    //医保科室
+    private String siCaty;
+    private String siCatyName;
     public ZdUnitCode(String code, String name) {
         this.code = code;
         this.name = name;

+ 39 - 0
src/main/java/cn/hnthyy/thmz/entity/jy/YbRegForRxParam.java

@@ -0,0 +1,39 @@
+package cn.hnthyy.thmz.entity.jy;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2025/1/10
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class YbRegForRxParam implements Serializable {
+    private static final long serialVersionUID =  1L;
+    private String staffId;
+    private String patientId;
+    private Integer times;
+    private String readCardResult;
+    //是否使用个人账户余额结算 1使用,0不使用 2.使用共济账户
+    private Integer acctUsedFlag;
+    //读卡类型 01-电子凭证 02-身份证 03-社保卡
+    private String readCardType;
+    private String expContent;
+    private String medType;
+    private String opspDisecode;
+    private String opspDiseName;
+    private String visitDate;
+    private String visitDeptCode;
+    private String doctorCode;
+    private String icdCodeNew;
+    private String icdTextNew;
+}

+ 33 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/ChargeDetailDTO.java

@@ -0,0 +1,33 @@
+package cn.hnthyy.thmz.entity.mzdzfp;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Description: 见续10 收费明细集合
+ * @Author:lihong
+ * @Date: 2025/3/13
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class ChargeDetailDTO implements Serializable {
+    private static final long serialVersionUID =  1L;
+
+   private Integer chargeDetailOrder;//住院收费明细序 号	BigDecimal	8	是
+   private Integer detailOrder;//	明细序号	java.math.BigDecimal	8	是
+   private String projectDetailName	;//	费用明细	String	100	是
+   private String count;//	数量	String	25	否
+   private String unit;//	单位	String	300	否
+   private BigDecimal amount;//	金额	BigDecimal	18,2	是
+   private BigDecimal taxRate;//	增值税税率/征收 率	BigDecimal	16,6	是
+   private BigDecimal taxAmount;//	税额	BigDecimal	18,2	是
+   private String medicalCode;//	医疗服务贯标码	String	50	否
+   private String remark;//	备注	String	100	否
+}

+ 34 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/FeeDetl.java

@@ -0,0 +1,34 @@
+package cn.hnthyy.thmz.entity.mzdzfp;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Description: 费用明细信息 续7
+ * @Author:lihong
+ * @Date: 2025/3/4
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class FeeDetl implements Serializable {
+   private static final long serialVersionUID =  1L;
+   private String feeOcurTime	;//	费用发生时间	DateTime		是	yyyy-MM-dd HH:mm:ss
+   private BigDecimal cnt	;//	数量	Decimal	16,4	是
+   private BigDecimal pric	;//	单价	Decimal	16,6	是
+   private BigDecimal detItemFeeSumamt	;//	明细项目费用总额	Decimal	16,2	是
+   private String medChrgitmType	;//	医疗收费项目类别	String	6	否
+   private String medListName	;//	医疗目录名称	String	50	否
+   private String medListCodg	;//	医疗目录编码	String	50	是
+   private String spec	;//	规格	String	200	否
+   private String chrgitmLv	;//	收费项目等级	String	3	否
+   private String hospApprFlag	;//	医院审批标志	String	3	否
+   private String memo	;//	备注	String	500	否
+
+}

+ 44 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/InvoiceDetail.java

@@ -0,0 +1,44 @@
+package cn.hnthyy.thmz.entity.mzdzfp;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Description:  发票明细集合 见续2
+ * @Author:lihong
+ * @Date: 2025/3/4
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class InvoiceDetail implements Serializable {
+  private static final long serialVersionUID =  1L;
+  private Integer blueSerialNo;//蓝字发票明细序号 开红字发票传
+  private Integer  serialNo ;//	明细序号	BigDecimal	8	是
+  private String  itemTypeName;//	商品服务简称	String	120	是
+  private String  itemName;//	项目名称	String	600	是
+  private String  spec;//	规格型号	String	150	否
+  private String  costDetails;//	费用明细	String	100	否	1 个汉字占用 3 个字符,最多可以上传 33 个汉字。
+  private String  unit;//	单位	String	300	否
+  private String  count;//	数量	String	25	否	如“单价”栏次 非空,则本栏次必须非空
+  private String  price;//	单价	String	25	否	如“数量”栏次 非空,则本栏次必须非空
+  private BigDecimal  amount;//	金额	BigDecimal	18,2	是
+  private BigDecimal  taxRate;//	增值税税率/征收 率	BigDecimal	16,6	是
+  private BigDecimal  taxAmount;//	税额	BigDecimal	18,2	是
+  private String  medicalCode;//	医疗服务贯标码	String	50	否
+  private String  otherInfo;//	其他	String	100	否	1 个汉字占用 3 个字符,最多可以上传 33 个汉字。
+  private BigDecimal  taxIncludedAmount;//	含税金额	BigDecimal	18,2	是
+  private BigDecimal  deductAmount;//	扣除额	BigDecimal	18,2	否
+  private String  itemTypeCode;//	商品和服务税收分类编码	String	19	是
+  private String  invoiceLineNature;//	发票行性质	String	2	是	00:正常行01:折扣行02:被折扣行
+    //	优惠政策标识	String	2	否
+    //	01:简易征收02:稀土产品03:免税04:不征税05:先征后退06:100%先征 后退07:50%先征 后退08:按 3%简易征收09:按 5%简易征收10:按 5%简易征 收 减 按1.5%计征11:即征即退 30%12:即征即退 50%13:即征即退 70%14:即征即退 100%15:超税负 3% 即征即退16:超税负 8% 即征即退17 : 超 税 负 12%即征即退18:超税负 6% 即征即退
+  private String  taxationType;
+
+}

+ 48 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/MdtrtInfo.java

@@ -0,0 +1,48 @@
+package cn.hnthyy.thmz.entity.mzdzfp;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.apache.poi.hpsf.Decimal;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Description: 就诊信息 续6
+ * @Author:lihong
+ * @Date: 2025/3/4
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class MdtrtInfo implements Serializable {
+  private static final long serialVersionUID =  1L;
+  private String  begntime;//	开始时间		DateTime		是
+  private String  endtime;//	结束时间		DateTime		是
+  private String  medType;//	医疗类别		String	6	是
+  private String  matnType;//	生育类别		String	6	否
+  private String  birctrlType;//	计划生育手术类别	;//	String	6	否
+  private Integer  fetts;//	胎次		Decimal	3	否
+  private Integer gesoVal;//	孕周数		Decimal	2	否
+  private Integer  fetusCnt;//	胎儿数		Decimal	3	否
+  private String  dieDate;//	死亡日期		Date		否
+  private String  medrcdno;//	病历号		String	30	否
+  private String  chfpdrCode;//	主诊医师代码		String	30	否
+  private String  chfpdrName;//	主诊医师姓名		String	50	否
+  private String  trtType;//	治疗类别		String	3	否
+  private String  dscgWay;//	离院方式		String	3	否
+  private Integer  ventUsedDays;//呼吸机使用天数		Decimal	3	否
+  private Integer  ventUsedHCnt;//	呼吸机使用小时数		Decimal	2	否
+  private Integer  ventUsedMCnt;//	呼吸机使用分钟数		Decimal	2	否
+  private BigDecimal spgaNurscareDays;//	特级护理天数		Decimal	11,1	否
+  private BigDecimal  lv1NurscareDays;//	一级护理天数		Decimal	11,1	否
+  private BigDecimal  scdNurscareDays;//	二级护理天数		Decimal	11,1	否
+  private BigDecimal  lv3NurscareDays;//	三级护理天数		Decimal	11,1	否
+  private String  spPsnType;//	特殊人员类型		String	6	否
+  private String  hiPaymtd;//	医保支付方式		String	3	否
+  private String  memo;//	备注 String	500	否
+
+}

+ 47 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/MzDzfpUpload.java

@@ -0,0 +1,47 @@
+package cn.hnthyy.thmz.entity.mzdzfp;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 电子发票结果
+ * @Author:lihong
+ * @Date: 2025/3/13
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName("mz_dzfp_upload")
+public class MzDzfpUpload implements Serializable {
+    private static final long serialVersionUID =  1L;
+
+   private String patientId;
+   private Integer times;
+   private Integer receiptNo;
+    /** 发票类型 1 门诊蓝字发票  2 门诊红字发票 3住院蓝字发票 4住院红字发票 */
+   private Integer typeFlag;
+   private String requestId;
+    /** 0 待开具 1 开具中 2 开具成功  3失败 */
+   private Integer resCode;
+    /** 二维码 */
+   private String qrcode;
+    /** 下载地址 */
+   private String resUrl;
+    /** 发票号 */
+   private String fpNo;
+    /** 操作员 编码 */
+   private String opId;
+    /** 开具日期 blue_issue_date*/
+   private String blueIssueDate;
+   private String resMessage;
+    /** pdf文档 */
+   private String pdfFileStr;
+    /** 0 有效 1作废 */
+   private Integer delFlag;
+}

+ 75 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/MzInvoiceInfo.java

@@ -0,0 +1,75 @@
+package cn.hnthyy.thmz.entity.mzdzfp;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2025/3/4
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class MzInvoiceInfo implements Serializable {
+    private static final long serialVersionUID =  1L;
+    private String 	usciCode;	//	社会统一信用代码	String	18	是
+    private	String requestId;	//	请求唯一标识	String	38	是	相同社会统一信用代码下,不允许重复
+    private	String invoiceType;	//	发票票种	String	2	是	01:增值税专用发票 02:普通发票
+    private	String buyerType;	//	购买方自然人标志	String	1	否	Y :购买方是自然人N :购买方非自然人
+    private	String diffTaxTypeCode;	//	差额征税类型代码	String	2	否	空:非差额发 票01:全额开票02:差额开票
+    private	String buyerUsciCode;	//	(购买方)统一 社会信用代码/纳 税人识别号/身份证件号码	String	20	否	长 度 15  到 20 位 , 由数字和大 写 字 母 组成。
+    private	String buyerUsciName;	//	(购买方)名称	String	300	是
+    private	String buyerAddress;	//	购买方地址	String	300	否
+    private	String buyerPhone;	//	购买方电话	String	60	否
+    private	String buyerBankName;	//	购买方开户行	String	120	否
+    private	String buyerBankAccount;	//	购买方账号	String	50	否
+    private	String buyerAgentName;	//	购买方经办人姓名	String	150	否
+    private	String buyerAgentIdNo;	//	购买方经办人证件号码	String	30	否
+    private	String buyerAgentPhone;	//	购买方经办人联系电话	String	60	否
+
+    private	String blueInvoiceNo;	//	蓝票发票号码	String	20	是
+
+    private	String blueIssueDate;	//	蓝字发票开票日期	datetime		是
+
+    private	String redOffsetCode;	//	红冲原因代码  01开票有误,02销货退回03服务终止,04销售折让
+    private BigDecimal amount;	//	合计金额	BigDecimal	18,2	是
+    private	BigDecimal taxAmount;	//	合计税额	BigDecimal	18,2	是
+    private	BigDecimal totalAmount;	//	价税合计	BigDecimal	18,2	是
+    private	String receiptBankName;	//	收款银行名称	String	120	否
+    private	String receiptBankAccount;	//	收款银行账号	String	100	否
+    private	String settleMethod;	//	结算方式	String	2	否	01:现金02:银行转账03:票据04:第三方支 付05:预付卡99:其他
+    private	String taxablePlace;	//	应税行为发生地	String	11	否
+    private	String issuer;	//	开票人	String	300	是
+    private	String issuerIdNo;	//	开票人证件号码	String	30	否
+    private	String issuerIdType;	//	开票人证件类型	String	4	否
+    private	String remark;	//	备注	String	450	否
+    private	String issueDate;	//	开票日期	datetime		是	格式:yyyy-MM-dd HH:mm:ss
+    private	String isSellerRemark;	//	是否展示销售方银行账号标签	String	1	否	Y:展示N:不展示
+    private	String isBuyerRemark;	//	是否展示购买方银行账号标签	String	1	否	Y:展示N:不展示
+    private	String payee;	//	收款人姓名	String	150	否
+    private	String reviewer;	//	复核人姓名	String	75	否
+    private	SpecialAttrDTO specialAttrDTO;	//	门诊特定要素集合	Obj		是	见续1
+    private List<InvoiceDetail> invoiceDetailList;	//	门诊发票明细集合	List		是	见续2
+    //	附加要素集合	List		否	见续3
+    // map元素 addFactorName	附加要素名称	String	200	否
+    // addFactorType	附加要素类型	String	200	否
+    //addFactorValue	附加要素值	String	200	否
+    private	List addFactorList;
+    private	List diffList;	//	差额扣除集合	List		否	见续4
+    private	SetlInfo setlInfo;	//	结算关系信息	Obj		是	见续5
+    private	MdtrtInfo mdtrtInfo;	//	就诊信息	Obj		是	见续6
+    private	List<FeeDetl> feeDetlInfo;	//	费用明细信息	List		是	见续7
+    private	List diagInfo;	//	诊断信息	List		否	见续8
+    private	List oprnInfo;	//	手术信息	List		否	见续9
+    private	List<ChargeDetailDTO> chargeDetailDTOList;	//	住院 收费明细集合 是
+
+
+}

+ 34 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/ResultInfo.java

@@ -0,0 +1,34 @@
+package cn.hnthyy.thmz.entity.mzdzfp;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 返回结果
+ * @Author:lihong
+ * @Date: 2025/3/4
+ */
+@Data
+public class ResultInfo implements Serializable {
+    private static final long serialVersionUID =  1L;
+    private String resultCode;
+    private String resultMessage;
+    private Object data;
+    /**  0000成功 9999失败 */
+    public static final String SUCCESS_CODE = "0000";
+    public static final String FAIL_CODE = "9999";
+
+    public ResultInfo(){
+
+    }
+    public ResultInfo(String resultCode,String resultMessage){
+        this.resultCode = resultCode;
+        this.resultMessage = resultMessage;
+    }
+    public ResultInfo(String resultCode,String resultMessage,Object data){
+        this.resultCode = resultCode;
+        this.resultMessage = resultMessage;
+        this.data = data;
+    }
+}

+ 43 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/SetlInfo.java

@@ -0,0 +1,43 @@
+package cn.hnthyy.thmz.entity.mzdzfp;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.apache.poi.hpsf.Decimal;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Description: 结算关系信息 续5
+ * @Author:lihong
+ * @Date: 2025/3/4
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class SetlInfo implements Serializable {
+   private static final long serialVersionUID =  1L;
+   private String  certSetlType ;//	凭证结算类型	String	3	是	1实时结算 2全自费
+   private String  fixBlngAdmdvs;//		参保地医保区划	String	6	否	医保结算票必填
+   private String  setlId;//		结算ID	String	30	否	医保结算票必填
+   private String  setlDate	;//	结算时间	DateTime		否	医保结算票必填, yyyy-MM-dd HH:mm:ss
+   private String  psnCode ;//	人员编号	String	30	否	医保结算票必填
+   private BigDecimal inscpAmt;//	符合范围金额	Decimal	16,2	否	医保结算票必填
+   private String  mainDiagCode;//	主要诊断代码	String	30	是
+   private String  mainDiagName;//	主要诊断名称	String	255	是
+   private String  secDiagCode;//	次要诊断代码	String	30	否
+   private String  secDiagName;//	次要诊断名称	String	255	否
+   private String  medType;//	医疗类别
+   private String  begntime;//	开始时间
+   private String  endtime;//	结束时间
+   private String  insutype;//	医保类型
+   private BigDecimal  insureFundPay;//	医保统筹基金支 付金额
+   private BigDecimal  otherPayAmount;//	其他支付金额
+   private BigDecimal  perAccoPayAmount;//	个人账户支付金 额
+   private BigDecimal  perCashPayAmount;//	个人现金支付金 额
+   private BigDecimal  perSelfPayAmount;//	个人自付金
+
+}

+ 60 - 0
src/main/java/cn/hnthyy/thmz/entity/mzdzfp/SpecialAttrDTO.java

@@ -0,0 +1,60 @@
+package cn.hnthyy.thmz.entity.mzdzfp;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description: 门诊特定要素集合 见续1
+ * @Author:lihong
+ * @Date: 2025/3/4
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class SpecialAttrDTO implements Serializable {
+  private static final long serialVersionUID =  1L;
+  private String medicalSerialNo;	//医疗业务流水号	String	40	是
+  private String patientName;	//患者姓名	String	150	是	1 个汉字占用 3 个字符,最多可以上传 50 个汉字。
+  private String patientIdTypeCode;	//患者身份证件类 型代码	String	3	是
+  private String patientIdNo;	//患者身份证件号 码	String	30	是
+  private String anamnesisNo;	// 住院	病历号	String	30	是
+  private String hospitalizationNo;//住院	住院号	String	20	否
+  private String hospitalDepartment;//住院	住院科别	String	100	是	1 个汉字占用 3 个字符,最多可以上传33 个汉字
+  private String admissionDate;//住院	住院时间起	datetime		否	格 式 必 须 为 “yyyymmdd”
+  private String dischargeDate;//住院	住院时间止	datetime		否	格 式 必 须 为 “yyyymmdd”
+  private BigDecimal advanceAmount;//住院	预缴金额	BigDecimal	18,4	否
+  private BigDecimal payBackAmount;//住院	补缴金额	BigDecimal	18,4	否
+  private BigDecimal refundAmount;//住院	退费金额	BigDecimal	18,4	否
+
+
+
+  private String medicalOrgTypeCode;	//	医疗机构类型代 码	String	4	否	医疗机构类型 代码详见“五、附件(一)医 疗机构类型代 码”
+  private String otherMedicalOrgType;	//	其他医疗机构类 型	String	100	否	填写上述医疗 机构类型代码 没有的类型, “医疗机构类  型代码”和“其 他医疗机构类 型”只能填写  一个。1 个汉字占用 3 个字符 ,最多可以上传 33 个汉字。
+  private String insureTypeCode;	//	医保类型代码	String	2	否	01:职工基本 医疗保险02:城乡居民 基本医疗保险03:离休04:其他医疗 保险05: 自费
+  private String otherInsureType;	//	其他医保类型	String	100	否	填写上述医保 类型代码没有 的类型,“医保 类 型 代 码 ” 和 “ 其 他 医 保 类型 ” 只能 填 写一个。1 个汉字占用 3 个字符 ,最多可以上传 33 个汉字。
+  private String insureNo;	//	医保编号	String	20	否
+  private String gender;	//	性别	String	1	是	1 :男2 :女
+  private BigDecimal insureFundPay;	//	医保统筹基金支 付金额	BigDecimal	18,4	否
+  private BigDecimal otherPayAmount;	//	其他支付金额	BigDecimal	18,4	否
+  private BigDecimal perAccoPayAmount;	//	个人账户支付金 额	BigDecimal	18,4	否
+  private BigDecimal perCashPayAmount;	//	个人现金支付金 额	BigDecimal	18,4	否
+  private BigDecimal perSelfPayAmount;	//	个人自付金额	BigDecimal	18,4	否
+  private BigDecimal perSelfExpenseAmount;	//	个人自费金额	BigDecimal	18,4	否
+
+  private String outpatientNo;	//	门诊号	String	16	是
+  private String payerName;	//	住院 交款人	String	100	否	住院收费明细 中的交款人.1 个汉字占用 3 个字符,最多可以上传33 个汉字。
+  private String recUnitName;	//	住院 收款单位	String	100	否	住院收费明细 中的收款单位。1 个汉字占用 3 个字符,最多可以上传33 个汉字。
+
+
+  private String outpatientVisitTime;	//	门诊就诊时间	datetime		是	格式必须为“ yyyy-mm-dd  hh:mm:ss”
+  private Integer pcCustEleCount;	//	省市自定义要素数量	BigDecimal	2	否	省市自定义要素数量,大于等于 0 的正整数
+  private List pcCustEleList;	//	省市自定义要素集合	List		否	见续1-1
+}

+ 4 - 0
src/main/java/cn/hnthyy/thmz/entity/thmz/Button.java

@@ -20,6 +20,10 @@ public class Button extends PageParams implements Serializable {
 	 * 退药code
 	 */
 	public static final String RE_DRUG = "re_drug";
+	/**
+	 * 诊疗退费code
+	 */
+	public static final String RE_ZL_ITEM = "re_zlItem";
 
 	/**
 	 * 主键

+ 28 - 0
src/main/java/cn/hnthyy/thmz/entity/thmz/Discount.java

@@ -113,6 +113,34 @@ public class Discount extends PageBean implements Serializable {
      * 套餐金额
      */
     private BigDecimal tcFee;
+    /**
+     * 活动时间类型  0 时间范围内一直执行  1 时间范围内每周执行  2 时间范围内每月几号执行 3每年几月几号
+     */
+    private String timeType;
+    /**
+     * 每周几  填 数字 1-7 1表示周日,2表示周一
+     */
+    private String weekDay;
+    /**
+     * 每月几号  填 数字 1-28
+     */
+    private String monthNum;
+    /**
+     * 几月几号  01-01 格式 MM-dd
+     */
+    private String monthDay;
+    /**
+     * 持续几天
+     */
+    private String alwaysDay;
+    /**
+     * 开始时间 HH:mm:ss
+     */
+    private String startTime;
+    /**
+     * 结束时间 HH:mm:ss
+     */
+    //private String endTime;
 
 
 }

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/thmz/ReceiptSerialFee.java

@@ -21,6 +21,8 @@ public class ReceiptSerialFee {
     private BigDecimal yhhdjzje;
     //GCP记账金额
     private BigDecimal gcpjzje;
+    //抖音团购
+    private BigDecimal dytgjzje;
     //银联卡的金额
     private BigDecimal ylkje;
     //聚合支付的金额

+ 4 - 0
src/main/java/cn/hnthyy/thmz/entity/thmz/WorkspaceConfig.java

@@ -53,6 +53,10 @@ public class WorkspaceConfig  implements Serializable {
 	 * 辅助资料 是否展示  0 展示 1 不展示
 	 */
 	private Integer fzZlFlag;
+	/**
+	 * 传染病史 是否展示  0 展示 1 不展示
+	 */
+	private Integer crbHistoryFlag;
 
 	/**
 	 * 婚育史 是否展示  0 展示 1 不展示

+ 74 - 0
src/main/java/cn/hnthyy/thmz/enums/InsutypeEnum.java

@@ -0,0 +1,74 @@
+package cn.hnthyy.thmz.enums;
+
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @description: 险种类型
+ * @author: DingJie
+ * @create: 2021/7/129:12
+ */
+public enum InsutypeEnum {
+
+    BASIC_MEDICAL_INSURANCE_FOR_EMPLOYEES("310","01", "职工基本医疗保险"),
+
+    MEDICAID_FOR_CIVIL_SERVANTS("320", "04","公务员医疗补助"),
+
+    LARGE_MEDICAL_EXPENSES_SUBSIDY("330", "04", "大额医疗费用补助"),
+
+    MEDICAL_SECURITY_FOR_RETIRED_PERSONNEL("340", "03", "离休人员医疗保障"),
+
+    MEDICAID_FOR_DISABLED_SOLDIERS("350", "04", "一至六级残废军人医疗补助"),
+
+    MEDICAID_FOR_ELDERLY_RED_ARMY("360", "04", "老红军医疗保障"),
+
+    ENTERPRISE_SUPPLEMENTARY_MEDICAL_INSURANCE("370", "04", "企业补充医疗保险"),
+
+    NEW_RURAL_COOPERATIVE_MEDICAL_SYSTEM("380", "04", "新型农村合作医疗"),
+
+    BASIC_MEDICAL_INSURANCE_FOR_RURAL_RESIDENTS("390", "02", "城乡居民基本医疗保险"),
+
+    BASIC_MEDICAL_INSURANCE_FOR_URBAN_RESIDENTS("391", "02", "城镇居民基本医疗保险"),
+
+    SERIOUS_ILLNESS_MEDICAL_INSURANCE_FOR_URBAN_AND_RURAL_RESIDENTS("392", "02", "城乡居民大病医疗保险"),
+
+    MEDICAL_SECURITY_FOR_OTHER_SPECIAL_PERSONNEL("399", "04", "其他特殊人员医疗保障"),
+
+    LONG_TERM_CARE_INSURANCE("410", "04", "长期照护保险"),
+
+    MATERNITY_INSURANCE("510", "04", "生育保险");
+
+    private final String code;
+    private final String dzfpCode;
+    private final String name;
+
+    InsutypeEnum(String code, String dzfpCode, String name) {
+        this.code = code;
+        this.dzfpCode = dzfpCode;
+        this.name = name;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getDzfpCode() {
+        return dzfpCode;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public static InsutypeEnum getByCode(String code){
+        List<InsutypeEnum> insutypes= Arrays.asList(values());
+        for (InsutypeEnum insutype:insutypes){
+            if(insutype.code.equals(code)){
+                return insutype;
+            }
+        }
+        return null;
+    }
+
+}

+ 8 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/ChargeFeeVoMapper.java

@@ -337,6 +337,10 @@ public interface ChargeFeeVoMapper {
                     "        when cheque_type ='K' then amount  " +
                     "        else 0  " +
                     "    end ) djjssk,"+
+                    "sum ( case  " +
+                    "        when cheque_type ='L' then amount  " +
+                    "        else 0  " +
+                    "    end ) dytgssk,"+
                     "sum ( amount) zjss," +
                     "sum ( case when pay_mark  <![CDATA[<>]]>'0'  then amount else 0 end ) zjtk," +
                     "sum ( case when ((cheque_type='W' or cheque_type='E' or cheque_type='Y') and op_id ='99999') then amount else 0 end ) wxzzss," +
@@ -346,6 +350,7 @@ public interface ChargeFeeVoMapper {
                     "count ( distinct case when cheque_type ='H' and pay_mark ='0' then receipt_sn else null end ) yhhdhs," +
                     "count ( distinct case when cheque_type ='I' and pay_mark ='0' then receipt_sn else null end ) gcphs," +
                     "count ( distinct case when cheque_type ='K' and pay_mark ='0' then receipt_sn else null end ) djjh," +
+                    "count ( distinct case when cheque_type ='L' and pay_mark ='0' then receipt_sn else null end ) dytgh," +
                     "count ( distinct case when cheque_type ='1' and pay_mark ='0' then receipt_sn else null end ) xjbs," +
                     "count ( distinct case when ( cheque_type ='5' or cheque_type ='3' ) and pay_mark ='0' then receipt_sn else null end ) yhsbs," +
                     "count ( distinct case when cheque_type ='6' and pay_mark ='0' then receipt_sn else null end ) sybbs," +
@@ -364,6 +369,7 @@ public interface ChargeFeeVoMapper {
                     "count ( distinct case when cheque_type ='H' and pay_mark = '1' then receipt_sn else null end ) yhhdth," +
                     "count ( distinct case when cheque_type ='I' and pay_mark = '1' then receipt_sn else null end ) gcphth," +
                     "count ( distinct case when cheque_type ='K' and pay_mark = '1' then receipt_sn else null end ) djjth," +
+                    "count ( distinct case when cheque_type ='L' and pay_mark = '1' then receipt_sn else null end ) dytgth," +
                     "   count ( distinct case when cheque_type = 'Y' and op_id <![CDATA[<>]]> '99999' and pay_mark &gt; '0'  then receipt_sn else null end ) zftfbs," +
                     "   count ( distinct case when (cheque_type ='2' or cheque_type ='8' or cheque_type ='9')  and pay_mark &gt; '0'  then receipt_sn else null end ) ybjztfbs," +
                     "count ( distinct case when pay_mark  <![CDATA[<>]]> '0' then cast(serial_no as char)+cheque_type else null end ) ztfbs," +
@@ -393,6 +399,8 @@ public interface ChargeFeeVoMapper {
                     "sum ( case when cheque_type ='K' and pay_mark ='1' then amount else 0 end ) djjtk," +
                     "sum ( case when cheque_type ='K' and pay_mark ='0' then amount else 0 end ) djjsk," +
                     "sum ( case when cheque_type ='1' and pay_mark ='0'  then amount else 0 end ) xjsk," +
+                    "sum ( case when cheque_type ='L' and pay_mark ='1' then amount else 0 end ) dytgtk," +
+                    "sum ( case when cheque_type ='L' and pay_mark ='0'  then amount else 0 end ) dytgsk," +
                     "sum ( case when cheque_type in ('5' ,'3') and pay_mark ='0' then amount else 0 end ) yhksk," +
                     "sum ( case when cheque_type='6' and pay_mark ='0' then amount else 0 end ) sybksk," +
                     "sum ( case when cheque_type = 'Y' and op_id <![CDATA[<>]]> '99999' and pay_mark ='0' then amount else 0 end ) zfsk," +

+ 1 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/mz/EmployeeMapper.java

@@ -68,7 +68,7 @@ public interface EmployeeMapper {
      * @return
      */
     //select top 1 rtrim(code) employeeCode,rtrim(name) employeeName,del_flag,rtrim(mark) mark,emp_tit_code,rtrim(code_rs)  code_rs,rtrim(dept_code) dept_code from a_employee_mi  where  code =#{code} and (del_flag is null or del_flag =0 )
-    @Select(" select top 1 rtrim(code) employeeCode,rtrim(name) employeeName,del_flag,rtrim(mark) mark,emp_tit_code,rtrim(code_rs)  code_rs,rtrim(dept_code) dept_code,rtrim(yb_code) yb_code from a_employee_mi WITH(NOLOCK) where  code =#{code} ")
+    @Select(" select top 1 rtrim(code) employeeCode,rtrim(name) employeeName,del_flag,rtrim(mark) mark,emp_tit_code,rtrim(code_rs)  code_rs,rtrim(dept_code) dept_code,rtrim(yb_code) yb_code,doctor_zy,dualchnl_flag from a_employee_mi WITH(NOLOCK) where  code =#{code} ")
     Employee selectByUserCode(@Param("code") String code);
 
 

+ 1 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzBillItemMapper.java

@@ -32,7 +32,7 @@ public interface MzBillItemMapper {
      * 住院收费发票码 原本的
      * @return
      */
-    @Select("SELECT code,name,py_code FROM zy_bill_item WITH(NOLOCK) order by code ")
+    @Select("SELECT code,name,py_code,charge_code FROM zy_bill_item WITH(NOLOCK) order by code ")
     List<BillItem> selectZyBillItemOri();
 
 

+ 7 - 4
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzBlRecordMapper.java

@@ -12,12 +12,12 @@ import java.util.Map;
 public interface MzBlRecordMapper {
     @Insert("insert into mz_bl_record(patient_id,times,emr_no,emr_type,visit_date,doctor_code,dept_code,first_or_not,emr_chief_complaint,emr_hpi,emr_ps,emr_pe,emr_fzjc," +
             "emr_process,emr_xyy,emr_yypg,emr_gnpg,emr_jkjy,personal_history,family_history,obsterical_history,weight,temperature,sphygmus,breathe,pressure_high," +
-            "pressure_floor,pressure_high_left,pressure_floor_left,tentative_diagnosis,prescription_detail,fz_zl) VALUES (#{patientId,jdbcType=CHAR}," +
+            "pressure_floor,pressure_high_left,pressure_floor_left,tentative_diagnosis,prescription_detail,fz_zl,crb_history) VALUES (#{patientId,jdbcType=CHAR}," +
             "#{times,jdbcType=INTEGER},#{emrNo,jdbcType=VARCHAR},#{emrType,jdbcType=CHAR},#{visitDate,jdbcType=TIMESTAMP},#{doctorCode,jdbcType=CHAR}," +
             "#{deptCode,jdbcType=VARCHAR},#{firstOrNot,jdbcType=CHAR},#{emrChiefComplaint,jdbcType=VARCHAR},#{emrHpi,jdbcType=VARCHAR},#{emrPs,jdbcType=VARCHAR}," +
             "#{emrPe,jdbcType=VARCHAR},#{emrFzjc,jdbcType=VARCHAR},#{emrProcess,jdbcType=VARCHAR},#{emrXyy,jdbcType=VARCHAR},#{emrYypg,jdbcType=VARCHAR}," +
             "#{emrGnpg,jdbcType=VARCHAR},#{emrJkjy,jdbcType=VARCHAR},#{personalHistory},#{familyHistory},#{obstericalHistory},#{weight},#{temperature},#{sphygmus}" +
-            ",#{breathe},#{pressureHigh},#{pressureFloor},#{pressureHighLeft},#{pressureFloorLeft},#{tentativeDiagnosis},#{prescriptionDetail},#{fzZl})")
+            ",#{breathe},#{pressureHigh},#{pressureFloor},#{pressureHighLeft},#{pressureFloorLeft},#{tentativeDiagnosis},#{prescriptionDetail},#{fzZl},#{crbHistory})")
     int insertMzBlRecord(MzBlRecord mzBlRecord);
 
 
@@ -39,7 +39,7 @@ public interface MzBlRecordMapper {
      */
     @Select("select patient_id,times,emr_no,emr_type,visit_date,doctor_code,dept_code,first_or_not,emr_chief_complaint," +
             "emr_hpi,emr_ps,emr_pe,emr_fzjc,emr_process,emr_xyy,emr_yypg,emr_gnpg,emr_jkjy,personal_history,family_history," +
-            "obsterical_history,weight,temperature,sphygmus,breathe,pressure_high,pressure_floor,pressure_high_left,pressure_floor_left,tentative_diagnosis,prescription_detail,fz_zl " +
+            "obsterical_history,weight,temperature,sphygmus,breathe,pressure_high,pressure_floor,pressure_high_left,pressure_floor_left,tentative_diagnosis,prescription_detail,fz_zl,crb_history " +
             " from mz_bl_record WITH(NOLOCK) where patient_id= #{patientId,jdbcType=VARCHAR} and times =#{times}")
     MzBlRecord selectMzBlRecordByPatientIdAndTimes(@Param("patientId") String patientId,@Param("times") Integer times);
 
@@ -121,7 +121,7 @@ public interface MzBlRecordMapper {
     @Select({"<script>",
             "select top ${pageSize} patient_id,times,emr_no,emr_type,visit_date,doctor_code,dept_code,first_or_not,emr_chief_complaint,",
             "emr_hpi,emr_ps,emr_pe,emr_fzjc,emr_process,emr_xyy,emr_yypg,emr_gnpg,emr_jkjy,personal_history,family_history," ,
-                    "obsterical_history,weight,temperature,sphygmus,breathe,pressure_high,pressure_floor,pressure_high_left,pressure_floor_left,tentative_diagnosis,prescription_detail,fz_zl " ,
+                    "obsterical_history,weight,temperature,sphygmus,breathe,pressure_high,pressure_floor,pressure_high_left,pressure_floor_left,tentative_diagnosis,prescription_detail,fz_zl,crb_history " ,
             " FROM (SELECT ROW_NUMBER() OVER (ORDER BY mz_bl_record_page.visit_date desc) AS RowNumber,",
             "* from dbo.mz_bl_record mz_bl_record_page WITH(NOLOCK) where 1=1 ",
             "<when test='patientIds!=null'>",
@@ -218,6 +218,9 @@ public interface MzBlRecordMapper {
             "<when test='fzZl!=null'>",
             ",fz_zl =#{fzZl}",
             "</when>",
+            "<when test='crbHistory!=null'>",
+            ",crb_history =#{crbHistory}",
+            "</when>",
             "</trim>"
             , "</script>"})
     int updateMzBlRecordEmrProcess(MzBlRecord mzBlRecord);

+ 73 - 12
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzChargeDetailMapper.java

@@ -111,7 +111,7 @@ public interface MzChargeDetailMapper {
             "instruction_text,order_days,rtrim(pay_self) pay_self,rtrim(try_flag) try_flag,rtrim(req_yj) req_yj,req_no,rtrim(group_type) group_type,order_bill,charge_bill_code,",
             "rtrim(self_flag) self_flag,rtrim(responce_type) responce_type,dec_amount,back_serial,input_time,cy_mtjs,cy_jsl,cy_zql,cy_fj,cy_ffcs,cy_fysm,supply_amount,rtrim(cy_jssm) cy_jssm,",
             "dept_no,gl_percent_ft,rtrim(yb_zf_flag) yb_zf_flag,orig_price,rtrim(try_result) try_result,rtrim(supply_exec) supply_exec,rtrim(cy_dj) cy_dj,rtrim(receive_flag) receive_flag,",
-            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id ",
+            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id,hosp_appr_flag ",
             "from dbo.mz_charge_detail WITH(NOLOCK) where pay_mark=#{payMark,jdbcType=CHAR} and patient_id =#{patientId,jdbcType=CHAR}  and times = #{times,jdbcType=INTEGER} and receipt_no=#{receiptNo,jdbcType=INTEGER}",
             "<choose>",
             "<when test='billItemCode==3'>",
@@ -253,7 +253,7 @@ public interface MzChargeDetailMapper {
             "instruction_text,order_days,rtrim(pay_self) pay_self,rtrim(try_flag) try_flag,rtrim(req_yj) req_yj,req_no,rtrim(group_type) group_type,order_bill,charge_bill_code,",
             "rtrim(self_flag) self_flag,rtrim(responce_type) responce_type,dec_amount,back_serial,input_time,cy_mtjs,cy_jsl,cy_zql,cy_fj,cy_ffcs,cy_fysm,supply_amount,rtrim(cy_jssm) cy_jssm,",
             "dept_no,gl_percent_ft,rtrim(yb_zf_flag) yb_zf_flag,orig_price,rtrim(try_result) try_result,rtrim(supply_exec) supply_exec,rtrim(cy_dj) cy_dj,rtrim(receive_flag) receive_flag,",
-            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id ",
+            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id,hosp_appr_flag ",
             "from dbo.mz_charge_detail WITH(NOLOCK) where  patient_id =#{patientId,jdbcType=CHAR} and times =#{times} and pay_mark = 5 ",
             "</script>"})
     List<MzChargeDetail> selectNotPayMzChargeDetailByPatientId(@Param("patientId") String patientId, @Param("times") Integer times);
@@ -332,7 +332,7 @@ public interface MzChargeDetailMapper {
             "instruction_text,order_days,rtrim(pay_self) pay_self,rtrim(try_flag) try_flag,rtrim(req_yj) req_yj,req_no,rtrim(group_type) group_type,order_bill,charge_bill_code,",
             "rtrim(self_flag) self_flag,rtrim(responce_type) responce_type,dec_amount,back_serial,input_time,cy_mtjs,cy_jsl,cy_zql,cy_fj,cy_ffcs,cy_fysm,supply_amount,rtrim(cy_jssm) cy_jssm,",
             "dept_no,gl_percent_ft,rtrim(yb_zf_flag) yb_zf_flag,orig_price,rtrim(try_result) try_result,rtrim(supply_exec) supply_exec,rtrim(cy_dj) cy_dj,rtrim(receive_flag) receive_flag,",
-            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id ",
+            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id,hosp_appr_flag ",
             "from dbo.${tableName} WITH(NOLOCK) where  patient_id =#{patientId,jdbcType=CHAR} and times =#{times,jdbcType=INTEGER}" +
                     "<choose>" +
                     "<when test='payMark!=null and payMark ==0 '>",
@@ -371,7 +371,7 @@ public interface MzChargeDetailMapper {
             "audit_code,gongnks_flag,print_flag,confirm_flag,warn_dept,jz_flag,group_order,cash_id,doctor_code,supply_code,frequency,drug_quan,drug_unit,doctor_flag,inject_res,inject_times," +
             "confirm_zs,real_no,windows_no_yf,ybbx_flag,tc_no,tc_name,detail_flag,gl_percent,order_type,supply_no,instruction_code,instruction_text,order_days,pay_self,try_flag,req_yj," +
             "req_no,group_type,order_bill,charge_bill_code,self_flag,responce_type,dec_amount,back_serial,input_time,cy_mtjs,cy_jsl,cy_zql,cy_fj,cy_ffcs,cy_fysm,supply_amount,cy_jssm," +
-            "dept_no,gl_percent_ft,yb_zf_flag,orig_price,try_result,supply_exec,cy_dj,receive_flag,chequ_type,print_flag_yj,confirm_flag_qx,group_id) " +
+            "dept_no,gl_percent_ft,yb_zf_flag,orig_price,try_result,supply_exec,cy_dj,receive_flag,chequ_type,print_flag_yj,confirm_flag_qx,group_id,hosp_appr_flag) " +
             " VALUES (#{patientId,jdbcType=CHAR},#{times,jdbcType=INTEGER},#{receiptNo,jdbcType=SMALLINT},#{orderNo,jdbcType=TINYINT},#{itemNo,jdbcType=TINYINT}," +
             "#{chargeItemCode,jdbcType=CHAR},#{billItemCode,jdbcType=CHAR},#{quantity,jdbcType=DOUBLE},#{unitPriceStr,jdbcType=DECIMAL},#{payMark,jdbcType=CHAR}," +
             "#{serial,jdbcType=CHAR},#{chargeItemType,jdbcType=CHAR},#{countryFlag,jdbcType=CHAR},#{drugFlag,jdbcType=CHAR},#{serialNo,jdbcType=INTEGER},#{name,jdbcType=CHAR}," +
@@ -386,7 +386,7 @@ public interface MzChargeDetailMapper {
             "#{chargeBillCode,jdbcType=VARCHAR},#{selfFlag,jdbcType=CHAR},#{responceType,jdbcType=CHAR},#{decAmount,jdbcType=DECIMAL},#{backSerial,jdbcType=INTEGER},#{inputTime,jdbcType=TIMESTAMP}," +
             "#{cyMtjs,jdbcType=SMALLINT},#{cyJsl,jdbcType=SMALLINT},#{cyZql,jdbcType=SMALLINT},#{cyFj,jdbcType=SMALLINT},#{cyFfcs,jdbcType=SMALLINT},#{cyFysm,jdbcType=SMALLINT}," +
             "#{supplyAmount,jdbcType=SMALLINT},#{cyJssm,jdbcType=CHAR},#{deptNo,jdbcType=VARCHAR},#{glPercentFt,jdbcType=DECIMAL},#{ybZfFlag,jdbcType=CHAR},#{origPriceStr,jdbcType=DECIMAL}," +
-            "#{tryResult,jdbcType=CHAR},#{supplyExec,jdbcType=CHAR},#{cyDj,jdbcType=CHAR},#{receiveFlag,jdbcType=CHAR},#{chequType,jdbcType=CHAR},#{printFlagYj,jdbcType=CHAR},#{confirmFlagQx,jdbcType=CHAR},#{groupId,jdbcType=CHAR}) ")
+            "#{tryResult,jdbcType=CHAR},#{supplyExec,jdbcType=CHAR},#{cyDj,jdbcType=CHAR},#{receiveFlag,jdbcType=CHAR},#{chequType,jdbcType=CHAR},#{printFlagYj,jdbcType=CHAR},#{confirmFlagQx,jdbcType=CHAR},#{groupId,jdbcType=CHAR},#{hospApprFlag,jdbcType=VARCHAR}) ")
     int insertMzChargeDetail(MzChargeDetail mzChargeDetail);
 
 
@@ -403,7 +403,7 @@ public interface MzChargeDetailMapper {
             "audit_code,gongnks_flag,print_flag,confirm_flag,warn_dept,jz_flag,group_order,cash_id,doctor_code,supply_code,frequency,drug_quan,drug_unit,doctor_flag,inject_res,inject_times,",
             "confirm_zs,real_no,windows_no_yf,ybbx_flag,tc_no,tc_name,detail_flag,gl_percent,order_type,supply_no,instruction_code,instruction_text,order_days,pay_self,try_flag,req_yj,",
             "req_no,group_type,order_bill,charge_bill_code,self_flag,responce_type,dec_amount,back_serial,input_time,cy_mtjs,cy_jsl,cy_zql,cy_fj,cy_ffcs,cy_fysm,supply_amount,cy_jssm,",
-            "dept_no,gl_percent_ft,yb_zf_flag,orig_price,try_result,supply_exec,cy_dj,receive_flag,chequ_type,print_flag_yj,confirm_flag_qx,group_id) VALUES ",
+            "dept_no,gl_percent_ft,yb_zf_flag,orig_price,try_result,supply_exec,cy_dj,receive_flag,chequ_type,print_flag_yj,confirm_flag_qx,group_id,hosp_appr_flag) VALUES ",
             "<foreach collection='mzChargeDetails' item='item' index='index' separator=','>",
             " (#{item.patientId,jdbcType=CHAR},#{item.times,jdbcType=INTEGER},#{item.receiptNo,jdbcType=SMALLINT},#{item.orderNo,jdbcType=TINYINT},#{item.itemNo,jdbcType=TINYINT},",
             "#{item.chargeItemCode,jdbcType=CHAR},#{item.billItemCode,jdbcType=CHAR},#{item.quantity,jdbcType=DOUBLE},#{item.unitPriceStr,jdbcType=DECIMAL},#{item.payMark,jdbcType=CHAR},",
@@ -419,7 +419,7 @@ public interface MzChargeDetailMapper {
             "#{item.chargeBillCode,jdbcType=VARCHAR},#{item.selfFlag,jdbcType=CHAR},#{item.responceType,jdbcType=CHAR},#{item.decAmount,jdbcType=DECIMAL},#{item.backSerial,jdbcType=INTEGER},#{item.inputTime,jdbcType=TIMESTAMP},",
             "#{item.cyMtjs,jdbcType=SMALLINT},#{item.cyJsl,jdbcType=SMALLINT},#{item.cyZql,jdbcType=SMALLINT},#{item.cyFj,jdbcType=SMALLINT},#{item.cyFfcs,jdbcType=SMALLINT},#{item.cyFysm,jdbcType=SMALLINT},",
             "#{item.supplyAmount,jdbcType=SMALLINT},#{item.cyJssm,jdbcType=CHAR},#{item.deptNo,jdbcType=VARCHAR},#{item.glPercentFt,jdbcType=DECIMAL},#{item.ybZfFlag,jdbcType=CHAR},#{item.origPriceStr,jdbcType=DECIMAL},",
-            "#{item.tryResult,jdbcType=CHAR},#{item.supplyExec,jdbcType=CHAR},#{item.cyDj,jdbcType=CHAR},#{item.receiveFlag,jdbcType=CHAR},#{item.chequType,jdbcType=CHAR},#{item.printFlagYj,jdbcType=CHAR},#{item.confirmFlagQx,jdbcType=CHAR},#{item.groupId,jdbcType=CHAR}) ",
+            "#{item.tryResult,jdbcType=CHAR},#{item.supplyExec,jdbcType=CHAR},#{item.cyDj,jdbcType=CHAR},#{item.receiveFlag,jdbcType=CHAR},#{item.chequType,jdbcType=CHAR},#{item.printFlagYj,jdbcType=CHAR},#{item.confirmFlagQx,jdbcType=CHAR},#{item.groupId,jdbcType=CHAR},#{item.hospApprFlag,jdbcType=VARCHAR}) ",
             "</foreach>",
             "</script>"
     })
@@ -568,7 +568,7 @@ public interface MzChargeDetailMapper {
             "instruction_text,order_days,rtrim(pay_self) pay_self,rtrim(try_flag) try_flag,rtrim(req_yj) req_yj,req_no,rtrim(group_type) group_type,order_bill,charge_bill_code,",
             "rtrim(self_flag) self_flag,rtrim(responce_type) responce_type,dec_amount,back_serial,input_time,cy_mtjs,cy_jsl,cy_zql,cy_fj,cy_ffcs,cy_fysm,supply_amount,rtrim(cy_jssm) cy_jssm,",
             "dept_no,gl_percent_ft,rtrim(yb_zf_flag) yb_zf_flag,orig_price,rtrim(try_result) try_result,rtrim(supply_exec) supply_exec,rtrim(cy_dj) cy_dj,rtrim(receive_flag) receive_flag,",
-            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id ",
+            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id,hosp_appr_flag ",
             "from dbo.mz_charge_detail WITH(NOLOCK) where patient_id =#{patientId,jdbcType=CHAR} and pay_mark=0  and times =#{times} and  receipt_no =#{receiptNo} ",
             "</script>"})
     List<MzChargeDetail> selectJiZhangDetails(@Param(value = "patientId") String patientId, @Param("times") Integer times, @Param("receiptNo") Integer receiptNo);
@@ -840,7 +840,7 @@ public interface MzChargeDetailMapper {
             "instruction_text,order_days,rtrim(pay_self) pay_self,rtrim(try_flag) try_flag,rtrim(req_yj) req_yj,req_no,rtrim(group_type) group_type,order_bill,charge_bill_code,",
             "rtrim(self_flag) self_flag,rtrim(responce_type) responce_type,dec_amount,back_serial,input_time,cy_mtjs,cy_jsl,cy_zql,cy_fj,cy_ffcs,cy_fysm,supply_amount,rtrim(cy_jssm) cy_jssm,",
             "dept_no,gl_percent_ft,rtrim(yb_zf_flag) yb_zf_flag,orig_price,rtrim(try_result) try_result,rtrim(supply_exec) supply_exec,rtrim(cy_dj) cy_dj,rtrim(receive_flag) receive_flag,",
-            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id ",
+            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id,hosp_appr_flag ",
             "from dbo.mz_charge_detail WITH(NOLOCK)  where  patient_id =#{patientId,jdbcType=CHAR} and times =#{times} and receipt_no =#{receiptNo} ",
             "</script>"})
     List<MzChargeDetail> selectByPatientIdAndTimesAndReceiptNo(@Param("patientId") String patientId, @Param("times") Integer times, @Param("receiptNo") Integer receiptNo);
@@ -874,11 +874,11 @@ public interface MzChargeDetailMapper {
             "SELECT c.patient_id,c.times,c.receipt_no,c.order_no,c.real_no,c.bill_item_code," +
             "c.group_no,c.charge_item_code,c.serial,c.warn_dept,c.price_time,c.doctor_code,c.confirm_id," +
             "c.quantity,c.drug_quan,c.frequency,c.charge_item_code,c.drug_unit,c.supply_code,c.doctor_code," +
-            "c.unit_price,c.yb_zf_flag,c.jz_flag,instruction_text,try_result,try_flag,c.pay_self,  " +
+            "c.unit_price,c.yb_zf_flag,c.jz_flag,c.instruction_code,c.instruction_text,c.try_result,c.try_flag,c.pay_self,  " +
             " (case when y.class_code = '210100' then 1 else 0 end ) as is_hide,c.print_flag,c.drug_win,cy_jssm,cy_mtjs,cy_jsl,cy_zql,cy_fj,cy_ffcs,cy_fysm,rtrim(cy_dj)cy_dj" +
             "    FROM mz_charge_detail c WITH(NOLOCK) ,yp_zd_dict y WITH(NOLOCK) " +
             " where  1=1 " +
-            " and c.charge_item_code = y.code and c.serial = y.serial" +
+            " and c.charge_item_code = y.code and c.serial = y.serial and c.pay_mark = '0' " +
             "<when test='patientId!=null'>" +
             " and c.patient_id =#{patientId}" +
             "</when>" +
@@ -1160,7 +1160,7 @@ public interface MzChargeDetailMapper {
             "instruction_text,order_days,rtrim(pay_self) pay_self,rtrim(try_flag) try_flag,rtrim(req_yj) req_yj,req_no,rtrim(group_type) group_type,order_bill,charge_bill_code,"+
             "rtrim(self_flag) self_flag,rtrim(responce_type) responce_type,dec_amount,back_serial,input_time,cy_mtjs,cy_jsl,cy_zql,cy_fj,cy_ffcs,cy_fysm,supply_amount,rtrim(cy_jssm) cy_jssm,"+
             "dept_no,gl_percent_ft,rtrim(yb_zf_flag) yb_zf_flag,orig_price,rtrim(try_result) try_result,rtrim(supply_exec) supply_exec,rtrim(cy_dj) cy_dj,rtrim(receive_flag) receive_flag,"+
-            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id "+
+            "rtrim(chequ_type) chequ_type,rtrim(print_flag_yj) print_flag_yj,rtrim(confirm_flag_qx) confirm_flag_qx,group_id,hosp_appr_flag "+
             " from  mz_charge_detail where patient_id=#{patientId} and pay_mark = 0 and confirm_flag<>4 and DateDiff(dd,charge_date,getDate()) =0 and group_no in('71','81','82') ")
     List<MzChargeDetail> selectCurrentYpList(@Param("patientId") String patientId);
 
@@ -1183,4 +1183,65 @@ public interface MzChargeDetailMapper {
     void updateCashIdByPatientId(@Param("userIdCode") String userIdCode, @Param("mzDepositFileVo") MzDepositFileVo mzDepositFileVo);
     @Delete(" delete from  mz_charge_detail where patient_id =#{patientId} and times = #{times} ")
     int deleteChargeDetailByPatientIdAndTimes(@Param("patientId") String patientId, @Param("times")Integer times);
+    /**
+     * @description: 获取指引单项目指引数据
+     * @author: lihong
+     * @date: 2025/1/16 16:28
+     * @param: patientId
+     * @param: times
+     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
+     **/
+    @Select(" select type='诊疗服务',c.name name,c.office_pos address  " +
+            "from mz_charge_detail a,zd_charge_item b,zd_unit_code c  " +
+            "where patient_id=#{patientId} and times=#{times} and req_no=0  " +
+            "  and a.charge_item_code=b.code  " +
+            "  and a.exec_dept=c.code  " +
+            "  and c.office_pos is not null  " +
+            "  and a.exec_dept!='2060500'  " +
+            "group by c.name,c.office_pos  " +
+            "union all  " +
+            "select type='检查',c.name name,d.office_pos address  " +
+            "from mz_yj_req a,jc_zd_item b,jc_zd_class c,zd_unit_code d  " +
+            "where patient_id=#{patientId} and times=#{times}  " +
+            "  and a.order_code=b.code  " +
+            "  and b.class=c.code  " +
+            "  and a.exec_dept=d.code  " +
+            "  and d.office_pos is not null  " +
+            "group by c.name,a.exec_dept,d.office_pos  " +
+            "union all  " +
+            "select type='药品',c.group_name name,c.office_pos address  " +
+            "from mz_charge_detail a,yp_zd_group_name c  " +
+            "where patient_id=#{patientId} and times=#{times}  " +
+            "  and a.group_no=c.group_no  " +
+            "group by c.group_name,c.office_pos  " +
+            "union all  " +
+            "select type='检验化验',d.name name,(select office_pos from zd_unit_code where code=a.exec_dept) address  " +
+            "from mz_yj_req a,jy_zd_item b,zd_unit_code d  " +
+            "where patient_id=#{patientId} and times=#{times}  " +
+            "  and a.order_code=b.code  " +
+            "  and a.exec_dept=d.code  " +
+            "group by a.exec_dept,d.name  " +
+            "order by type,address,name ")
+    List<Map<String, Object>> getChargeDetailForGuideCard(@Param("patientId") String patientId, @Param("times") Integer times);
+    /**
+     * @description: 查询优惠后 和 未优惠的金额
+     * @author: lihong
+     * @date: 2025/3/7 16:14
+     * @param: patientId
+     * @param: times
+     * @return: cn.hnthyy.thmz.entity.his.mz.MzChargeDetail
+     **/
+    @Select(" select sum((case " +
+            "                when convert(decimal(18, 2), unit_price) = 0.00 then 0.00 " +
+            "                else convert(decimal(18, 2), unit_price) end) * quantity * drug_win) amount, " +
+            "       sum((case " +
+            "                when convert(decimal(18, 2), orig_price) = 0.00 then 0.00 " +
+            "                else convert(decimal(18, 2), orig_price) end) * quantity * drug_win) not_discount_amount " +
+            " from mz_charge_detail " +
+            " where patient_id = #{patientId} " +
+            "  and times = #{times} ")
+    MzChargeDetail selectSumTotalFee(@Param("patientId") String patientId, @Param("times")Integer times);
+
+    @Update("update ${tableName} set tf_flag =#{tfFlag} where patient_id =#{patientId}  and times=#{times} and abs(receipt_no) =#{receiptNo} ")
+    int updateTfFlag(@Param("patientId") String patientId, @Param("times") Integer times, @Param("tfFlag") Integer tfFlag, @Param("receiptNo")Integer receiptNo, @Param("tableName") String tableName);
 }

+ 18 - 5
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzDepositFileMapper.java

@@ -20,11 +20,11 @@ public interface MzDepositFileMapper {
      * @return
      */
     @Insert("INSERT INTO  mz_deposit_file(patient_id,times,receipt_no,pay_mark,cheque_type,cheque_no,amount,charge_date,dcount_date,dcount_no," +
-            "op_id,receipt_sn,serial_no,responce_type,yb_jlh,yb_ywh,dept_no,psordnum,agtordnum,hisrefundnum,contract_id,par_channel,trans_date,trace_no) VALUES (#{patientId,jdbcType=CHAR}," +
+            "op_id,receipt_sn,serial_no,responce_type,yb_jlh,yb_ywh,dept_no,psordnum,agtordnum,hisrefundnum,contract_id,par_channel,trans_date,trace_no,warn_code,doctor_code) VALUES (#{patientId,jdbcType=CHAR}," +
             "#{times,jdbcType=INTEGER},#{receiptNo,jdbcType=SMALLINT},#{payMark,jdbcType=CHAR},#{chequeType,jdbcType=CHAR},#{chequeNo,jdbcType=CHAR}" +
             ",#{amountStr,jdbcType=DECIMAL},#{chargeDate,jdbcType=TIMESTAMP},#{dcountDate,jdbcType=TIMESTAMP},#{dcountNo,jdbcType=CHAR},#{opId,jdbcType=CHAR}," +
             "#{receiptSn,jdbcType=INTEGER},#{serialNo,jdbcType=INTEGER},#{responceType,jdbcType=CHAR},#{ybJlh,jdbcType=VARCHAR},#{ybYwh,jdbcType=VARCHAR}," +
-            "#{deptNo,jdbcType=VARCHAR},#{psordnum,jdbcType=VARCHAR},#{agtordnum,jdbcType=VARCHAR},#{hisrefundnum,jdbcType=VARCHAR},#{contractId},#{parChannel},#{transDate},#{traceNo})")
+            "#{deptNo,jdbcType=VARCHAR},#{psordnum,jdbcType=VARCHAR},#{agtordnum,jdbcType=VARCHAR},#{hisrefundnum,jdbcType=VARCHAR},#{contractId},#{parChannel},#{transDate},#{traceNo},#{warnCode},#{doctorCode})")
     int insertMzDepositFile(MzDepositFile mzDepositFile);
 
 
@@ -37,17 +37,29 @@ public interface MzDepositFileMapper {
     @Insert({
             "<script>",
             "INSERT INTO mz_deposit_file(patient_id,times,receipt_no,pay_mark,cheque_type,cheque_no,amount,charge_date,dcount_date,dcount_no,",
-            "op_id,receipt_sn,serial_no,responce_type,yb_jlh,yb_ywh,dept_no,psordnum,agtordnum,hisrefundnum,contract_id,par_channel,trans_date,trace_no) VALUES ",
+            "op_id,receipt_sn,serial_no,responce_type,yb_jlh,yb_ywh,dept_no,psordnum,agtordnum,hisrefundnum,contract_id,par_channel,trans_date,trace_no,warn_code,doctor_code) VALUES ",
             "<foreach collection='mzDepositFileList' item='item' index='index' separator=','>",
             " (#{item.patientId,jdbcType=CHAR},#{item.times,jdbcType=INTEGER},#{item.receiptNo,jdbcType=SMALLINT},#{item.payMark,jdbcType=CHAR},#{item.chequeType,jdbcType=CHAR},#{item.chequeNo,jdbcType=CHAR}",
             ",#{item.amountStr,jdbcType=DECIMAL},#{item.chargeDate,jdbcType=TIMESTAMP},#{item.dcountDate,jdbcType=TIMESTAMP},#{item.dcountNo,jdbcType=CHAR},#{item.opId,jdbcType=CHAR},",
             "#{item.receiptSn,jdbcType=INTEGER},#{item.serialNo,jdbcType=INTEGER},#{item.responceType,jdbcType=CHAR},#{item.ybJlh,jdbcType=VARCHAR},#{item.ybYwh,jdbcType=VARCHAR},",
-            "#{item.deptNo,jdbcType=VARCHAR},#{item.psordnum,jdbcType=VARCHAR},#{item.agtordnum,jdbcType=VARCHAR},#{item.hisrefundnum,jdbcType=VARCHAR},#{item.contractId},#{item.parChannel},#{item.transDate},#{item.traceNo}) ",
+            "#{item.deptNo,jdbcType=VARCHAR},#{item.psordnum,jdbcType=VARCHAR},#{item.agtordnum,jdbcType=VARCHAR},#{item.hisrefundnum,jdbcType=VARCHAR},#{item.contractId},#{item.parChannel},#{item.transDate},#{item.traceNo},#{item.warnCode},#{item.doctorCode}) ",
             "</foreach>",
             "</script>"
     })
     int batchInsertMzDepositFile(@Param(value = "mzDepositFileList") List<MzDepositFile> mzDepositFileList);
 
+    @Update(" update ${tableName}" +
+            " set warn_code   =b.warn_dept," +
+            "    doctor_code =b.doctor_code" +
+            " from (" +
+            "         select top 1 warn_dept, doctor_code, patient_id pat_no, times p_times" +
+            "         from mz_charge_detail" +
+            "         where patient_id = #{patientId}" +
+            "           and times = #{times}" +
+            "     ) b" +
+            " where patient_id = pat_no" +
+            "  and times = p_times ")
+    int updateWarnCodeAndDoctorCode(@Param("patientId") String patientId, @Param("times") Integer times,@Param("tableName") String tableName);
 
 //    /**
 //     * 查询所有的记账记录
@@ -245,7 +257,7 @@ public interface MzDepositFileMapper {
             "SELECT top ${pageSize} rtrim(patient_id) patient_id,times,receipt_no,rtrim(pay_mark) pay_mark,rtrim(cheque_type) cheque_type,rtrim(cheque_no) cheque_no,",
             "amount,charge_date,dcount_date,rtrim(dcount_no) dcount_no,rtrim(op_id) op_id,receipt_sn,serial_no,rtrim(responce_type) responce_type,yb_jlh,yb_ywh,dept_no,",
             "psordnum,agtordnum,hisrefundnum,contract_id,par_channel,trans_date,trace_no FROM (SELECT ROW_NUMBER() OVER (ORDER BY mz_deposit_file_page.${orderByCase} desc) ",
-            "AS RowNumber,* from ${tableName} mz_deposit_file_page WITH(NOLOCK) where 1=1 ",
+            "AS RowNumber,* from ${tableName} mz_deposit_file_page WITH(NOLOCK) where pay_mark != '2' ",
             "<when test='patientId!=null'>",
             " and patient_id =#{patientId}",
             "</when>",
@@ -382,4 +394,5 @@ public interface MzDepositFileMapper {
     void updateOpIdByPatientId(@Param("deptNo") String deptNo, @Param("userIdCode")String userIdCode, @Param("mzDepositFileVo") MzDepositFileVo mzDepositFileVo);
     @Select(" select sum(amount) from  mz_deposit_file where patient_id =#{patientId} and times =#{times} and abs(receipt_no) < #{receiptNo} ")
     BigDecimal selectBeforeReceiptNo(@Param("patientId") String patientId, @Param("times")Integer times, @Param("receiptNo")Integer receiptNo);
+
 }

+ 187 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzDrugTracCodgMapper.java

@@ -0,0 +1,187 @@
+package cn.hnthyy.thmz.mapper.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.MzDrugTracCodg;
+import cn.hnthyy.thmz.vo.MzSendMedicineVo;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface MzDrugTracCodgMapper {
+
+    @Delete("delete from mz_drug_trac_codg " +
+            " where patient_id=#{patientId,jdbcType=VARCHAR} " +
+            "   and times = #{times,jdbcType=INTEGER} " +
+            "   and receipt_no = #{receiptNo,jdbcType=SMALLINT} " +
+            "   and item_no = #{itemNo,jdbcType=TINYINT} ")
+    void deleteMzDrugTracCodg(@Param("patientId") String patientId, @Param("times") int times, @Param("receiptNo") int receiptNo, @Param("itemNo") int itemNo);
+
+    @Insert({
+        "<script>",
+        "insert into mz_drug_trac_codg(drug_trac_codg,patient_id,times,receipt_no,order_no,item_no,charge_item_code,serial,flag,group_no,",
+        "confirm_time,confirm_id,confirm_name,real_no,drug_name,specification,abbr_name,unit_price) values ",
+        "<foreach collection='list' item='item' index='index' separator=','>",
+        " (#{item.drugTracCodg,jdbcType=VARCHAR},#{item.patientId,jdbcType=VARCHAR},#{item.times,jdbcType=INTEGER},#{item.receiptNo,jdbcType=SMALLINT},",
+        "#{item.orderNo,jdbcType=TINYINT},#{item.itemNo,jdbcType=TINYINT},#{item.chargeItemCode,jdbcType=VARCHAR},#{item.serial,jdbcType=VARCHAR},",
+        "#{item.flag,jdbcType=VARCHAR},#{item.groupNo,jdbcType=VARCHAR},#{item.confirmTime,jdbcType=TIMESTAMP},#{item.confirmId,jdbcType=VARCHAR},",
+        "#{item.confirmName,jdbcType=VARCHAR},#{item.realNo,jdbcType=INTEGER},#{item.drugName,jdbcType=VARCHAR},#{item.specification,jdbcType=VARCHAR},",
+        "#{item.abbrName,jdbcType=VARCHAR},#{item.unitPrice,jdbcType=VARCHAR}) ",
+        "</foreach>",
+        "</script>"
+    })
+    int insertMzDrugTracCodgData(@Param(value = "list") List<MzDrugTracCodg> list);
+
+    @Insert({
+            "<script>",
+            "insert into mz_drug_trac_codg_ty(drug_trac_codg,patient_id,times,receipt_no,order_no,item_no,charge_item_code,serial,flag,group_no,",
+            "confirm_time,confirm_id,confirm_name,real_no,drug_name,specification,abbr_name,unit_price) values ",
+            "<foreach collection='list' item='item' index='index' separator=','>",
+            " (#{item.drugTracCodg,jdbcType=VARCHAR},#{item.patientId,jdbcType=VARCHAR},#{item.times,jdbcType=INTEGER},#{item.receiptNo,jdbcType=SMALLINT},",
+            "#{item.orderNo,jdbcType=TINYINT},#{item.itemNo,jdbcType=TINYINT},#{item.chargeItemCode,jdbcType=VARCHAR},#{item.serial,jdbcType=VARCHAR},",
+            "#{item.flag,jdbcType=VARCHAR},#{item.groupNo,jdbcType=VARCHAR},#{item.confirmTime,jdbcType=TIMESTAMP},#{item.confirmId,jdbcType=VARCHAR},",
+            "#{item.confirmName,jdbcType=VARCHAR},#{item.realNo,jdbcType=INTEGER},#{item.drugName,jdbcType=VARCHAR},#{item.specification,jdbcType=VARCHAR},",
+            "#{item.abbrName,jdbcType=VARCHAR},#{item.unitPrice,jdbcType=VARCHAR}) ",
+            "</foreach>",
+            "</script>"
+    })
+    void insertDrugTracCodgTyData(@Param(value = "list") List<MzDrugTracCodg> list);
+
+    @Select("<script>" +
+            " select * from mz_drug_trac_codg " +
+            "where patient_id = #{patientId,jdbcType=VARCHAR} " +
+            "and times = #{times,jdbcType=INTEGER} " +
+            "and receipt_no = #{receiptNo,jdbcType=SMALLINT} " +
+            "and order_no = #{orderNo,jdbcType=TINYINT} " +
+            "and group_no = #{groupNo,jdbcType=VARCHAR} " +
+            "<when test='chargeItemCode != null'>" +
+            " and charge_item_code =#{chargeItemCode,jdbcType=VARCHAR}" +
+            "</when>" +
+            "<when test='serial != null'>" +
+            " and serial = #{serial,jdbcType=VARCHAR} " +
+            "</when>" +
+            "<when test='realNo != null'>" +
+            " and real_no =#{realNo,jdbcType=INTEGER}" +
+            "</when>" +
+            "</script>")
+    List<MzDrugTracCodg> selectMzDrugTracCodgData(MzDrugTracCodg codg);
+
+    @Select("<script>" +
+            " select * from mz_drug_trac_codg_ty " +
+            "where patient_id = #{patientId,jdbcType=VARCHAR} " +
+            "and times = #{times,jdbcType=INTEGER} " +
+            "and receipt_no = #{receiptNo,jdbcType=SMALLINT} " +
+            "and order_no = #{orderNo,jdbcType=TINYINT} " +
+            "and group_no = #{groupNo,jdbcType=VARCHAR} " +
+            "<when test='chargeItemCode != null'>" +
+            " and charge_item_code =#{chargeItemCode,jdbcType=VARCHAR}" +
+            "</when>" +
+            "<when test='serial != null'>" +
+            " and serial = #{serial,jdbcType=VARCHAR} " +
+            "</when>" +
+            "<when test='realNo != null'>" +
+            " and real_no =#{realNo,jdbcType=INTEGER}" +
+            "</when>" +
+            "</script>")
+    List<MzDrugTracCodg> selectMzDrugTracCodgTyData(MzDrugTracCodg codg);
+
+    @Select({"<script>" +
+            "SELECT rtrim(a.patient_id) patient_id,   " +
+            "         a.price_time,   " +
+            "         a.times,   " +
+            "         a.receipt_no,   " +
+            "         a.name  ," +
+            "         a.order_no," +
+            "         a.item_no," +
+            "         drugname=case when a.pay_self='1' then '(免发)' else '' end  + c.name," +
+            "         drug_flag=c.drug_flag," +
+            "         specification=c.specification," +
+            "         a.supply_code," +
+            "         a.frequency," +
+            "         a.drug_quan," +
+            "         drug_unit=case when a.group_no in ('81', '83') then c.pack_unit else isnull(a.drug_unit,'') end," +
+            "         yp_unit=c.pack_unit," +
+            "         c.mini_unit," +
+            "         c.national_code," +
+            "         a.order_days," +
+            "         doctor_code=a.doctor_code," +
+            "         a.charge_date," +
+            "         b.location," +
+            "         quantity=a.quantity," +
+            "         a.unit_price," +
+            "         serial_no," +
+            "         responce_type," +
+            "         a.country_flag," +
+            "         a.bill_item_code," +
+            "         rtrim(a.charge_item_code)charge_item_code," +
+            "         a.input_id," +
+            "         a.input_date," +
+            "         a.group_no," +
+            "         a.serial," +
+            "         a.self_flag," +
+            "         a.drug_win," +
+            "         a.warn_dept, " +
+            "         confirm_flag=case when isnull(b.stock_amount,0) <![CDATA[>=]]> round(quantity * drug_win,2) then '1'else '0'end," +
+            "         infusion=c.infusion_flag," +
+            "         zj_flag=c.zj_flag," +
+            "         zs_flag=''," +
+            "         tc_no=a.tc_no," +
+            "         cash_id," +
+            "         confirm_zs," +
+            "         a.windows_no_yf," +
+            "         a.instruction_code," +
+            "         a.instruction_text," +
+            "         doctor_flag=isnull(a.doctor_flag,'')," +
+            "         pay_self=isnull(a.pay_self,'')," +
+            "         a.group_order," +
+            "         try_flag," +
+            "         yf_no=a.back_serial," +
+            "         real_no=a.real_no," +
+            "         cy_mtjs=a.cy_mtjs," +
+            "         cy_jsl=a.cy_jsl," +
+            "         cy_zql=a.cy_zql," +
+            "         cy_fj=a.cy_fj  ," +
+            "         cy_ffcs=a.cy_ffcs," +
+            "         cy_fysm=a.cy_fysm," +
+            "         cy_jssm=a.cy_jssm," +
+            "         cy_dj=a.cy_dj," +
+            "         b.location," +
+            "         a.jz_flag," +
+            "         a.group_type," +
+            "         dec_amount=-a.dec_amount," +
+            "         pack_unit = c.pack_unit," +
+            "         stock_amount = isnull(b.stock_amount,0)," +
+            "         abbr_name=case when isnull(d.abbr_name,'')='' then d.name else d.abbr_name end," +
+            "         try_result = a.try_result," +
+            "         yb_zf_flag=a.yb_zf_flag," +
+            "         a.confirm_id," +
+            "         print_flag_yj=isnull(a.print_flag_yj,'')," +
+            "         confirm_flag_b=confirm_flag," +
+            "         a.manu_no " +
+            "    FROM mz_charge_detail a WITH(NOLOCK), yp_base_yf b WITH(NOLOCK),yp_zd_dict c WITH(NOLOCK),yp_zd_manufactory d WITH(NOLOCK)" +
+            " where   a.patient_id=#{patientId} and" +
+            "         a.times     =#{times} and" +
+            "         a.receipt_no=#{receiptNo} and" +
+            "         a.order_no =#{orderNo}   and" +
+            "         a.charge_item_code =b.charge_code and " +
+            "         a.serial   =b.serial and " +
+            "         b.group_no =#{groupNo} and  " +
+            "         b.group_no =a.group_no and  " +
+            "         a.bill_item_code <![CDATA[<>]]>'TC' and" +
+            "         a.charge_item_code=c.code and" +
+            "         a.serial=c.serial and" +
+            "         c.manu_code *= d.code and" +
+            "         a.real_no = #{realNo} ",
+            "</script>"})
+    List<MzSendMedicineVo> selectMzChargeDetailByCode(MzDrugTracCodg codg);
+
+    @Delete("delete from mz_drug_trac_codg where drug_trac_codg=#{drugTracCodg,jdbcType=VARCHAR}")
+    void deleteMzDrugTracCodgByCode(@Param(value = "drugTracCodg") String drugTracCodg);
+
+    @Select(" select * from mz_drug_trac_codg where drug_trac_codg=#{drugTracCodg,jdbcType=VARCHAR} ")
+    MzDrugTracCodg selectMzDrugTracCodgByCode(@Param(value = "drugTracCodg") String drugTracCodg);
+
+    @Delete("delete from mz_drug_trac_codg_ty where drug_trac_codg=#{drugTracCodg,jdbcType=VARCHAR}")
+    void deleteMzDrugTracCodgTyByCode(@Param(value = "drugTracCodg") String drugTracCodg);
+}

+ 35 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzDzfpUploadMapper.java

@@ -0,0 +1,35 @@
+package cn.hnthyy.thmz.mapper.his.mz;
+
+import cn.hnthyy.thmz.entity.mzdzfp.MzDzfpUpload;
+import cn.hnthyy.thmz.entity.mzdzfp.SetlInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2025/3/14
+ */
+public interface MzDzfpUploadMapper extends BaseMapper<MzDzfpUpload> {
+    @Select(" <script> " +
+            "select top 1 insuplc_admdvs fixBlngAdmdvs ,setl_id setlId,setl_time  setlDate ,psn_no psnCode,inscp_scp_amt inscpAmt ,med_type medType,convert(varchar(19),begntime,120) begntime ,convert(varchar(19),endtime,120) endtime,insutype,fund_pay_sumamt  insureFundPay, oth_pay otherPayAmount,acct_pay perAccoPayAmount,psn_cash_pay  perCashPayAmount,psn_part_amt  perSelfPayAmount   from t_si_setlinfo where pat_no=#{patientId} and times =#{times} and revoked =0 " +
+            "<if test =\" ledgerSn !=null \">"+
+            " and ledger_sn = #{ledgerSn}"+
+            "</if>"+
+            "</script>")
+    SetlInfo selectSetlInfo(@Param("patientId") String patientId, @Param("times")Integer times, @Param("ledgerSn")Integer ledgerSn);
+
+    @Select("select * from powersi_mip_setlinfo where med_org_ord ='${patientId}_${times}_1' and ord_state ='SETTLED' ")
+    Map<String, Object> selectpowersiMipSetlinfo(@Param("patientId") String patientId, @Param("times")Integer times);
+    @Update(" update mz_dzfp_upload set fp_no =#{fpNo} ,res_code=#{resCode},blue_issue_date=#{blueIssueDate} where patient_id = #{patientId} and times =#{times} and receipt_no=#{receiptNo} and type_flag =#{typeFlag} and del_flag =#{delFlag}")
+    int updateFpNo(MzDzfpUpload mzDzfpUpload);
+    @Select(" select dis_diag mainDiagCode ,dis_diag_comment mainDiagName from zy_dis_diag_yb where inpatient_no = #{patientId} and admiss_times =#{times} and dis_diag_no = 1 ")
+    Map<String,Object> selectYbDiag(MzDzfpUpload uploadParam);
+    @Select(" select code mainDiagCode,name mainDiagName from t_case_frontsheet_disdiag where bah = #{patientId} and  times = #{times} and no = 1")
+    Map<String,Object> selectCaseDisdiag(MzDzfpUpload uploadParam);
+
+}

+ 12 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzOrderLockMapper.java

@@ -0,0 +1,12 @@
+package cn.hnthyy.thmz.mapper.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.MzOrderLock;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2024/10/24
+ */
+public interface MzOrderLockMapper extends BaseMapper<MzOrderLock> {
+}

+ 15 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzPatientMiMapper.java

@@ -243,8 +243,18 @@ public interface MzPatientMiMapper {
      * @param times
      * @return  fund_pay_sumamt 基金支付总额  acct_pay 个人账户支出
      */
-    @Select("select fund_pay_sumamt,acct_pay from t_si_setlinfo where pat_no=#{patientId} and times=#{times} and revoked=0")
+    @Select("select fund_pay_sumamt,acct_pay from t_si_setlinfo where pat_no=#{patientId} and times=#{times} and revoked=0" +
+            " union " +
+            "  select fund_pay,psn_acct_pay from powersi_mip_setlinfo where med_org_ord ='${patientId}_${times}_1' and ord_state ='SETTLED' ")
     Map<String,BigDecimal>  selectYbAmount(@Param("patientId") String patientId,@Param("times") Integer times);
+    /**
+     * 根据门诊ID和就诊次数查询门诊统筹报销金额 包含统筹支付和个人账户支付金额
+     * @param patientId
+     * @param times
+     * @return  fund_pay_sumamt 基金支付总额  acct_pay 个人账户支出
+     */
+    @Select("select fund_pay_sumamt,acct_pay from t_si_setlinfo where pat_no=#{patientId} and times=#{times} and revoked=0 ")
+    Map<String,BigDecimal>  selectYbSiAmount(@Param("patientId") String patientId,@Param("times") Integer times);
 
 
     /**
@@ -254,7 +264,8 @@ public interface MzPatientMiMapper {
      * @return
      */
     @Select("select ((select count(1) from t_si_setlinfo where pat_no=#{patientId} and times=#{times} and revoked=0) + " +
-            "(select count(1) from t_si_presetlinfo where pat_no=#{patientId} and times=#{times}) )")
+            "(select count(1) from t_si_presetlinfo where pat_no=#{patientId} and times=#{times}) +" +
+            " (select count(1) from powersi_mip_setlinfo where med_org_ord ='${patientId}_${times}_1') )")
     int countYbZf(@Param(value = "patientId") String patientId, @Param("times") Integer times);
     /**
      * @description:分页查询病人信息
@@ -306,4 +317,6 @@ public interface MzPatientMiMapper {
     String selectChronicDiseaseType(MzPatientMi mzPatientMi);
     @Select(" select name from crm_zd_visit_type where code in (${code}) ")
     List<String> selectCrmTypeName(String code);
+    @Select(" select count(1) from t_si_setlinfo where pat_no=#{patientId} and times=#{times} and revoked=0 ")
+    Integer countYbJs(@Param("patientId") String patientId,@Param("times") Integer times);
 }

+ 17 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzPharmacyMapper.java

@@ -296,6 +296,7 @@ public interface MzPharmacyMapper {
             "         yp_mz_fytj.self_flag,   " +
             "         yp_mz_fytj.response_type,   " +
             "         yp_mz_fytj.warn_dept  ," +
+            "         yp_mz_fytj.refund_medicine_remark  ," +
             "         real_no=yp_mz_fytj.real_no," +
             "         win_no = yp_mz_fytj.win_no " +
             "    FROM yp_mz_fytj WITH(NOLOCK) , " +
@@ -463,8 +464,13 @@ public interface MzPharmacyMapper {
             " and (isnull(mz_charge_detail.confirm_flag,'0') in('0','2','5') OR mz_charge_detail.print_flag_yj='1') ",
             "</when>",
             " and (isnull(mz_charge_detail.confirm_zs,'') <![CDATA[<>]]> '1' ",
-            " and (isnull(mz_charge_detail.confirm_zs,'') <![CDATA[<>]]> '4') ) group by confirm_flag,print_flag,mz_charge_detail.patient_id,mz_charge_detail.times,mz_charge_detail.receipt_no,mz_charge_detail.order_no,mz_charge_detail.real_no,mz_charge_detail.charge_date,mz_charge_detail.group_no,mz_charge_detail.name,mz_charge_detail.doctor_code,mz_charge_detail.warn_dept,mz_charge_detail.charge_date,doctor_flag,windows_no_yf)" +
-                    "as gg order by gg.charge_date desc",
+            " and (isnull(mz_charge_detail.confirm_zs,'') <![CDATA[<>]]> '4') ) group by confirm_flag,print_flag,mz_charge_detail.patient_id,mz_charge_detail.times,mz_charge_detail.receipt_no,mz_charge_detail.order_no,mz_charge_detail.real_no,mz_charge_detail.charge_date,mz_charge_detail.group_no,mz_charge_detail.name,mz_charge_detail.doctor_code,mz_charge_detail.warn_dept,mz_charge_detail.charge_date,doctor_flag,windows_no_yf) as gg " +
+            "<when test='sortType == 0'>",
+            " order by gg.charge_date desc",
+            "</when>",
+            "<when test='sortType == 1'>",
+            " order by gg.patient_id desc, gg.charge_date desc",
+            "</when>",
             "</script>"})
     List<ChargeDetailInfoVo> selectFyclWfyPrescription(ChargeFeeParamsVo chargeFeeParamsVo);
 
@@ -1182,4 +1188,13 @@ public interface MzPharmacyMapper {
      */
     @Select("select charge_item_code,serial,quantity,unit_price from yp_mz_fytj where real_no=${realNo} and receipt_no=#{receiptNo} and order_no=#{orderNo} and group_no=#{groupNo} and quantity>0")
     List<YpMzFytj> selectRefundDrug(@Param("realNo") Integer realNo, @Param("groupNo") String groupNo, @Param("orderNo") Integer orderNo, @Param("receiptNo") Integer receiptNo);
+
+    @Update("update mz_charge_detail set confirm_flag = #{confirmFlag}, dec_amount = 0 " +
+            "where real_no =#{realNo} and group_no = #{groupNo} and order_no =#{orderNo} and receipt_no = #{receiptNo} ")
+    void updateChargeDetailConfirmFlagByTy(@Param("confirmFlag") String confirmFlag, @Param("realNo") Integer realNo, @Param("groupNo") String groupNo, @Param("orderNo") Integer orderNo, @Param("receiptNo") Integer receiptNo);
+
+    @Select(" select * from mz_charge_detail " +
+            " where pay_mark = '0' and group_no = #{groupNo} and confirm_flag in ('0', '5')" +
+            " and patient_id = #{patientId} and times = #{times} and receipt_no = #{receiptNo} ")
+    List<MzChargeDetail> getMzCfWfy(MzChargeDetail mzChargeDetail);
 }

+ 2 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzVisitTableMapper.java

@@ -124,5 +124,6 @@ public interface MzVisitTableMapper {
      */
     @Delete("delete from mz_visit_table where patient_id= #{patientId,jdbcType=VARCHAR} and times = #{times} ")
     int deleteByPatientIdAndTimes(@Param("patientId") String patientId,@Param("times") Integer times);
-
+    @Select("select  max(visit_date) visit_date  from  mz_visit_table where patient_id = #{patientId} ")
+    Date selectLastVisitDate(String patientId);
 }

+ 126 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzZlItemRefundFeeMapper.java

@@ -0,0 +1,126 @@
+package cn.hnthyy.thmz.mapper.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.MzChargeDetail;
+import cn.hnthyy.thmz.entity.his.mz.MzZlItemRefundFee;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2024/11/18
+ */
+public interface MzZlItemRefundFeeMapper extends BaseMapper<MzZlItemRefundFee> {
+    /**
+     * @description:
+     * @author: lihong
+     * @date: 2024/11/18 10:38
+     * @param: param
+     * @return: java.util.List<cn.hnthyy.thmz.entity.his.mz.MzChargeDetail>
+     **/
+
+    @Select("<script>"+
+            "select patient_id, " +
+            "       times, " +
+            "       serial_no, " +
+            "       name, " +
+            "       doctor_code = (select top 1 name from a_employee_mi where code = doctor_code), " +
+            "       charge_date " +
+            " from mz_charge_detail " +
+            " where isnull(group_no, '00') != '91' " +
+            "  and bill_item_code not in ('010', '011', '012') " +
+            "  and req_no = 0 " +
+            "  and pay_mark = '0' " +
+            "  and confirm_flag = 0 " +
+            "<if test = \"beginTime != null and beginTime !='' \">"+
+            "  and charge_date &gt;= #{beginTime} " +
+            "</if>"+
+            "<if test = \"endTime != null and endTime !='' \">"+
+            "  and charge_date &lt;= #{endTime} " +
+            "</if>"+
+            "<if test = \"name != null and name !='' \">"+
+            " <bind name=\"pattenName\" value=\"name+'%'\" />"+
+            "  and name like #{pattenName} " +
+            "</if>"+
+            "<if test = \"doctorCode != null and doctorCode !='' \">"+
+            "  and doctor_code = #{doctorCode} " +
+            "</if>"+
+            "<if test = \"patientId != null and patientId !='' \">"+
+            "  and patient_id = #{patientId} " +
+            "</if>"+
+            "<if test = \"serialNo != null and serialNo !=''  \">"+
+            "  and serial_no = ${serialNo} " +
+            "</if>"+
+            " group by patient_id, " +
+            "         times, " +
+            "         serial_no, " +
+            "         name, " +
+            "         doctor_code, " +
+            "         charge_date" +
+            "</script>")
+    List<MzChargeDetail> selectZlItemRefundFeePage(Map<String, Object> param);
+    /**
+     * @description:
+     * @author: lihong
+     * @date: 2024/11/18 11:28
+     * @param: param
+     * @return: java.util.List<cn.hnthyy.thmz.entity.his.mz.MzChargeDetail>
+     **/
+
+    @Select("<script>" +
+            "select rtrim(patient_id) patient_id, " +
+            "       times, " +
+            "       receipt_no, " +
+            "       order_no, " +
+            "       item_no, " +
+            "       bill_item_code, " +
+            "       rtrim(name) name, " +
+            "       charge_item_code, " +
+            "       quantity, " +
+            "       unit_price, " +
+            "       rtrim(tc_name)  charge_item_name " +
+            " from mz_charge_detail " +
+            " where patient_id = #{patientId} " +
+            "  and times = #{times} " +
+            "  and serial_no =#{serialNo} " +
+            "  and isnull(group_no, '00') != '91' " +
+            "  and bill_item_code not in ('010', '011', '012') " +
+            "  and req_no = 0 " +
+            "  and pay_mark = '0' " +
+            "  and confirm_flag = 0 " +
+            " <if test = \"doctorCode != null and doctorCode !='' \">"+
+            "  and doctor_code = #{doctorCode} " +
+            " </if>"+
+            "</script>")
+    List<MzZlItemRefundFee> selectRefundZlItemDetail(Map<String, Object> param);
+    /**
+     * @description: 跟新退量
+     * @author: lihong
+     * @date: 2024/11/18 15:13
+     * @param: itemRefundFee
+     * @return: java.lang.Integer
+     **/
+    @Update("update mz_charge_detail  " +
+            " set dec_amount = ${decAmount}  " +
+            " where patient_id = #{patientId}  " +
+            "  and times = #{times}  " +
+            "  and receipt_no = #{receiptNo}  " +
+            "  and order_no = #{orderNo}  " +
+            "  and item_no = #{itemNo}  " +
+            "  and charge_item_code = #{chargeItemCode}")
+   Integer updateDecAmount(MzZlItemRefundFee itemRefundFee);
+   @Select(" select count(*) from mz_charge_detail " +
+           " where patient_id = #{itemRefundFee.patientId}  " +
+           "  and times = #{itemRefundFee.times}  " +
+           "  and abs(receipt_no) = #{itemRefundFee.receiptNo}  " +
+           "  and order_no = #{itemRefundFee.orderNo}  " +
+           "  and item_no = #{itemRefundFee.itemNo}  " +
+           "  and charge_item_code = #{itemRefundFee.chargeItemCode}" +
+           " and pay_mark = #{payMark}")
+    Integer countPayMark(@Param("itemRefundFee") MzZlItemRefundFee itemRefundFee, @Param("payMark") String payMark);
+}

+ 2 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzZyReqMapper.java

@@ -36,9 +36,9 @@ public interface MzZyReqMapper {
      * @param mzZyReq
      * @return
      */
-    @Update("update mz_zy_req set confirm_id=#{confirmId},confirm_date=#{confirmDate},zy_serial_no=#{zySerialNo},req_status=#{reqStatus} where patient_id =#{patientId} and req_status=0")
+    @Update("update mz_zy_req set confirm_id=#{confirmId},confirm_date=#{confirmDate},zy_serial_no=#{zySerialNo},req_status=#{reqStatus} where patient_id =#{patientId} and req_status='0' ")
     int updateMzZyReq(MzZyReq mzZyReq);
-    @Update("update mz_zy_req set confirm_id=#{confirmId},confirm_date=#{confirmDate},req_status=#{reqStatus} where patient_id =#{patientId} and req_status=3")
+    @Update("update mz_zy_req set confirm_id=#{confirmId},confirm_date=#{confirmDate},req_status=#{reqStatus} where patient_id =#{patientId} and req_status='3' ")
     int updateMzZyReqStatus(MzZyReq mzZyReq);
 
     /**

+ 1 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzfzPatientOrderMapper.java

@@ -75,7 +75,7 @@ public interface MzfzPatientOrderMapper {
      * @return
      */
     @Select({"<script>",
-            "select top ${pageSize} rtrim(patient_id) patient_id,times,name,dept_code,room_code,doctor_code,gh_no,visit_date,slow_flag,serial_no,req_type,req_order,ampm,fz_no,status_flag,call_time,fz_flag FROM (SELECT ROW_NUMBER() OVER (ORDER BY mzfz_patient_order_page.req_type,mzfz_patient_order_page.fz_no,gh_no,visit_date asc) AS RowNumber,",
+            "select top ${pageSize} rtrim(patient_id) patient_id,times,name,dept_code,room_code,doctor_code,gh_no,visit_date,slow_flag,serial_no,req_type,req_order,ampm,fz_no,status_flag,call_time,fz_flag FROM (SELECT ROW_NUMBER() OVER (ORDER BY mzfz_patient_order_page.fz_no,visit_date asc) AS RowNumber,",
             "* from ${tableName} mzfz_patient_order_page WITH(NOLOCK) where 1=1 and DateDiff(hh,visit_date,getDate()) &lt;=24 ",
             "<when test='statusFlagList!=null'>",
             " and status_flag in ",

+ 4 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzyReqrecMapper.java

@@ -462,4 +462,8 @@ public interface MzyReqrecMapper {
     List<String> selectFzDept(@Param("patientId") String patientId, @Param("visitTime") String visitTime,@Param("disTime") String disTime);
     @Select(" select max(isnull(visit_date,request_day))  from mzy_reqrec where charge_type !='11' and patient_id=#{patientId} and unit_code=#{visitDept} ")
     Date selectMaxRequestDateByPatientIdAndUnitCode(MzyReqrec reqrec);
+    @Select(" select charge_type from mzy_reqrec where patient_id = #{patientId} " +
+            "                          and request_day >= DATEADD(DD,-3,getdate())  " +
+            " order by request_day desc ")
+    List<String> selectChargeType(String patientId);
 }

+ 12 - 4
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzyZdChargeTypeMapper.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.mapper.his.mz;
 
 import cn.hnthyy.thmz.entity.his.mz.MzyZdChargeType;
+import cn.hnthyy.thmz.entity.his.zd.ZdChargeItem;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -13,7 +14,7 @@ public interface MzyZdChargeTypeMapper {
      * 查询所有的号别
      * @return
      */
-    @Select("SELECT rtrim(code) code,rtrim(name) name,rtrim(py_code) py_code,rtrim(d_code) self_code,req_fee,clinic_fee,oth_fee,del_flag,rtrim(req_type) req_type,sort_no,print_flag,isrubric,rubric_txt FROM mzy_zd_charge_type WITH(NOLOCK) where (del_flag  <> 1  or del_flag is null )")
+    @Select("SELECT rtrim(code) code,rtrim(name) name,rtrim(py_code) py_code,rtrim(d_code) self_code,req_fee,clinic_fee,oth_fee,del_flag,rtrim(req_type) req_type,sort_no,print_flag,isrubric,rubric_txt,charge_code FROM mzy_zd_charge_type WITH(NOLOCK) where (del_flag  <> 1  or del_flag is null )")
     List<MzyZdChargeType> selectAllMzyZdChargeType();
 
     /**
@@ -21,7 +22,7 @@ public interface MzyZdChargeTypeMapper {
      * @param code
      * @return
      */
-    @Select("SELECT rtrim(code) code,rtrim(name) name,rtrim(py_code) py_code,rtrim(d_code) self_code,req_fee,clinic_fee,oth_fee,del_flag,rtrim(req_type) req_type,sort_no,print_flag,isrubric,rubric_txt FROM mzy_zd_charge_type WITH(NOLOCK) where code =#{code} ")
+    @Select("SELECT rtrim(code) code,rtrim(name) name,rtrim(py_code) py_code,rtrim(d_code) self_code,req_fee,clinic_fee,oth_fee,del_flag,rtrim(req_type) req_type,sort_no,print_flag,isrubric,rubric_txt,charge_code FROM mzy_zd_charge_type WITH(NOLOCK) where code =#{code} ")
     MzyZdChargeType selectByCode(@Param("code") String code);
 
 
@@ -100,6 +101,9 @@ public interface MzyZdChargeTypeMapper {
             "<when test='rubricTxt!=null'>",
             ",rubric_txt =#{rubricTxt}",
             "</when>",
+            "<when test='chargeCode!=null'>",
+            ",charge_code =#{chargeCode}",
+            "</when>",
             "</trim>",
             "</script>"})
     int updateMzyZdChargeType(MzyZdChargeType mzyZdChargeType);
@@ -110,7 +114,11 @@ public interface MzyZdChargeTypeMapper {
      * @return
      */
     @Insert("INSERT INTO mzy_zd_charge_type(code, name, py_code, d_code, req_fee, telreq_fee, clinic_fee, oth_fee, brochure_fee, " +
-            "back_fee, del_flag, req_type, sort_no, print_flag, qm_flag,isrubric,rubric_txt) VALUES" +
-            " (#{code}, #{name}, #{pyCode}, #{selfCode}, #{reqFee}, 0, #{clinicFee}, #{othFee}, 0, 0, #{delFlag}, #{reqType}, #{sortNo}, '1', NULL,#{isrubric},#{rubricTxt})")
+            "back_fee, del_flag, req_type, sort_no, print_flag, qm_flag,isrubric,rubric_txt,charge_code) VALUES" +
+            " (#{code}, #{name}, #{pyCode}, #{selfCode}, #{reqFee}, 0, #{clinicFee}, #{othFee}, 0, 0, #{delFlag}, #{reqType}, #{sortNo}, '1', NULL,#{isrubric},#{rubricTxt},#{chargeCode})")
     int insetMzyZdChargeType(MzyZdChargeType mzyZdChargeType);
+
+    @Select(" select rtrim(code) code, rtrim(name) name, charge_amount chargeAmount  from zd_charge_item where name like '%诊查%' and isnull(del_flag,'0') != 1 ")
+    List<ZdChargeItem> selectMzChargeItem();
+
 }

+ 9 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/mz/RegionMapper.java

@@ -53,5 +53,13 @@ public interface RegionMapper {
      */
     @Select("select code,name,parent_code from t_region where del_flag = 0")
     List<CodeNameEntity> selectAll();
-
+    /**
+     * @description:
+     * @author: lihong
+     * @date: 2025/2/12 16:07
+     * @param: district
+     * @return: java.util.List<cn.hnthyy.thmz.entity.his.mz.CodeNameEntity>
+     **/
+    @Select("select code,name,parent_code from t_region where name=#{name}")
+    List<CodeNameEntity> getByName(@Param("name")String name);
 }

+ 12 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/ShareholderCardMapper.java

@@ -6,6 +6,7 @@ import cn.hnthyy.thmz.entity.his.zd.ZdChargeItem;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 
 import java.util.Date;
 import java.util.List;
@@ -126,4 +127,15 @@ public interface ShareholderCardMapper {
     List<MzPatientMi> getNewPatientInfo();
     @Delete(" delete from  zd_visit_type_user where patient_id =#{patientId} ")
     int deleteShareholderCard(String patientId);
+    /**
+     * @description: 查询优惠优先级 0 或 null 套餐优先 1 股东卡优先
+     * @author: lihong
+     * @date: 2024/12/10 10:29
+     * @param: patientId
+     * @return: java.lang.String
+     **/
+    @Select(" select discount_lv from zd_visit_type_user where patient_id=#{patientId} ")
+    String selectDiscountLvByPatientId(String patientId);
+    @Update(" update  zd_visit_type_user set discount_lv = #{discountLv} where patient_id = #{patientId} ")
+    int updateDiscountLvByPatientId(@Param("patientId") String patientId,@Param("discountLv") String discountLv);
 }

+ 153 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/WpMzPrescriptionMapper.java

@@ -0,0 +1,153 @@
+package cn.hnthyy.thmz.mapper.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.RxDiseinfo;
+import cn.hnthyy.thmz.entity.his.mz.RxDruginfo;
+import cn.hnthyy.thmz.entity.his.mz.RxMdtrtinfo;
+import cn.hnthyy.thmz.entity.his.mz.RxReceiptinfo;
+import cn.hnthyy.thmz.entity.his.mz.ZdRxMedicine;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 外配处方
+ * @Author:lihong
+ * @Date: 2025/1/3
+ */
+public interface WpMzPrescriptionMapper {
+    /**
+     * @description: 查询外配处方药品目录
+     * @author: lihong
+     * @date: 2025/1/3 10:37
+     * @param: keyword
+     * @return: java.util.Map<java.lang.String,java.lang.Object>
+     **/
+    @Select(" <script>" +
+            "select top ${pageSize} id, med_list_codg, nat_drug_no, genname, prodname, reg_name, list_type, list_type_name, spec_name, prdr_name, aprvno, dosform_name, min_pacunt, poolarea_no, poolarea_name, dualchnl_flag, min_prepunt, begntime, endtime, py_code from zd_rx_medicine " +
+            "<if test=\"keyword !=null and  keyword !='' \">" +
+            " <bind name=\"pattenKeyword\" value=\"'%'+keyword+'%'\" />"+
+            " where med_list_codg like #{pattenKeyword} or genname like #{pattenKeyword} or py_code like #{pattenKeyword}"+
+            "</if>" +
+            "</script>")
+    List<ZdRxMedicine> selectZdRxMedicine(@Param("keyword") String keyword, @Param("pageSize") Integer pageSize);
+
+    /**
+     * @description: 插入外配处方诊断信息
+     * @author: lihong
+     * @date: 2025/1/6 9:35
+     * @param: list
+     * @return: int
+     **/
+    @Insert("<script>" +
+            " insert into t_rx_diseinfo (hosp_rxno, diag_type, maindiag_flag, diag_srt_no, diag_code, diag_name, diag_dept, diag_dept_code, diag_dr_no, diag_dr_name, diag_time, tcm_dise_code, tcm_dise_name, tcmsymp_code, tcmsymp)  values  " +
+            " <foreach collection='list' item='item' index='index' separator=','>"+
+            " ( #{item.hospRxno},#{item.diagType},#{item.maindiagFlag},#{item.diagSrtNo}, #{item.diagCode}, #{item.diagName}, #{item.diagDept}, #{item.diagDeptCode}, #{item.diagDrNo}, #{item.diagDrName}, #{item.diagTime,jdbcType=TIMESTAMP}, #{item.tcmDiseCode}, #{item.tcmDiseName}, #{item.tcmsympCode}, #{item.tcmsymp}" +
+            ") " +
+            "</foreach>"+
+    "</script>")
+    int insertRxDiseinfo(List<RxDiseinfo> list);
+
+    /**
+     * @description: 插入外配处方药品信息
+     * @author: lihong
+     * @date: 2025/1/6 9:35
+     * @param: list
+     * @return: int
+     **/
+    @Insert("<script>" +
+            " insert into t_rx_druginfo (hosp_rxno, med_list_codg, fixmedins_hilist_id, hosp_prep_flag, rx_item_type_code, rx_item_type_name, tcmdrug_type_code, tcmdrug_type_name, tcmherb_foote, medn_type_code, medn_type_name, main_medc_flag, urgt_flag, bas_medn_flag, imp_drug_flag, otc_flag, drug_genname, drug_dosform, drug_spec, drug_prodname, prdr_name, medc_way_codg, medc_way_dscr, medc_begntime, medc_endtime, medc_days, sin_dosunt, sin_doscnt, used_frqu_codg, used_frqu_name, drug_dosunt, drug_cnt, drug_pric, drug_sumamt, hosp_appr_flag, self_pay_rea, real_dscr)  values "+
+            " <foreach collection='list' item='item' index='index' separator=','>"+
+            "( #{item.hospRxno}, #{item.medListCodg}, #{item.fixmedinsHilistId}, #{item.hospPrepFlag}, #{item.rxItemTypeCode}, #{item.rxItemTypeName}, #{item.tcmdrugTypeCode},  #{item.tcmdrugTypeName},  #{item.tcmherbFoote},  #{item.mednTypeCode},  #{item.mednTypeName}, #{item.mainMedcFlag}, #{item.urgtFlag},  #{item.basMednFlag}, #{item.impDrugFlag}, #{item.otcFlag}, #{item.drugGenname}, #{item.drugDosform}, #{item.drugSpec}, #{item.drugProdname}, #{item.prdrName}, #{item.medcWayCodg},  #{item.medcWayDscr}, #{item.medcBegntime}, #{item.medcEndtime}, #{item.medcDays}, #{item.sinDosunt}, #{item.sinDoscnt}, #{item.usedFrquCodg}, #{item.usedFrquName}, #{item.drugDosunt}, #{item.drugCnt},  #{item.drugPric}, #{item.drugSumamt}, #{item.hospApprFlag}, #{item.selfPayRea}, #{item.realDscr} " +
+            ")" +
+            "</foreach>"+
+            "</script>")
+    int insertRxDruginfo(List<RxDruginfo> list);
+
+    /**
+     * @description:插入外配处方就诊信息
+     * @author: lihong
+     * @date: 2025/1/6 9:35
+     * @param: rxMdtrtinfo
+     * @return: int
+     **/
+    @Insert("  insert into t_rx_mdtrtinfo (hosp_rxno,   ipt_otp_no, otp_ipt_flag, patn_name, psn_cert_type, certno, patn_age, patn_hgt, patn_wt, gend, birctrl_type, birctrl_matn_date, matn_type, geso_val, nwb_flag, nwb_age, suck_prd_flag, algs_his, prsc_dept_code, prsc_dept_name, dr_code, prsc_dr_name, prsc_dr_cert_type, prsc_dr_certno, dr_profttl_codg, dr_profttl_name, dr_dept_code, dr_dept_name, caty, mdtrt_time, dise_codg, dise_name, sp_dise_flag, maindiag_code, maindiag_name, dise_cond_dscr, hi_feesetl_type, hi_feesetl_name, rgst_fee, medfee_sumamt, fstdiag_flag) values " +
+            " ( #{hospRxno}, #{iptOtpNo}, #{otpIptFlag}, #{patnName}, #{psnCertType}, #{certno}, #{patnAge}, #{patnHgt}, #{patnWt}, #{gend}, #{birctrlType}, #{birctrlMatnDate}, #{matnType}, #{gesoVal}, #{nwbFlag}, #{nwbAge}, #{suckPrdFlag}, #{algsHis}, #{prscDeptCode}, #{prscDeptName}, #{drCode}, #{prscDrName}, #{prscDrCertType}, #{prscDrCertno}, #{drProfttlCodg}, #{drProfttlName}, #{drDeptCode}, #{drDeptName}, #{caty}, #{mdtrtTime}, #{diseCodg}, #{diseName}, #{spDiseFlag}, #{maindiagCode}, #{maindiagName}, #{diseCondDscr}, #{hiFeesetlType}, #{hiFeesetlName}, #{rgstFee}, #{medfeeSumamt}, #{fstdiagFlag} )"
+            )
+    int insertRxMdtrtinfo(RxMdtrtinfo rxMdtrtinfo);
+
+    /**
+     * @description: 插入外配处方信息
+     * @author: lihong
+     * @date: 2025/1/6 9:36
+     * @param: rxReceiptinfo
+     * @return: int
+     **/
+    @Insert(" insert into t_rx_receiptinfo ( hosp_rxno, pat_no, times, init_rxno, rx_type_code, prsc_time, rx_drug_cnt, rx_used_way_codg, rx_used_way_name, rx_frqu_codg, rx_frqu_name, rx_dosunt, rx_doscnt, rx_drord_dscr, vali_days, vali_end_time, rept_flag, max_rept_cnt, reptd_cnt, min_inrv_days,rx_cotn_flag,long_rx_flag,zy_no,zy_times) values  " +
+            " ( #{hospRxno}, #{patNo}, #{times}, #{initRxno}, #{rxTypeCode}, #{prscTime,jdbcType=TIMESTAMP}, #{rxDrugCnt}, #{rxUsedWayCodg}, #{rxUsedWayName}, #{rxFrquCodg}, #{rxFrquName}, #{rxDosunt}, #{rxDoscnt}, #{rxDrordDscr}, #{valiDays}, #{valiEndTime,jdbcType=TIMESTAMP}, #{reptFlag}, #{maxReptCnt}, #{reptdCnt}, #{minInrvDays},#{rxCotnFlag},#{longRxFlag},#{zyNo},#{zyTimes})")
+    int insertRxReceiptinfo(RxReceiptinfo rxReceiptinfo);
+
+    /**
+     * @description: 查询外配处方类别 通用字典
+     * @author: lihong
+     * @date: 2025/1/6 11:23
+     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.String>>
+     **/
+    @Select(" select label,code,name  from  zd_rx_all ")
+    List<Map<String, String>> selectZdRxAll();
+
+    /**
+     * @description: 根据类别 查询字典
+     * @author: lihong
+     * @date: 2025/1/6 11:29
+     * @param: label
+     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.String>>
+     **/
+    @Select(" <script> " +
+            "select label,code,name,times,his_code from  zd_rx_all where label = #{label} " +
+            "<if test=\"code !=null and  code !='' \">" +
+            " and code = #{code}"+
+            " </if>"+
+            "</script>")
+    List<Map<String, String>> selectZdRxAllByLabel(@Param("label") String label,@Param("code") String code);
+    @Select(" select id, med_list_codg, nat_drug_no, genname, prodname, reg_name, list_type, list_type_name, spec_name, prdr_name, aprvno, dosform_name, min_pacunt, poolarea_no, poolarea_name, dualchnl_flag, min_prepunt, begntime, endtime, py_code, page_no from  zd_rx_medicine where med_list_codg=#{medListCodg} ")
+    ZdRxMedicine selectRxMedicineByCode(String medListCodg);
+    /**
+     * @description: 查询剂型
+     * @author: lihong
+     * @date: 2025/1/9 8:51
+     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
+     **/
+    @Select(" select code,name from yp_zd_dosage where isnull(del_flag,'0') = '0' ")
+    List<Map<String,Object>> selectYpZdDoseage();
+
+    /**
+     * @description: 判断外配药处方是否可以修改或删除 为 0 可以 大于0不行
+     * @author: lihong
+     * @date: 2025/1/9 9:11
+     * @param: hospRxno
+     * @return: java.lang.Integer
+     **/
+    @Select(" select count(*)  from t_rx_precheck  where hosp_rxno =#{hospRxno} ")
+    Integer countRxPrecheck(String hospRxno);
+    @Select(" select b.* from t_rx_receiptinfo a join t_rx_druginfo b on a.hosp_rxno=b.hosp_rxno " +
+            " where a.pat_no=#{patientId}" +
+            "       and a.times =#{times} ")
+    List<RxDruginfo> selectRxDruginfo(@Param("patientId") String patientId, @Param("times")Integer times);
+    /**
+     * @description: 删除外配药处方
+     * @author: lihong
+     * @date: 2025/1/9 15:59
+     * @param: hospRxno
+     **/
+    @Delete(" delete  from t_rx_druginfo where hosp_rxno = #{hospRxno} ; " +
+            " delete  from t_rx_receiptinfo where hosp_rxno = #{hospRxno} ;" +
+            " delete  from t_rx_mdtrtinfo where hosp_rxno = #{hospRxno} ;" +
+            " delete  from t_rx_diseinfo where hosp_rxno = #{hospRxno} ;"
+            )
+    void delWpMzPrescription(String hospRxno);
+
+}

部分文件因为文件数量过多而无法显示