Browse Source

添加放射科发药统计记录

WANGJIALIANG 3 years ago
parent
commit
c5ab58e496

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

@@ -969,10 +969,11 @@ public interface MzPharmacyMapper {
      * @param endTime
      * @return
      */
-    @Select("select rtrim(c.patient_id)patient_id,c.times,c.order_no,c.quantity,c.unit_price,c.charge_item_code,y.serial " +
+    @Select("select distinct rtrim(c.patient_id)patient_id,c.times,c.order_no,c.quantity,c.unit_price,c.charge_item_code,y.serial " +
+            ",c.receipt_no,c.group_no,c.item_no,c.serial_no,c.doctor_code,c.windows_no_yf" +
             " from mz_charge_detail c WITH(NOLOCK),yp_zd_dict y WITH(NOLOCK) " +
             " where c.group_no = '71' and c.charge_date > #{startTime} and c.charge_date < #{endTime} and c.confirm_flag in (0,2) and serial_no > 0" +
-            "  and c.charge_item_code = y.code and c.serial = y.serial and y.class_code = '210100' group by c.patient_id,c.times,c.order_no,c.quantity,c.unit_price,c.charge_item_code,y.serial")
+            "  and c.charge_item_code = y.code and c.serial = y.serial and y.class_code = '210100' ")
     List<MzChargeDetail> selectRadSendPrescription(@Param("startTime") String startTime,@Param("endTime") String endTime);
 
     /**

+ 1 - 1
src/main/java/cn/hnthyy/thmz/service/his/mz/MzPharmacyService.java

@@ -168,7 +168,7 @@ public interface MzPharmacyService {
      * @param user
      * @return
      */
-    int sendMedicineProcessingRad(User user);
+    int sendMedicineProcessingRad(User user) throws MzException;
 
     /**
      * 语音生成

+ 40 - 13
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzPharmacyServiceImpl.java

@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.net.URLEncoder;
 import java.util.*;
+
 @Slf4j
 @Service
 public class MzPharmacyServiceImpl implements MzPharmacyService {
@@ -123,7 +124,7 @@ public class MzPharmacyServiceImpl implements MzPharmacyService {
                 mzPharmacyMapper.updateFytjConfirmFlag(mzRefundMedicineVo);
             }
             mzPharmacyMapper.updateChargeDetailConfirmFlag(mzRefundMedicineVo);
-            if(mzPharmacyMapper.updateBaseYf(mzRefundMedicineVo) > 0){
+            if (mzPharmacyMapper.updateBaseYf(mzRefundMedicineVo) > 0) {
                 log.info("更新药房库存数据成功{}", JSONObject.valueToString(mzRefundMedicineVo));
             }
         }
@@ -200,10 +201,10 @@ public class MzPharmacyServiceImpl implements MzPharmacyService {
             ypMzFytj.setInputTime(date);
             ypMzFytj.setConfirmId(user.getUserIdCode());
             ypMzFytj.setConfirmName(user.getUserName());
-            if(mzPharmacyMapper.insertFyclFytj(ypMzFytj) < 1){
+            if (mzPharmacyMapper.insertFyclFytj(ypMzFytj) < 1) {
                 throw new MzException("保存发药统计数据为空,发药处理失败");
             }
-            if(mzPharmacyMapper.updateFyclChargeDetailConfirmFlag(ypMzFytj) < 1){
+            if (mzPharmacyMapper.updateFyclChargeDetailConfirmFlag(ypMzFytj) < 1) {
                 throw new MzException("修改发药状态数据为空,发药处理失败");
             }
             MzRefundMedicineVo mzRefundMedicineVo = new MzRefundMedicineVo();
@@ -215,10 +216,10 @@ public class MzPharmacyServiceImpl implements MzPharmacyService {
             mzRefundMedicineVo.setPatientId(ypMzFytj.getPatientId());
             mzRefundMedicineVo.setTimes(ypMzFytj.getTimes());
             mzRefundMedicineVo.setOrderNo(ypMzFytj.getOrderNo());
-            if(mzPharmacyMapper.updateBaseYf(mzRefundMedicineVo) < 1){
+            if (mzPharmacyMapper.updateBaseYf(mzRefundMedicineVo) < 1) {
                 throw new MzException("更新药房库存数据为空,发药处理失败");
-            }else{
-                log.info("更新药房库存数据成功[{}]",JSONObject.valueToString(mzRefundMedicineVo));
+            } else {
+                log.info("更新药房库存数据成功[{}]", JSONObject.valueToString(mzRefundMedicineVo));
             }
         }
         resultMap.put("code", 0);
@@ -259,9 +260,9 @@ public class MzPharmacyServiceImpl implements MzPharmacyService {
         }
         for (int i = 0; i < list.size(); i++) {
             Map map = list.get(i);
-            String manuName = ypZdManufactoryMapper.selectYpZdManufactoryByCode((String)map.get("manu_code"));
+            String manuName = ypZdManufactoryMapper.selectYpZdManufactoryByCode((String) map.get("manu_code"));
             map.put("manuName", manuName);
-            YpBaseYf ypBaseYf = ypBaseYfMapper.selectYpBaseYf((String) map.get("code"), (String) map.get("serial"), "71",null);
+            YpBaseYf ypBaseYf = ypBaseYfMapper.selectYpBaseYf((String) map.get("code"), (String) map.get("serial"), "71", null);
             map.put("location", ypBaseYf.getLocation());
             map.put("stockAmount", ypBaseYf.getStockAmount());
         }
@@ -270,7 +271,7 @@ public class MzPharmacyServiceImpl implements MzPharmacyService {
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
-    public int sendMedicineProcessingRad(User user) {
+    public int sendMedicineProcessingRad(User user) throws MzException {
         Date date = mzPharmacyMapper.selectLastRadSendDate(DateUtil.pase(new Date(), "yyyy-MM-dd HH:mm:ss"));
         String startDateStr = DateUtil.fomart(date, "yyyy-MM-dd");
         String endDateStr = DateUtil.fomart(DateUtil.getPrevDayLastSecond(new Date()), "yyyy-MM-dd HH:mm:ss");
@@ -281,8 +282,31 @@ public class MzPharmacyServiceImpl implements MzPharmacyService {
             mzChargeDetail.setConfirmFlag(1);
             mzChargeDetail.setConfirmId(user.getUserIdCode());
             mzChargeDetail.setConfirmTime(newDate);
+            YpMzFytj ypMzFytj = new YpMzFytj();
+            ypMzFytj.setPatientId(mzChargeDetail.getPatientId());
+            ypMzFytj.setTimes(mzChargeDetail.getTimes());
+            ypMzFytj.setReceiptNo(mzChargeDetail.getReceiptNo());
+            ypMzFytj.setOrderNo(mzChargeDetail.getOrderNo());
+            ypMzFytj.setQuantity(mzChargeDetail.getQuantity());
+            ypMzFytj.setUnitPrice(mzChargeDetail.getUnitPrice());
+            ypMzFytj.setChargeItemCode(mzChargeDetail.getChargeItemCode());
+            ypMzFytj.setSerial(mzChargeDetail.getSerial());
+            ypMzFytj.setGroupNo(mzChargeDetail.getGroupNo());
+            ypMzFytj.setItemNo(mzChargeDetail.getItemNo());
+            ypMzFytj.setSerialNo(mzChargeDetail.getSerialNo());
+            ypMzFytj.setDoctorId(mzChargeDetail.getDoctorCode());
+            ypMzFytj.setWinNo(mzChargeDetail.getWindowsNoYf());
+            Employee employee = employeeMapper.selectByUserCode(mzChargeDetail.getDoctorCode());
+            ypMzFytj.setDoctorName(employee.getEmployeeName());
+            ypMzFytj.setConfirmTime(date);
+            ypMzFytj.setInputTime(date);
+            ypMzFytj.setConfirmId(user.getUserIdCode());
+            ypMzFytj.setConfirmName(user.getUserName());
+            if (mzPharmacyMapper.insertFyclFytj(ypMzFytj) < 1) {
+                log.error("保存发药统计数据为空,发药处理失败");
+                throw new MzException("保存发药统计数据为空,发药处理失败");
+            }
             number += mzPharmacyMapper.updateMzChargeDetailDispensing(mzChargeDetail);
-            //更新药房库存
             MzRefundMedicineVo mzRefundMedicineVo = new MzRefundMedicineVo();
             mzRefundMedicineVo.setChargeCode(mzChargeDetail.getChargeItemCode());
             mzRefundMedicineVo.setSerial(mzChargeDetail.getSerial());
@@ -292,8 +316,11 @@ public class MzPharmacyServiceImpl implements MzPharmacyService {
             mzRefundMedicineVo.setPatientId(mzChargeDetail.getPatientId());
             mzRefundMedicineVo.setTimes(mzChargeDetail.getTimes());
             mzRefundMedicineVo.setOrderNo(mzChargeDetail.getOrderNo());
-            if(mzPharmacyMapper.updateBaseYf(mzRefundMedicineVo) > 0){
+            if (mzPharmacyMapper.updateBaseYf(mzRefundMedicineVo) > 0) {
                 log.info("更新药房库存数据成功{}", JSONObject.valueToString(mzRefundMedicineVo));
+            } else {
+                log.error("更新药房库存数据失败{}", JSONObject.valueToString(mzRefundMedicineVo));
+                throw new MzException("更新药房库存数据异常,放射科发药失败");
             }
         }
         return number;
@@ -301,10 +328,10 @@ public class MzPharmacyServiceImpl implements MzPharmacyService {
 
     @Override
     public String callNumberAudio(String text) {
-        String res="";
+        String res = "";
         try {
             String encode = URLEncoder.encode(text, "UTF-8");
-            res = HttpUtil.sendHttpGet(audioServiceUrl+"?text="+encode, "utf-8");
+            res = HttpUtil.sendHttpGet(audioServiceUrl + "?text=" + encode, "utf-8");
         } catch (Exception e) {
             e.printStackTrace();
             log.info("语音生成失败,内容:{}", text);

+ 1 - 3
src/main/resources/templates/mz/west_pharmacy_dispensing.html

@@ -4,6 +4,7 @@
 <link rel="stylesheet" href="/thmz/css/toll_administration.css">
 <script src="/thmz/js/dependent/bootstrap-select.js"></script>
 <script src="/thmz/js/dependent/daterangepicker.js"></script>
+<script src="/thmz/js/common/pharmacy-com.js"></script>
 <script src="/thmz/js/common/socket-com.js"></script>
 <script src="/thmz/js/mz/west_pharmacy_dispensing.js"></script>
 <script src="/thmz/js/dependent/LodopFuncs.js"></script>
@@ -48,9 +49,6 @@
                             <label>
                                 处方自动打印 <input id="aotoPrint" name="aotoPrint" type="checkbox" value="1"/>
                             </label>
-                            <label style="display: none">
-                                药单自动打印 <input id="aotoPrintYd" name="aotoPrint" type="checkbox" value="2"/>
-                            </label>
                         </div>
                         <label class="control-label col-md-1 col-sm-1 col-xs-12" for="nameSearch">姓名
                         </label>