Ver Fonte

发药打印时判断当前操作员是否设置了发药基础参数

WANGJIALIANG há 4 anos atrás
pai
commit
0fe5f6cba9

+ 20 - 2
src/main/java/cn/hnthyy/thmz/controller/mz/MzPharmacyController.java

@@ -6,6 +6,7 @@ import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.YpZdDict;
 import cn.hnthyy.thmz.entity.his.mz.*;
 import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode;
+import cn.hnthyy.thmz.entity.thmz.DispensingWindows;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.ConfirmFlagEnum;
 import cn.hnthyy.thmz.service.his.YpZdDictService;
@@ -13,6 +14,7 @@ import cn.hnthyy.thmz.service.his.YpZdManufactoryService;
 import cn.hnthyy.thmz.service.his.mz.*;
 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 lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -49,6 +51,8 @@ public class MzPharmacyController {
     private MzOrderFrequencyService mzOrderFrequencyService;
     @Autowired
     private DispensingSocketService dispensingSocketService;
+    @Autowired
+    private DispensingWindowsService dispensingWindowsService;
     /**
      * 查询处方信息
      *
@@ -514,8 +518,9 @@ public class MzPharmacyController {
      */
     @UserLoginToken
     @RequestMapping(value = "/getPrintPrescriptionData", method = {RequestMethod.POST})
-    public Map<String, Object> getPrintPrescriptionData(@RequestBody MzChargeDetail mzChargeDetail) {
+    public Map<String, Object> getPrintPrescriptionData(@RequestBody MzChargeDetail mzChargeDetail, HttpServletRequest httpServletRequest) throws MzException {
         Map<String, Object> resultMap = new HashMap<>();
+        User tokenUser = TokenUtil.getUser(httpServletRequest);
         try {
             if (mzChargeDetail == null) {
                 resultMap.put("code", -1);
@@ -532,6 +537,12 @@ public class MzPharmacyController {
                 resultMap.put("message", "打印失败,次数为空");
                 return resultMap;
             }
+            DispensingWindows windows = dispensingWindowsService.queryLastDispensingWindowsByUserIdCode(tokenUser.getUserIdCode(),null);
+            if (windows == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "当前操作人未设置发药基础参数,请先设置!");
+                return resultMap;
+            }
             Map<String, Object> printMap = new HashMap<>();
             MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(mzChargeDetail.getPatientId());
             MzVisitTable visit = mzVisitTableService.queryByPatientIdAndTimes(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes());
@@ -612,8 +623,9 @@ public class MzPharmacyController {
      */
     @UserLoginToken
     @RequestMapping(value = "/getPrintInjectionData", method = {RequestMethod.POST})
-    public Map<String, Object> getPrintInjectionData(@RequestBody MzChargeDetail mzChargeDetail) {
+    public Map<String, Object> getPrintInjectionData(@RequestBody MzChargeDetail mzChargeDetail, HttpServletRequest httpServletRequest) throws MzException {
         Map<String, Object> resultMap = new HashMap<>();
+        User tokenUser = TokenUtil.getUser(httpServletRequest);
         try {
             if (mzChargeDetail == null) {
                 resultMap.put("code", -1);
@@ -650,6 +662,12 @@ public class MzPharmacyController {
                 resultMap.put("message", "次数不能为空");
                 return resultMap;
             }
+            DispensingWindows windows = dispensingWindowsService.queryLastDispensingWindowsByUserIdCode(tokenUser.getUserIdCode(),null);
+            if (windows == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "当前操作人未设置发药基础参数,请先设置!");
+                return resultMap;
+            }
             List<MzSendMedicineVo> cfxxList = mzPharmacyService.getFyclPrescriptionDetail(mzChargeDetail);
             if (cfxxList.size() > 0) {
                 MzVisitTable visit = mzVisitTableService.queryByPatientIdAndTimes(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes());