SurgeryArrangementDao.java 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package thyyxxk.webserver.dao.his.surgicalmanagement;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.baomidou.mybatisplus.core.toolkit.Constants;
  4. import org.apache.ibatis.annotations.Mapper;
  5. import org.apache.ibatis.annotations.Param;
  6. import org.apache.ibatis.annotations.Select;
  7. import org.apache.ibatis.annotations.Update;
  8. import thyyxxk.webserver.entity.dictionary.CodeName;
  9. import thyyxxk.webserver.entity.zhuyuanyisheng.shoushu.OpRecord;
  10. import java.util.List;
  11. @Mapper
  12. public interface SurgeryArrangementDao {
  13. @Select("select rtrim(ward_code) as code, rtrim(ward_name) as name from zy_adtward")
  14. List<CodeName> getAllSurgicalWard();
  15. @Select("select code,name,status_flag from op_zd_room")
  16. List<CodeName> selectSurgeryRooms();
  17. @Select("select rtrim(code) as code,rtrim(name) as name from a_employee_mi " +
  18. "where dept_code='1300000' and isnull(del_flag,0)!=1")
  19. List<CodeName> selectSurgeryRoomStaffs();
  20. @Select("select a.record_id,op_start_date,op_end_date,anst_start_date,anst_end_date,a.sstc,a.req_date, " +
  21. "a.zy_serial_no,a.op_times,a.patient_name,a.dept_code,a.ward_code,a.apply_date,a.apply_user,a.apply_doc, " +
  22. "a.schedule_date,a.schedule_user,a.status,a.patient_type,a.act_order_no,a.op_code,a.op_name,a.op_datetime, " +
  23. "a.room_code,room_name=(select rtrim(d.name) from op_zd_room d where d.code=a.room_code),a.op_group_code, " +
  24. "a.hocus_code,hocus_name=(select rtrim(d.name) from zd_anaesthesia d where d.code=a.hocus_code), " +
  25. "a.diag_before_op,a.diag_after_op,a.infection_flag,a.urgent_clinic_flag,a.avocation_flag,a.blood_amount, " +
  26. "a.blood_type,a.op_stastics_id,a.isolation_indicator,a.op_scale,a.op_endtime,a.diag_before_code, " +
  27. "a.diag_after_code,a.hbsag,a.body_code,a.part_code,a.specialreq_code,a.instrument_code,a.aspesis_scale, " +
  28. "a.remark,a.op_dept,a.input_id,a.input_date,a.req_id,a.req_date,a.last_modify_id,a.arrange_id, " +
  29. "a.arrange_date,a.inpatient_no,a.admiss_times,a.cancel_id,a.cancel_time,b.doctor_zd,b.doctor_mz, " +
  30. "b.doctor_1,b.doctor_2,b.nurse_xh,b.nurse_qx,a.bed_no,a.arrangement_executed, " +
  31. "chargeSum=(select sum(d.charge_amount) from zy_detail_charge d where " +
  32. "d.inpatient_no=a.inpatient_no and d.ss_code=a.record_id), " +
  33. "sex=case when c.sex='1' then '男' else '女' end, " +
  34. "age=case when c.birth_date is null then '' " +
  35. "when datediff(year, c.birth_date, a.op_datetime) > 14 then " +
  36. "convert(varchar(2), datediff(year, c.birth_date, a.op_datetime)) + '岁' " +
  37. "when datediff(dd, c.birth_date, a.op_datetime) >= 365 then " +
  38. "convert(varchar(2), datediff(dd, c.birth_date, a.op_datetime) / 365) + '岁' + " +
  39. "convert(varchar(2), ((datediff(dd, c.birth_date, a.op_datetime) / 30) % 12)) + '月' " +
  40. "when datediff(dd, c.birth_date, a.op_datetime) < 30 then " +
  41. "convert(varchar(2), case datediff(dd, c.birth_date, a.op_datetime) " +
  42. "when 0 then 1 else datediff(dd, c.birth_date, a.op_datetime) end) + '天' " +
  43. "else convert(varchar(2), datediff(dd, c.birth_date, a.op_datetime) / 30) + '月' end, " +
  44. "a.tw_flag,b.doctor_mz_ys,b.doctor_mz_hs,rtrim(a.ssbc) as ssbc,b.doctor_zd_sj " +
  45. "FROM op_record a,op_record_join b,a_patient_mi c " +
  46. "where a.record_id=b.record_id and a.inpatient_no=c.inpatient_no and " +
  47. " ${ew.sqlSegment} order by a.urgent_clinic_flag desc, a.room_code")
  48. List<OpRecord> selectSurgeryArrangements(@Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
  49. @Update("update op_record set status=#{status} where record_id=#{recordId}")
  50. void updateSurgeryStatus(Integer recordId, String status);
  51. @Update("update ${table} set ${column}=#{value} where record_id=#{id}")
  52. void updateArrangement(String table, String column, String value, Integer id);
  53. @Select("select count(1) from dj_user_role where user_code=#{code} and role_id=51")
  54. Integer selectArrangementPermission(String code);
  55. }