package thyyxxk.webserver.dao.his.zhuyuanyisheng;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.*;
import thyyxxk.webserver.entity.casefrontsheet.YshHzRecord;
import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.*;
import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.dto.JyJcCheckItemDto;
import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.vo.ViewInspectionItemDetailsVo;
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.PatientTemp;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
* 描述: 检查申请
*
*
* @author xc
* @date 2022-02-10 15:42
*/
@Mapper
public interface JianYanJianChaDao {
@Select("select order_name,req_no,act_order_no, " +
"start_time,inpatient_no,admiss_times,receive_flag," +
"patient_uid,inspect_stuff_name = (select rtrim(name) from ysh_zd_part_code where code = inspect_stuff)," +
" (select rtrim(name)\n" +
" from ysh_zd_part_code\n" +
" where code = inspect_part) inspect_part_name " +
"from ysh_yj_req with (NOLOCK) " +
" ${ew.customSqlSegment} ")
List huoQuJianChaShenQingV2(@Param(Constants.WRAPPER) QueryWrapper> queryWrapper);
@Select("select req_no,\n" +
" inpatient_no,\n" +
" p_name,\n" +
" p_age,\n" +
" admiss_times,\n" +
" bed_no,\n" +
" p_bar_code,\n" +
" group_name,\n" +
" act_order_no,\n" +
" order_code,\n" +
" order_name,\n" +
" page_no,\n" +
" req_comment,\n" +
" req_doctor,\n" +
" req_dept,\n" +
" req_ward,\n" +
" exec_dept,\n" +
" req_date,\n" +
" sample_status,\n" +
" print_flag,\n" +
" receive_flag,\n" +
" req_type,\n" +
" result_comment,\n" +
" sys_date,\n" +
" start_time,\n" +
" isnull(diag_text,\n" +
" (select name\n" +
" from zd_icd_code_new\n" +
" where code = diag_code)) as diag_text,\n" +
" order_type,\n" +
" report_no,\n" +
" jz_flag,\n" +
" req_studyid,\n" +
" req_tz_comment,\n" +
" req_other_result,\n" +
" receive_jc,\n" +
" diag_code,\n" +
" confirm_flag,\n" +
" confirm_time,\n" +
" confirm_id,\n" +
" quantity,\n" +
" inspect_part,\n" +
" inspect_stuff,\n" +
" (select rtrim(name)\n" +
" from jy_zd_sample with (NOLOCK)\n" +
" where code = inspect_stuff) inspect_stuff_name,\n" +
" (select rtrim(name)\n" +
" from ysh_zd_part_code\n" +
" where code = inspect_part) inspect_part_name,\n" +
" (select rtrim(name)\n" +
" from zd_unit_code\n" +
" where code = req_dept) as req_dept_name,\n" +
" (select rtrim(name)\n" +
" from zd_unit_code\n" +
" where code = req_ward) as req_ward_name,\n" +
" (select rtrim(name)\n" +
" from a_employee_mi\n" +
" where code = req_doctor) as req_doctor_name,\n" +
" case\n" +
" when req_type = '2' then (select rtrim(class)\n" +
" from jy_zd_item c\n" +
" where c.zy_order_code = order_code)\n" +
" else '00'\n" +
" end classes\n" +
"from ysh_yj_req with (NOLOCK)" +
"${ew.customSqlSegment}")
List huoQuShengQingXiangQing(@Param("ew") QueryWrapper reqNo);
@Select("select top 1 sex, " +
" rtrim(home_street) as home_street," +
" rtrim(home_tel) as home_tel," +
" responceTypeName = (select responce_type_name = (select rtrim(name) from zy_zd_responce_type where code = responce_type) \n" +
"from zy_actpatient with (NOLOCK) \n" +
"where inpatient_no = #{patNo}) " +
"from a_patient_mi with (NOLOCK) " +
"where inpatient_no = #{patNo}")
PatientTemp huoQuHuanZheXinXi(@Param("patNo") String patNo);
@Select("select responce_type_name = (select rtrim(name) from zy_zd_responce_type where code = responce_type) " +
"from zy_actpatient with (NOLOCK) " +
"where inpatient_no = #{patNo}")
String huoQuHuanZheShenFen(@Param("patNo") String patNo);
@Select("select rtrim(comm) comm, " +
" comment1, " +
" comment2, " +
" comment3, " +
" comment4, " +
" comment5, " +
" comment6, " +
" comment7, " +
" comment8 " +
"from jc_zd_class with (NOLOCK) " +
"where code = #{code}")
JcZdClass daYingXiangQing(@Param("code") String code);
@Select("select tc_name as name," +
" rtrim(tc_no) as code," +
" '1' as isTheParentNode " +
"from zy_tc_yj c with (NOLOCK)" +
"where isnull(del_flag, '0') = '0' and " +
"${ew.sqlSegment}")
List getTemplate(@Param(Constants.WRAPPER) QueryWrapper> queryWrapper);
@Select("select op_id,tc_exec " +
"from zy_tc_yj with (NOLOCK) " +
"where tc_no = #{code}")
ZyTcYj jianChaLuRuRen(String code);
@Delete("delete zy_tc_yj " +
"where tc_no = #{code}; " +
"delete zy_tc_detail_yj " +
"where tc_no = #{code};")
void shanChuJianChaMuBan(String code);
@Select("SELECT rtrim(a.order_code) as orderCode, " +
" rtrim(a.order_name) as orderName, " +
" rtrim(a.order_code) as code, " +
" rtrim(a.order_name) as name, " +
" rtrim(a.yb_comment) ybComment, " +
" '0' as checkFlag, " +
" a.exec_dept as execDept, " +
" a.order_type as orderType, " +
" (select rtrim(name) from zd_unit_code with (NOLOCK) where code = a.exec_dept) execDeptName, " +
" CONVERT(varchar(100), GETDATE(), 20) as startTime," +
" inspect_stuff as inspectStuff , " +
" inspectStuffName = (select rtrim(name) from jy_zd_sample with (NOLOCK) where code = inspect_stuff)," +
" rtrim(c.tc_no) as tc_no," +
" '2' as isTheParentNode, " +
" case when c.req_type = '2' then (select rtrim(class) from jy_zd_item yj where yj.zy_order_code = a.order_code) " +
" else (select rtrim(class) from jc_zd_item yj where yj.zy_order_code = a.order_code) end as classes " +
"FROM yz_order_item a with (NOLOCK), " +
" zy_tc_detail_yj b with (NOLOCK), " +
" zy_tc_yj c with (NOLOCK) " +
"where b.tc_no = c.tc_no " +
" and a.order_code = b.order_code " +
" and isnull(a.del_flag, '') <> '1'" +
" and isnull(c.del_flag, '') <> '1' " +
" and ${ew.sqlSegment} " +
" order by sort_no desc ")
List