WANGJIALIANG 3 лет назад
Родитель
Сommit
a8a52084c4

+ 9 - 28
src/main/java/cn/hnthyy/thmz/mapper/his/yf/YfSpiritAnestheticPrintMapper.java

@@ -112,37 +112,18 @@ public interface YfSpiritAnestheticPrintMapper {
      * @return
      */
     @Select({"<script>" +
-            "SELECT b.name," +
-            "       i.sex," +
-            "       warn_dept_name=h.name," +
+            "SELECT doctor_name = case when isnull(a.doctor_name,'00000')='00000' then a.drawer else a.doctor_name end," +
+            "       warn_dept=a.ward_code," +
             "       id=a.inpatient_no," +
-            "       icd_text=cast(isnull(b.admiss_diag_str,'') as varchar(50))," +
-            "       drug_name=d.name," +
-            "       abbr_name=e.name," +
-            "       quantity = case when a.serial=d.serial then a.amount else a.amount/d.pack_size end," +
-            "       d.specification," +
+            "       a.admiss_times," +
+            "       quantity = a.amount," +
             "       charge_date=a.confirm_time," +
-            "       employee_name=c.name," +
-            "       charge_code=d.code," +
-            "       age=datediff(year,i.birth_date,getdate())," +
+            "       a.charge_code," +
+            "       a.serial," +
             "       supply_name=''," +
             "       frequency=''" +
-            " FROM  yp_zy_patient a WITH(NOLOCK)," +
-            "       zy_patient b WITH(NOLOCK)," +
-            "       a_employee_mi c WITH(NOLOCK)," +
-            "       yp_zd_dict d WITH(NOLOCK)," +
-            "       yp_zd_manufactory e WITH(NOLOCK)," +
-            "       yp_zd_unit f WITH(NOLOCK) ," +
-            "       zd_unit_code h WITH(NOLOCK) ," +
-            "       a_patient_mi i WITH(NOLOCK) " +
-            " WHERE a.inpatient_no = b.inpatient_no and" +
-            "       a.admiss_times=b.admiss_times and" +
-            "       case when isnull(a.doctor_name,'00000')='00000' then a.drawer else a.doctor_name end *= c.code and" +
-            "       a.charge_code = d.code and" +
-            "       a.serial = d.serial and" +
-            "       d.manu_code*= e.code  and" +
-            "       a.inpatient_no*=i.inpatient_no and" +
-            "       b.admiss_dept=h.code and" +
+            " FROM  yp_zy_patient a WITH(NOLOCK)" +
+            " WHERE " +
             "       <when test='sendDrugRecordVo.beginDate != null'>" +
             "       a.confirm_time<![CDATA[>]]> #{sendDrugRecordVo.beginDate} and" +
             "       </when>" +
@@ -156,7 +137,7 @@ public interface YfSpiritAnestheticPrintMapper {
             "       a.serial = #{sendDrugRecordVo.serial} and" +
             "       </when>" +
             "       <when test='sendDrugRecordVo.warnDept != null'>" +
-            "       h.code = #{sendDrugRecordVo.warnDept} and" +
+            "       a.ward_code = #{sendDrugRecordVo.warnDept} and" +
             "       </when>" +
             "       a.act_order_no = '3'" ,
             " </script>"})

+ 60 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/yf/YfSpiritAnestheticPrintServiceImpl.java

@@ -1,9 +1,21 @@
 package cn.hnthyy.thmz.service.impl.his.yf;
 
+import cn.hnthyy.thmz.entity.his.mz.Employee;
+import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
+import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode;
+import cn.hnthyy.thmz.entity.his.zy.APatientMi;
+import cn.hnthyy.thmz.entity.his.zy.ZyActpatient;
+import cn.hnthyy.thmz.mapper.his.mz.EmployeeMapper;
 import cn.hnthyy.thmz.mapper.his.yf.YfSpiritAnestheticPrintMapper;
+import cn.hnthyy.thmz.mapper.his.yp.YpZdDictMapper;
+import cn.hnthyy.thmz.mapper.his.yp.YpZdManufactoryMapper;
+import cn.hnthyy.thmz.mapper.his.zd.ZdUnitCodeMapper;
+import cn.hnthyy.thmz.mapper.his.zy.APatientMiMapper;
+import cn.hnthyy.thmz.mapper.his.zy.ZyActpatientMapper;
 import cn.hnthyy.thmz.service.his.yf.YfSpiritAnestheticPrintService;
 import cn.hnthyy.thmz.vo.MzSendMedicineVo;
 import cn.hnthyy.thmz.vo.SendDrugRecordVo;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -15,6 +27,24 @@ public class YfSpiritAnestheticPrintServiceImpl implements YfSpiritAnestheticPri
     @SuppressWarnings("all")
     @Autowired
     private YfSpiritAnestheticPrintMapper yfSpiritAnestheticPrintMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private APatientMiMapper aPatientMiMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private EmployeeMapper employeeMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private YpZdDictMapper ypZdDictMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private YpZdManufactoryMapper ypZdManufactoryMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private ZyActpatientMapper zyActpatientMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private ZdUnitCodeMapper zdUnitCodeMapper;
 
     @Override
     public List<MzSendMedicineVo> queryMzSpiritAnestheticPrint(String beginDate, String endDate, String chargeItemCode, String unitCode, String[] drugFlags) {
@@ -30,15 +60,43 @@ public class YfSpiritAnestheticPrintServiceImpl implements YfSpiritAnestheticPri
     public List<SendDrugRecordVo> getSendDrugRecord(SendDrugRecordVo sendDrugRecordVo) {
         ArrayList<SendDrugRecordVo> sendDrugRecordVos = new ArrayList<>();
         if(sendDrugRecordVo.getQueryScope() == 0){
-            sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectYjRecord(sendDrugRecordVo));
+            sendDrugRecordVos.addAll(getYjRecord(sendDrugRecordVo));
             sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectZyRecord(sendDrugRecordVo));
             sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectMzRecord(sendDrugRecordVo));
         }else if(sendDrugRecordVo.getQueryScope() == 1){
             sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectMzRecord(sendDrugRecordVo));
         }else if(sendDrugRecordVo.getQueryScope() == 2){
-            sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectYjRecord(sendDrugRecordVo));
+            sendDrugRecordVos.addAll(getYjRecord(sendDrugRecordVo));
             sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectZyRecord(sendDrugRecordVo));
         }
         return sendDrugRecordVos;
     }
+
+    public List<SendDrugRecordVo> getYjRecord(SendDrugRecordVo sendDrugRecordVo) {
+        List<SendDrugRecordVo> sendDrugRecordVos = yfSpiritAnestheticPrintMapper.selectYjRecord(sendDrugRecordVo);
+        sendDrugRecordVos.forEach(sendDrugRecord ->{
+            APatientMi aPatientMi = aPatientMiMapper.selectPatientMiByInPatientNo(sendDrugRecord.getId());
+            if(aPatientMi != null){
+                sendDrugRecord.setSex(Integer.parseInt(aPatientMi.getSex()));
+                sendDrugRecord.setName(aPatientMi.getName());
+                sendDrugRecord.setBirthDay(aPatientMi.getBirthDate());
+            }
+            Employee employee = employeeMapper.selectByUserCode(sendDrugRecord.getDoctorName());
+            if(employee != null){
+                sendDrugRecord.setEmployeeName(employee.getEmployeeName());
+            }
+            YpZdDict ypZdDict = ypZdDictMapper.selectYpZdDictByCodeAndSerial(sendDrugRecord.getChargeCode(), sendDrugRecord.getSerial());
+            sendDrugRecord.setDrugName(ypZdDict.getName());
+            sendDrugRecord.setSpecification(ypZdDict.getSpecification());
+            sendDrugRecord.setAbbrName(ypZdManufactoryMapper.selectYpZdManufactoryByCode(ypZdDict.getManuCode()));
+            ZyActpatient zyActpatient = zyActpatientMapper.selectByInpatientNo(ZyActpatient.ZY_ACTPATIENT, sendDrugRecord.getId(), sendDrugRecord.getAdmissTimes());
+            if(zyActpatient == null){
+                zyActpatient = zyActpatientMapper.selectByInpatientNo(ZyActpatient.ZY_INACTPATIENT, sendDrugRecord.getId(), sendDrugRecord.getAdmissTimes());
+            }
+            sendDrugRecord.setIcdText(StringUtils.isBlank(zyActpatient.getAdmissDiagStr())?"":zyActpatient.getAdmissDiagStr());
+            ZdUnitCode zdUnitCode = zdUnitCodeMapper.selectByCode(sendDrugRecord.getWarnDept());
+            sendDrugRecord.setWarnDeptName(zdUnitCode.getName());
+        });
+        return sendDrugRecordVos;
+    }
 }

+ 4 - 2
src/main/java/cn/hnthyy/thmz/vo/SendDrugRecordVo.java

@@ -20,8 +20,8 @@ public class SendDrugRecordVo implements Serializable {
     private Integer sex;
     //出生日期
     private Date birthDay;
-    //年龄
-    private Integer age;
+    //住院次数
+    private Integer admissTimes;
     //申请科室
     private String warnDeptName;
     //申请科室编码
@@ -40,6 +40,8 @@ public class SendDrugRecordVo implements Serializable {
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     private Date chargeDate;
+    //申请医生工号
+    private String doctorName;
     //申请医生
     private String employeeName;
     //药品编码

+ 2 - 1
src/main/resources/static/js/yf/spirit_anesthetic_print.js

@@ -211,11 +211,12 @@ function getSendDrugRecordData() {
                         sex = "未知"
                     }
                     let queryScope = data.id.indexOf("-")!=-1?'门诊':'住院';
+                    let age = data.birthDay!=null?getBirthSlot(data.birthDay,new Date()):'';
                     html += '<tr class="sjh">';
                     html += '<td class="xtd" style="text-align: center;">' + data.id + '</td>';
                     html += '<td class="xtd" style="text-align: center;">' + data.name + '</td>';
                     html += '<td class="xtd" style="text-align: center;">' + sex + '</td>';
-                    html += '<td class="xtd" style="text-align: center;">' + data.age + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + age.substring(0,age.indexOf('岁')) + '</td>';
                     html += '<td class="xtd" style="text-align: center;">' + data.warnDeptName + '</td>';
                     html += '<td>' + data.icdText + '</td>';
                     html += '<td class="xtd" style="text-align: center;">' + data.chargeCode + '</td>';