Browse Source

打印临时长期医嘱

lihong 2 years ago
parent
commit
05e912a373

+ 41 - 0
src/main/java/thyyxxk/webserver/controller/medicaladvice/medicamanage/MedicalManagementController.java

@@ -0,0 +1,41 @@
+package thyyxxk.webserver.controller.medicaladvice.medicamanage;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.inpatient.patient.Patient;
+import thyyxxk.webserver.service.medicaladvice.medicamanage.MedicalManagementService;
+import thyyxxk.webserver.utils.ResultVoUtil;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2023/3/13
+ */
+@RestController
+@RequestMapping("/medicalAdvice/medicaManagement")
+public class MedicalManagementController {
+    @Autowired
+    private MedicalManagementService service;
+
+    @GetMapping("/cqYzPrint")
+    public ResultVo<Map<String,Object>> cqYzPrint(@RequestParam("patNo")String patNo, @RequestParam("times")Integer times) {
+        return service.cqYzPrint(patNo,times);
+    }
+    @GetMapping("/lsYzPrint")
+    public ResultVo<Map<String,Object>> lsYzPrint(@RequestParam("patNo")String patNo, @RequestParam("times")Integer times) {
+        return service.lsYzPrint(patNo,times);
+    }
+
+    @GetMapping("/queryPatientInfo")
+    public ResultVo<List<Patient>> queryPatientInfo(@RequestParam("patNo")String patNo, @RequestParam("ward")String ward) {
+        return ResultVoUtil.success(service.queryPatientInfo(patNo,ward));
+    }
+
+}

+ 340 - 0
src/main/java/thyyxxk/webserver/dao/his/medicaladvice/medicamanage/MedicalManagementDao.java

@@ -0,0 +1,340 @@
+package thyyxxk.webserver.dao.his.medicaladvice.medicamanage;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.inpatient.patient.Patient;
+import thyyxxk.webserver.entity.medicaladvice.medicamanage.YzPrintVO;
+
+import java.util.List;
+
+/**
+ * @Description:医嘱管理
+ * @Author:lihong
+ * @Date: 2023/3/13
+ */
+@Mapper
+public interface MedicalManagementDao {
+    @Select("SELECT act_order_no=a.act_order_no,\n" +
+            "              inpatient_no=a.inpatient_no,\n" +
+            "              name        =c.name,\n" +
+            "              dept_code   =a.ward_code,\n" +
+            "              bed_no      =c.bed_no,\n" +
+            "              sex         =c.sex,\n" +
+            "              age         =space(10),\n" +
+            "              order_name  =rtrim(a.order_name),\n" +
+            "              start_time  =case when  isnull(a.parent_no,'')=''  then a.start_time else (select start_time from yz_act_order where a.parent_no=act_order_no) end,\n" +
+            "              print_page      =a.print_page,\n" +
+            "              doctor_code     =physician,\n" +
+            "              nurse_code      =executer1,\n" +
+            "              self_buy        =a.self_buy,\n" +
+            "              page_no         =isnull(print_page,0),\n" +
+            "              page_no_old     =0,\n" +
+            "              last_rows       =0,\n" +
+            "              modifier        =case when exclu_group_type='1' then null  else a.modifier end,\n" +
+            "              executer2       =case when exclu_group_type='1' then null  else a.executer2 end,\n" +
+            "              drug_quan       =a.drug_quan,\n" +
+            "              dose            =a.dose ,\n" +
+            "              dose_unit       =a.dose_unit,\n" +
+            "              frequ_code      =a.frequ_code,\n" +
+            "              supply_code     =a.supply_code,\n" +
+            "              spec            =a.drug_specification,\n" +
+            "              group_no        =a.group_no,\n" +
+            "              parent_no       =a.parent_no,\n" +
+            "              instruction     =a.instruction,\n" +
+            "              parent_flag     =space(2),\n" +
+            "              parent_flag2    =space(2),\n" +
+            "              end_time        =case when exclu_group_type='1' then null else a.end_time end,\n" +
+            "              ps_status='',\n" +
+            "              ps_oper='',\n" +
+            "              ps_time='',\n" +
+            "              act_order_no_b=a.act_order_no,\n" +
+            "              order_time_b= case when isnull(a.parent_no,'')='' then convert(char(16),a.confirm_time,121) else (select convert(char(16),confirm_time,121) from yz_act_order where a.parent_no=act_order_no) end,\n" +
+            "              order_name2 =space(32),\n" +
+            "              exec_id,\n" +
+            "              exec_id2 = case when exclu_group_type='1'  then null  else a.executer2 end,\n" +
+            "              cx_flag='0',\n" +
+            "              sort_no=0,\n" +
+            "              a.confirm_time,\n" +
+            " new_order_name_code = isnull(a.instruction,'') +(case when isnull(ps_status,'')='' then '' when ps_status='0'then '皮试:阴性'else '皮试:阳性'end) + ' ' +\n" +
+            "                                    (case when a.self_buy = '1' then '自备'when a.self_buy = '2' then '嘱托' else '' end) + ' ' +\n" +
+            "                                    (case when isnull(a.supply_code,'') = '' then '' else (select print_name from yz_supply_type where  supply_code = a.supply_code) end ),\n" +
+            "              new_order_name = rtrim(a.order_name) + (case when a.group_no <> '00' then (case when isnull(a.drug_specification,'')=''then '' else '(' + isnull(a.drug_specification,'')+')' end) + ' ' +\n" +
+            "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  rtrim(a.dose) + (select name from yp_zd_unit where code=a.dose_unit) end) + ' ' +\n" +
+            "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  '共'+ rtrim(a.drug_quan) + (select name from yp_zd_unit where code=a.mini_unit) end) else isnull(a.drug_specification,'') end  )"+
+            " FROM      yz_act_order a, yz_order_item b , view_zy_patient_all c\n" +
+            " WHERE       a.inpatient_no = #{patNo} and\n" +
+            "        a.admiss_times = #{times} AND\n" +
+            "    (isnull(a.print_page,0)=0 or\n" +
+            "     isnull(a.print_page,0) >9999) and\n" +
+            "    (a.frequ_code <> 'ONCE' or isnull(b.frequ_type,'')='1') and\n" +
+            "        a.status_flag > '1'   and\n" +
+            "        a.inpatient_no = c.inpatient_no  and\n" +
+            "        a.admiss_times = c.admiss_times  and\n" +
+            "        a.order_code   = b.order_code    and\n" +
+            "        a.group_no     ='00'  and\n" +
+            "        a.doctor_flag='1'\n" +
+            " union all\n" +
+            " SELECT act_order_no=a.act_order_no,\n" +
+            "              inpatient_no=a.inpatient_no,\n" +
+            "              name        =c.name,\n" +
+            "              dept_code   =a.ward_code,\n" +
+            "              bed_no      =c.bed_no,\n" +
+            "              sex         =c.sex,\n" +
+            "              age         =space(10),\n" +
+            "              order_name  =rtrim(a.order_name),\n" +
+            "              start_time  =case when  isnull(a.parent_no,'')=''  then a.start_time else (select start_time from yz_act_order where a.parent_no=act_order_no) end,\n" +
+            "              print_page     =a.print_page,\n" +
+            "              doctor_code     =physician,\n" +
+            "              nurse_code      =executer1,\n" +
+            "              self_buy        =a.self_buy,\n" +
+            "              page_no         =isnull(print_page,'0'),\n" +
+            "              page_no_old     =0,\n" +
+            "              last_rows       =0,\n" +
+            "              modifier        =a.modifier,\n" +
+            "              executer2       =a.executer2,\n" +
+            "              drug_quan       =a.drug_quan,\n" +
+            "              dose            =a.dose,\n" +
+            "              dose_unit       =a.dose_unit,\n" +
+            "              frequ_code      =a.frequ_code,\n" +
+            "              supply_code     =a.supply_code,\n" +
+            "              spec            =a.drug_specification,\n" +
+            "              group_no        =a.group_no,\n" +
+            "              parent_no       =a.parent_no,\n" +
+            "              instruction     =a.instruction,\n" +
+            "              parent_flag     =space(2),\n" +
+            "              parent_flag2     =space(2),\n" +
+            "              end_time        =a.end_time,\n" +
+            "              ps_status=case when a.ps_status is null then ''\n" +
+            "                             when a.ps_status='0'then '皮试:阴性'else '皮试:阳性'end,\n" +
+            "              a.ps_oper,\n" +
+            "              a.ps_time,\n" +
+            "              act_order_no_b=case when parent_no is null then act_order_no else parent_no end ,\n" +
+            "              order_time_b= case when isnull(a.parent_no,'')='' then convert(char(16),a.confirm_time,121) else (select convert(char(16),confirm_time,121) from yz_act_order where a.parent_no=act_order_no) end,\n" +
+            "              order_name2 =space(32),\n" +
+            "              exec_id,\n" +
+            "              exec_id2 = a.executer2 ,\n" +
+            "              cx_flag='0',\n" +
+            "              sort_no=0,\n" +
+            "              a.confirm_time,\n" +
+            " new_order_name_code = isnull(a.instruction,'') +(case when isnull(ps_status,'')='' then '' when ps_status='0'then '皮试:阴性'else '皮试:阳性'end) + ' ' +\n" +
+            "                                    (case when a.self_buy = '1' then '自备'when a.self_buy = '2' then '嘱托' else '' end) + ' ' +\n" +
+            "                                    (case when isnull(a.supply_code,'') = '' then '' else (select print_name from yz_supply_type where  supply_code = a.supply_code) end ),\n" +
+            "              new_order_name = rtrim(a.order_name) + (case when a.group_no <> '00' then (case when isnull(a.drug_specification,'')=''then '' else '(' + isnull(a.drug_specification,'')+')' end) + ' ' +\n" +
+            "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  rtrim(a.dose) + (select name from yp_zd_unit where code=a.dose_unit) end) + ' ' +\n" +
+            "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  '共'+ rtrim(a.drug_quan) + (select name from yp_zd_unit where code=a.mini_unit) end) else isnull(a.drug_specification,'') end  )"+
+            " FROM       yz_act_order a, view_zy_patient_all c\n" +
+            " WHERE       a.inpatient_no = #{patNo} and\n" +
+            "        a.admiss_times = #{times} AND\n" +
+            "    (isnull(a.print_page,0)=0 or\n" +
+            "     isnull(a.print_page,0) >9999) and\n" +
+            "    (a.frequ_code <> 'ONCE' ) and\n" +
+            "        a.status_flag > '1'   and\n" +
+            "        a.inpatient_no = c.inpatient_no  and\n" +
+            "        a.admiss_times = c.admiss_times  and\n" +
+            "        a.group_no     <> '00'      and\n" +
+            "        a.doctor_flag='1'\n" +
+            "order by page_no,confirm_time,act_order_no_b,act_order_no")
+    List<YzPrintVO> getcqYzPrint(@Param("patNo") String patNo, @Param("times")Integer times);
+    @Select("SELECT act_order_no=a.act_order_no,\n" +
+            "              inpatient_no=a.inpatient_no,\n" +
+            "              name        =c.name,\n" +
+            "              dept_code   =a.dept_code,\n" +
+            "              bed_no      =c.bed_no,\n" +
+            "              sex         =c.sex,\n" +
+            "              age         =space(10),\n" +
+            "              order_name  =rtrim(a.order_name),\n" +
+            "              order_name1  =rtrim(a.order_name),\n" +
+            "              start_time  =case when  isnull(a.parent_no,'')=''  then a.start_time else (select start_time from yz_act_order where a.parent_no=act_order_no) end,\n" +
+            "              print_page_once=a.print_page_once,\n" +
+            "              doctor_code     =physician,\n" +
+            "              nurse_code      =executer1,\n" +
+            "              self_buy        =a.self_buy,\n" +
+            "              page_no         =isnull(print_page_once,0),\n" +
+            "              page_no_old     =0,\n" +
+            "              last_rows       =0,\n" +
+            "              modifier        =a.modifier,\n" +
+            "              executer2       =a.executer2,\n" +
+            "              drug_quan       =a.drug_quan,\n" +
+            "              dose            =a.dose ,\n" +
+            "              dose_unit       =a.dose_unit,\n" +
+            "              frequ_code      =a.frequ_code,\n" +
+            "              supply_code     =a.supply_code,\n" +
+            "              spec            =a.drug_specification,\n" +
+            "              group_no        =a.group_no,\n" +
+            "              parent_no       =a.parent_no,\n" +
+            "              instruction     =a.instruction,\n" +
+            "              parent_flag     =space(2),\n" +
+            "              parent_flag2     =space(2),\n" +
+            "              end_time        =a.end_time,\n" +
+            "              exec_time=a.exec_time,\n" +
+            "              exec_id  =a.exec_id,\n" +
+            "              ps_status=case when isnull(ps_status,'')='' then ''\n" +
+            "                             when ps_status='0'then '皮试:阴性'else '皮试:阳性'end,\n" +
+            "              a.ps_oper,\n" +
+            "              a.ps_time,\n" +
+            "              act_order_no_b=case when isnull(a.parent_no,'')='' then a.act_order_no else a.parent_no end,\n" +
+            "              exec_id2 = a.exec_id2 ,\n" +
+            "              order_time_b= case when isnull(a.parent_no,'')='' then convert(char(16),a.confirm_time,121) else (select convert(char(16),confirm_time,121) from yz_act_order where a.parent_no=act_order_no) end,a.drug_occ,a.ward_code,\n" +
+            "              cx_flag='0',\n" +
+            "              sort_no=0,\n" +
+            "              mini_unit = a.mini_unit,\n" +
+            "              new_order_name_code = isnull(a.instruction,'') +(case when isnull(ps_status,'')='' then '' when ps_status='0'then '皮试:阴性'else '皮试:阳性'end) + ' ' +\n" +
+            "                                    (case when a.self_buy = '1' then '自备'when a.self_buy = '2' then '嘱托' else '' end) + ' ' +\n" +
+            "                                    (case when isnull(a.supply_code,'') = '' then '' else (select print_name from yz_supply_type where  supply_code = a.supply_code) end ),\n" +
+            "              new_order_name = rtrim(a.order_name) + (case when a.group_no <> '00' or a.order_code = '06248' then (case when isnull(a.drug_specification,'')=''then '' else '(' + isnull(a.drug_specification,'')+')' end) + ' ' +\n" +
+            "                                                                                                                  (case when isnull(a.dose_unit,'') = '' then '' else  rtrim(a.dose) + (select name from yp_zd_unit where code=a.dose_unit) end) + ' ' +\n" +
+            "                                                                                                                  (case when isnull(a.dose_unit,'') = '' then '' else  '共'+ rtrim(a.drug_quan) + (select name from yp_zd_unit where code=a.mini_unit) end) else ' ' end),\n" +
+            "              a.confirm_time\n" +
+            " FROM       yz_act_order a, yz_order_item b,view_zy_patient_all c\n" +
+            " WHERE       a.inpatient_no = #{patNo} and\n" +
+            "        a.admiss_times = #{times} AND\n" +
+            "    (isnull(a.print_page_once,0)=0 or\n" +
+            "     isnull(a.print_page_once,0) >9999) and\n" +
+            "    (a.frequ_code = 'ONCE' ) and\n" +
+            "        a.status_flag > '1'   and\n" +
+            "        a.inpatient_no = c.inpatient_no  and\n" +
+            "        a.admiss_times = c.admiss_times  and\n" +
+            "        a.doctor_flag='1' and\n" +
+            "        a.group_no='00' and\n" +
+            "        a.order_code =b.order_code       and\n" +
+            "        isnull(b.frequ_type,'') <> '1'\n" +
+            " union\n" +
+            " SELECT act_order_no=a.act_order_no,\n" +
+            "              inpatient_no=a.inpatient_no,\n" +
+            "              name        =c.name,\n" +
+            "              dept_code   =a.dept_code,\n" +
+            "              bed_no      =c.bed_no,\n" +
+            "              sex         =c.sex,\n" +
+            "              age         =space(10),\n" +
+            "              order_name  =rtrim(a.order_name),\n" +
+            "              order_name1  =rtrim(a.order_name),\n" +
+            "              start_time  =case when  isnull(a.parent_no,'')=''  then a.start_time else (select start_time from yz_act_order where a.parent_no=act_order_no) end,\n" +
+            "              print_page_once=a.print_page_once,\n" +
+            "              doctor_code     =physician,\n" +
+            "              nurse_code      =executer1,\n" +
+            "              self_buy        =a.self_buy,\n" +
+            "              page_no         =isnull(print_page_once,0),\n" +
+            "              page_no_old     =0,\n" +
+            "              last_rows       =0,\n" +
+            "              modifier        =a.modifier,\n" +
+            "              executer2       =a.executer2,\n" +
+            "              drug_quan       =a.drug_quan,\n" +
+            "              dose            =a.dose ,\n" +
+            "              dose_unit       =a.dose_unit,\n" +
+            "              frequ_code      =a.frequ_code,\n" +
+            "              supply_code     =a.supply_code,\n" +
+            "              spec            =a.drug_specification,\n" +
+            "              group_no        =a.group_no,\n" +
+            "              parent_no       =a.parent_no,\n" +
+            "              instruction     =a.instruction,\n" +
+            "              parent_flag     =space(2),\n" +
+            "              parent_flag2     =space(2),\n" +
+            "              end_time        =a.end_time,\n" +
+            "              exec_time=a.exec_time,\n" +
+            "              exec_id  =a.exec_id,\n" +
+            "              ps_status=case when isnull(ps_status,'')='' then ''\n" +
+            "                             when ps_status='0'then '皮试:阴性'else '皮试:阳性'end,\n" +
+            "              a.ps_oper,\n" +
+            "              a.ps_time,\n" +
+            "              act_order_no_b=case when isnull(a.parent_no,'')='' then a.act_order_no else a.parent_no end,\n" +
+            "              exec_id2 = a.exec_id2 ,\n" +
+            "              order_time_b= case when isnull(a.parent_no,'')='' then convert(char(16),a.confirm_time,121) else (select convert(char(16),confirm_time,121) from yz_act_order where a.parent_no=act_order_no) end,a.drug_occ,a.ward_code,\n" +
+            "              cx_flag='0',\n" +
+            "              sort_no=0,\n" +
+            "              mini_unit = a.mini_unit,\n" +
+            "              new_order_name_code = isnull(a.instruction,'') +(case when isnull(ps_status,'')='' then '' when ps_status='0'then '皮试:阴性'else '皮试:阳性'end) + ' ' +\n" +
+            "                                    (case when a.self_buy = '1' then '自备'when a.self_buy = '2' then '嘱托' else '' end) + ' ' +\n" +
+            "                                    (case when isnull(a.supply_code,'') = '' then '' else (select print_name from yz_supply_type where  supply_code = a.supply_code) end ),\n" +
+            "              new_order_name = rtrim(a.order_name) + (case when a.group_no <> '00' then (case when isnull(a.drug_specification,'')=''then '' else '(' + isnull(a.drug_specification,'')+')' end) + ' ' +\n" +
+            "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  rtrim(a.dose) + (select name from yp_zd_unit where code=a.dose_unit) end) + ' ' +\n" +
+            "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  '共'+ rtrim(a.drug_quan) + (select name from yp_zd_unit where code=a.mini_unit) end) else isnull(a.drug_specification,'') end  ),\n" +
+            "              a.confirm_time\n" +
+            " FROM       yz_act_order a, view_zy_patient_all c\n" +
+            " WHERE       a.inpatient_no = #{patNo} and\n" +
+            "        a.admiss_times = #{times} AND\n" +
+            "    (isnull(a.print_page_once,0)=0 or\n" +
+            "     isnull(a.print_page_once,0) >9999) and\n" +
+            "    (a.frequ_code = 'ONCE' ) and\n" +
+            "        a.status_flag > '1'   and\n" +
+            "        a.inpatient_no = c.inpatient_no  and\n" +
+            "        a.admiss_times = c.admiss_times  and\n" +
+            "        a.doctor_flag='1' and\n" +
+            "        a.group_no <> '00'\n" +
+            " union\n" +
+            " SELECT act_order_no=a.act_order_no,\n" +
+            "              inpatient_no=a.inpatient_no,\n" +
+            "              name        =c.name,\n" +
+            "              dept_code   =a.dept_code,\n" +
+            "              bed_no      =c.bed_no,\n" +
+            "              sex         =c.sex,\n" +
+            "              age         =space(10),\n" +
+            "              order_name  =rtrim(a.order_name),\n" +
+            "              order_name1  =rtrim(a.order_name),\n" +
+            "              start_time  =case when  isnull(a.parent_no,'')=''  then a.start_time else (select start_time from yz_act_order where a.parent_no=act_order_no) end,\n" +
+            "              print_page_once=a.print_page_once,\n" +
+            "              doctor_code     =physician,\n" +
+            "              nurse_code      =executer1,\n" +
+            "              self_buy        =a.self_buy,\n" +
+            "              page_no         =isnull(print_page_once,0),\n" +
+            "              page_no_old     =0,\n" +
+            "              last_rows       =0,\n" +
+            "              modifier        =a.modifier,\n" +
+            "              executer2       =a.executer2,\n" +
+            "              drug_quan       =a.drug_quan,\n" +
+            "              dose            =a.dose ,\n" +
+            "              dose_unit       =a.dose_unit,\n" +
+            "              frequ_code      =a.frequ_code,\n" +
+            "              supply_code     =a.supply_code,\n" +
+            "              spec            =a.drug_specification,\n" +
+            "              group_no        =a.group_no,\n" +
+            "              parent_no       =a.parent_no,\n" +
+            "              instruction     =a.instruction,\n" +
+            "              parent_flag     =space(2),\n" +
+            "              parent_flag2     =space(2),\n" +
+            "              end_time        =a.end_time,\n" +
+            "              exec_time=a.exec_time,\n" +
+            "              exec_id  =a.exec_id,\n" +
+            "              ps_status=case when isnull(ps_status,'')='' then ''\n" +
+            "                             when ps_status='0'then '皮试:阴性'else '皮试:阳性'end,\n" +
+            "              a.ps_oper,\n" +
+            "              a.ps_time,\n" +
+            "              act_order_no_b=case when isnull(a.parent_no,'')='' then a.act_order_no else a.parent_no end,\n" +
+            "              exec_id2 = a.exec_id2 ,\n" +
+            "              order_time_b= case when  isnull(a.parent_no,'')=''  then convert(char(16),a.confirm_time,121) else (select convert(char(16),confirm_time,121) from yz_act_order where a.parent_no=act_order_no) end,a.drug_occ,a.ward_code,\n" +
+            "              cx_flag='0',\n" +
+            "              sort_no=0,\n" +
+            "              mini_unit = a.mini_unit,\n" +
+            "              new_order_name_code = isnull(a.instruction,'') +(case when isnull(ps_status,'')='' then '' when ps_status='0'then '皮试:阴性'else '皮试:阳性'end) + ' ' +\n" +
+            "                                    (case when a.self_buy = '1' then '自备'when a.self_buy = '2' then '嘱托' else '' end) + ' ' +\n" +
+            "                                    (case when isnull(a.supply_code,'') = '' then '' else (select print_name from yz_supply_type where  supply_code = a.supply_code) end ),\n" +
+            "              new_order_name = rtrim(a.order_name) + (case when a.group_no <> '00' then (case when isnull(a.drug_specification,'')=''then '' else '(' + isnull(a.drug_specification,'')+')' end) + ' ' +\n" +
+            "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  rtrim(a.dose) + (select name from yp_zd_unit where code=a.dose_unit) end) + ' ' +\n" +
+            "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  '共'+ rtrim(a.drug_quan) + (select name from yp_zd_unit where code=a.mini_unit) end) else isnull(a.drug_specification,'') end  ),\n" +
+            "              a.confirm_time\n" +
+            " FROM       yz_act_order a, view_zy_patient_all c\n" +
+            " WHERE       a.inpatient_no = #{patNo} and\n" +
+            "        a.admiss_times = #{times} AND\n" +
+            "    (isnull(a.print_page_once,0)=0 or\n" +
+            "     isnull(a.print_page_once,0) >9999) and\n" +
+            "    (a.frequ_code = 'ONCE' ) and\n" +
+            "        a.status_flag > '1'   and\n" +
+            "        a.inpatient_no = c.inpatient_no  and\n" +
+            "        a.admiss_times = c.admiss_times  and\n" +
+            "        a.doctor_flag='1' and\n" +
+            "        a.group_no = '00' and\n" +
+            "    (a.order_name like '%草药%' or a.order_name like '%会诊%')\n" +
+            "order by page_no,confirm_time,act_order_no_b")
+    List<YzPrintVO> getlsYzPrint(@Param("patNo") String patNo, @Param("times")Integer times);
+    @Select("select\n" +
+            "                   RTRIM(a.bed_no) bedNo,\n" +
+            "                   RTRIM(a.inpatient_no) inpatientNo,\n" +
+            "                   a.admiss_times,\n" +
+            "                   RTRIM(a.name) as name,\n" +
+            "    sex=isnull(a.sex, 9)\n" +
+            " from zy_actpatient a ${ew.customSqlSegment}" +
+            " ORDER BY cast(a.bed_no AS int)")
+    List<Patient> queryPatientInfo(@Param(Constants.WRAPPER)QueryWrapper<?> query);
+}

+ 18 - 0
src/main/java/thyyxxk/webserver/entity/medicaladvice/medicamanage/YzOrderbase.java

@@ -0,0 +1,18 @@
+package thyyxxk.webserver.entity.medicaladvice.medicamanage;
+
+import lombok.Data;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2023/3/21
+ */
+@Data
+public class YzOrderbase {
+    /** 医嘱号*/
+    protected   Long actOrderNo;
+    /** 父医嘱*/
+    protected Long parentNo;
+    /** 组*/
+    protected String orderGroupNo;
+}

+ 57 - 0
src/main/java/thyyxxk/webserver/entity/medicaladvice/medicamanage/YzPrintVO.java

@@ -0,0 +1,57 @@
+package thyyxxk.webserver.entity.medicaladvice.medicamanage;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2023/3/13
+ */
+@Data
+public class YzPrintVO extends  YzOrderbase  implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /** 医嘱号*/
+    //private  Long actOrderNo;
+    /** 父医嘱*/
+    //private Long parentNo;
+    /** 医嘱名称*/
+    private String orderName;
+    /** 组*/
+    //private String orderGroupNo;
+    /** 日期*/
+    private Date startTime;
+    /** 日期*/
+    private String date;
+    /** 时间*/
+    private String time;
+    private String frequCode;
+    /** 结束时间*/
+    private Date endTime;
+    private String stopDate;
+    private String stopTime;
+    /**停止医师*/
+    private String modifier;
+    private String modifierName;
+    /**停止核对护士*/
+    private String execId2;
+    private String execId2Name;
+    /** 医嘱*/
+    private String newOrderName;
+    /** 医嘱*/
+    private String newOrderNameCode;
+    /** 医师签名*/
+    private String doctorCode;
+    private String doctorName;
+    /** 核对护士签名*/
+    private String nurseCode;
+    private String nurseName;
+    /** 执行时间*/
+    private Date execTime;
+    private String execTimeStr;
+    /** 执行护士签名*/
+    private String execId;
+    private String execName;
+}

+ 115 - 0
src/main/java/thyyxxk/webserver/service/medicaladvice/medicamanage/MedicalManagementService.java

@@ -0,0 +1,115 @@
+package thyyxxk.webserver.service.medicaladvice.medicamanage;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.map.MapUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.dao.his.medicaladvice.medicamanage.MedicalManagementDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.inpatient.patient.Patient;
+import thyyxxk.webserver.entity.login.UserInfo;
+import thyyxxk.webserver.entity.medicaladvice.medicamanage.YzPrintVO;
+import thyyxxk.webserver.service.inpatient.PatientService;
+import thyyxxk.webserver.service.redislike.RedisLikeService;
+import thyyxxk.webserver.utils.AssertUtil;
+import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.StringUtil;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2023/3/13
+ */
+@Slf4j
+@Service
+public class MedicalManagementService {
+    @Autowired
+    private MedicalManagementDao dao;
+    @Autowired
+    private PatientService patientService;
+    @Autowired
+    private RedisLikeService redisLikeService;
+
+
+    public ResultVo<Map<String,Object>> cqYzPrint(String patNo, Integer times) {
+       return getPrinInfo(patNo, times, 1);
+    }
+
+    public ResultVo<Map<String, Object>> lsYzPrint(String patNo, Integer times) {
+      return   getPrinInfo(patNo, times, 2);
+    }
+
+   private ResultVo<Map<String, Object>>  getPrinInfo(String patNo, Integer times,int type){
+       Map<String, Object> map = new HashMap<>(2);
+       List<YzPrintVO> yzPrintVOList ;
+       if(type == 1){
+           //长期医嘱
+           yzPrintVOList =  dao.getcqYzPrint(patNo,times);
+       }else {
+           yzPrintVOList = dao.getlsYzPrint(patNo,times);
+       }
+       if(CollUtil.isNotEmpty(yzPrintVOList)){
+           List<YzPrintVO> childrenList = yzPrintVOList.stream().filter(o -> o.getParentNo() != null ).collect(Collectors.toList());
+           Map<Long, List<YzPrintVO>> groupMap = null;
+           if(CollUtil.isNotEmpty(childrenList)) {
+                groupMap = childrenList.stream().collect(Collectors.groupingBy(o -> o.getParentNo()));
+           }
+           for (YzPrintVO obj: yzPrintVOList) {
+               obj.setOrderGroupNo("");
+               obj.setDate(DateUtil.format(obj.getStartTime(),"MM-dd"));
+               obj.setTime(DateUtil.format(obj.getStartTime(),"HH:ss"));
+               obj.setStopDate(DateUtil.format(obj.getEndTime(),"MM-dd"));
+               obj.setStopTime(DateUtil.format(obj.getEndTime(),"HH:ss"));
+               obj.setModifierName(getUserName(obj.getModifier()));
+               obj.setExecId2Name(getUserName(obj.getExecId2()));
+               obj.setExecName(getUserName(obj.getExecId()));
+               obj.setDoctorName(getUserName(obj.getDoctorCode()));
+               obj.setNurseName(getUserName(obj.getNurseCode()));
+               obj.setExecTimeStr(obj.getExecTime()==null ? "" : DateUtil.format(obj.getExecTime(),"MM-dd HH:ss"));
+               if(MapUtil.isNotEmpty(groupMap)){
+                    if(obj.getParentNo() == null && groupMap.containsKey(obj.getActOrderNo())){
+                        obj.setOrderGroupNo("┏");
+                    }else if(obj.getParentNo() != null){
+                        List<YzPrintVO> yzPrintVOS = groupMap.get(obj.getParentNo());
+                        if(obj.getActOrderNo() == yzPrintVOS.get(yzPrintVOS.size()-1).getActOrderNo()){
+                            obj.setOrderGroupNo("┗");
+                        }else {
+                            obj.setOrderGroupNo("┃");
+                        }
+                    }
+               }
+           }
+       }
+       Patient patientInfo = patientService.getPatientBaseInfo(patNo);
+       map.put("yzPrintVOList",yzPrintVOList);
+       map.put("patientInfo",patientInfo);
+       return ResultVoUtil.success(map);
+    }
+
+
+
+
+    private String getUserName(String code) {
+        UserInfo userInfo = redisLikeService.getUserInfoByCode(code);
+        return userInfo == null ? "" : userInfo.getName();
+    }
+
+
+    public List<Patient> queryPatientInfo(String ward,String patNo){
+       AssertUtil.isnotBlank(ward,"科室不能为空");
+       QueryWrapper<?> query = new QueryWrapper<>();
+       query.eq("a.ward", ward);
+       query.likeRight(StringUtil.notBlank(patNo),"a.inpatient_no", patNo);
+       List<Patient> patient = dao.queryPatientInfo(query);
+       return patient;
+   }
+
+}