|
|
@@ -0,0 +1,216 @@
|
|
|
+package thyyxxk.webserver.dao.his.zhuyuanyiji;
|
|
|
+
|
|
|
+import org.apache.ibatis.annotations.*;
|
|
|
+import thyyxxk.webserver.entity.datamodify.MzChargeDetail;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 描述: 门诊项目确认或取消
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author xc
|
|
|
+ * @date 2021-10-09 15:16
|
|
|
+ */
|
|
|
+@Mapper
|
|
|
+public interface MenZhengXiangMuDao {
|
|
|
+
|
|
|
+ @Select("SELECT mz_patient_mi.name, " +
|
|
|
+ " mz_patient_mi.sex, " +
|
|
|
+ " mz_patient_mi.patient_id, " +
|
|
|
+ " ic_card_no = cast(mz_patient_mi.ic_card_no as varchar(50)), " +
|
|
|
+ " mz_patient_mi.birth_day, " +
|
|
|
+ " mz_patient_mi.phone_no, " +
|
|
|
+ " mz_patient_mi.adress , " +
|
|
|
+ " age=space(20), " +
|
|
|
+ " account_balance=0.00, " +
|
|
|
+ " account_status =space(2), " +
|
|
|
+ " times, " +
|
|
|
+ " response_type, " +
|
|
|
+ " yb_flag=space(1), " +
|
|
|
+ " by_flag=space(1), " +
|
|
|
+ " contract_code=contract_code, " +
|
|
|
+ " charge_type " +
|
|
|
+ "FROM mz_patient_mi " +
|
|
|
+ "where patient_id=#{patientId}")
|
|
|
+ MzChargeDetail getMzPatient(String patientId);
|
|
|
+
|
|
|
+
|
|
|
+ @Select("SELECT patient_id =max(a.patient_id), " +
|
|
|
+ " times =max(a.times), " +
|
|
|
+ " serial_no =a.serial_no, " +
|
|
|
+ " charge_date=max(a.charge_date) " +
|
|
|
+ "FROM mz_receipt_serial a " +
|
|
|
+ "where patient_id=#{patientId} and " +
|
|
|
+ " charge_date >= #{startTime} and " +
|
|
|
+ " charge_date <= #{endTime} and " +
|
|
|
+ " isnull(tf_flag,'') <> '1' " +
|
|
|
+ "group by serial_no " +
|
|
|
+ "having sum(total_charge) - sum(charge10 + charge11 + charge12) > 0")
|
|
|
+ List<MzChargeDetail> getFeiYong(@Param("patientId") String patientId,
|
|
|
+ @Param("startTime") String startTime,
|
|
|
+ @Param("endTime") String endTime);
|
|
|
+
|
|
|
+ @Select("SELECT patient_id =max(a.patient_id), " +
|
|
|
+ " times =max(a.times), " +
|
|
|
+ " serial_no =a.serial_no, " +
|
|
|
+ " charge_date=max(a.charge_date), " +
|
|
|
+ " confirm_date=max(a.confirm_time) " +
|
|
|
+ "FROM mz_charge_detail a ,zd_unit_code d " +
|
|
|
+ "where a.exec_dept=d.code and " +
|
|
|
+ " patient_id=#{patientId} and " +
|
|
|
+ " charge_date >= #{startTime} and " +
|
|
|
+ " charge_date <= #{endTime} and " +
|
|
|
+ " isnull(a.confirm_flag,'') in ('1','3') and " +
|
|
|
+ " (a.exec_dept=#{dept} or d.parent_code_hs=#{dept}) and " +
|
|
|
+ " a.pay_mark='0' and " +
|
|
|
+ " a.group_no='00' " +
|
|
|
+ "group by serial_no")
|
|
|
+ List<MzChargeDetail> getYiQueRenFeiYong(@Param("patientId") String patientId,
|
|
|
+ @Param("startTime") String startTime,
|
|
|
+ @Param("endTime") String endTime,
|
|
|
+ @Param("dept") String dept);
|
|
|
+
|
|
|
+ @Select("SELECT patient_id=a.patient_id, " +
|
|
|
+ " times=a.times, " +
|
|
|
+ " receipt_no=a.receipt_no, " +
|
|
|
+ " order_no=a.order_no, " +
|
|
|
+ " item_no=a.item_no, " +
|
|
|
+ " charge_code=a.charge_item_code, " +
|
|
|
+ " charge_name=b.name, " +
|
|
|
+ " je =round(quantity * unit_price,2), " +
|
|
|
+ " serial_no=a.serial_no, " +
|
|
|
+ " confirm_time=a.confirm_time, " +
|
|
|
+ " confirm_id=a.confirm_id, " +
|
|
|
+ " confirm_id_name = (select rtrim(name) name from a_employee_mi where a_employee_mi.code = confirm_id)," +
|
|
|
+ " exec_dept=a.exec_dept, " +
|
|
|
+ " exec_dept_name = (select rtrim(name) name from zd_unit_code where zd_unit_code.code = a.exec_dept), " +
|
|
|
+ " confirm_flag=isnull(a.confirm_flag,'0'), " +
|
|
|
+ " req_no =a.req_no " +
|
|
|
+ "FROM mz_charge_detail a ,zd_charge_item b " +
|
|
|
+ "where a.serial_no =#{serialNo} and " +
|
|
|
+ " a.pay_mark='0' and " +
|
|
|
+ " a.charge_item_code=b.code and " +
|
|
|
+ " isnull(a.req_no,0)=0 " +
|
|
|
+ " " +
|
|
|
+ "union " +
|
|
|
+ " " +
|
|
|
+ "SELECT patient_id=a.patient_id, " +
|
|
|
+ " times =a.times, " +
|
|
|
+ " receipt_no=a.receipt_no, " +
|
|
|
+ " order_no=a.order_no, " +
|
|
|
+ " item_no=a.item_no, " +
|
|
|
+ " charge_code=a.order_code, " +
|
|
|
+ " charge_name=b.name, " +
|
|
|
+ " je =0.00, " +
|
|
|
+ " serial_no =a.serial_no, " +
|
|
|
+ " confirm_time=a.confirm_time, " +
|
|
|
+ " confirm_id =a.confirm_id, " +
|
|
|
+ " confirm_id_name = (select rtrim(name) name from a_employee_mi where a_employee_mi.code = confirm_id), " +
|
|
|
+ " exec_dept =a.exec_dept, " +
|
|
|
+ " exec_dept_name = (select rtrim(name) name from zd_unit_code where zd_unit_code.code = a.exec_dept), " +
|
|
|
+ " confirm_flag=isnull(a.confirm_flag,'0'), " +
|
|
|
+ " req_no =a.req_no " +
|
|
|
+ "FROM mz_yj_req a ,jy_zd_item b " +
|
|
|
+ "where a.patient_id =#{patientId} and " +
|
|
|
+ " a.times =#{times} and " +
|
|
|
+ " a.pay_mark='0' and " +
|
|
|
+ " a.order_code =b.code and " +
|
|
|
+ " isnull(a.req_no,0) > 0 " +
|
|
|
+ "union " +
|
|
|
+ " " +
|
|
|
+ "SELECT patient_id=a.patient_id, " +
|
|
|
+ " times =a.times, " +
|
|
|
+ " receipt_no=a.receipt_no, " +
|
|
|
+ " order_no=a.order_no, " +
|
|
|
+ " item_no=a.item_no, " +
|
|
|
+ " charge_code=a.order_code, " +
|
|
|
+ " charge_name=b.name, " +
|
|
|
+ " je =0.00, " +
|
|
|
+ " serial_no =a.serial_no, " +
|
|
|
+ " confirm_time=a.confirm_time, " +
|
|
|
+ " confirm_id =a.confirm_id, " +
|
|
|
+ " confirm_id_name = (select rtrim(name) name from a_employee_mi where a_employee_mi.code = confirm_id)," +
|
|
|
+ " exec_dept =a.exec_dept, " +
|
|
|
+ " exec_dept_name = (select rtrim(name) name from zd_unit_code where zd_unit_code.code = a.exec_dept), " +
|
|
|
+ " confirm_flag=isnull(a.confirm_flag,'0'), " +
|
|
|
+ " req_no =a.req_no " +
|
|
|
+ "FROM mz_yj_req a ,jc_zd_item b " +
|
|
|
+ "where a.patient_id =#{patientId} and " +
|
|
|
+ " a.times =#{times} and " +
|
|
|
+ " a.pay_mark='0' and " +
|
|
|
+ " a.order_code =b.code and " +
|
|
|
+ " isnull(a.req_no,0) > 0")
|
|
|
+ List<MzChargeDetail> getFeiYongXiangXi(@Param("serialNo") Integer serialNo,
|
|
|
+ @Param("patientId") String patientId,
|
|
|
+ @Param("times") Integer times);
|
|
|
+
|
|
|
+
|
|
|
+ @Select("SELECT req_no =a.req_no, " +
|
|
|
+ " je =sum(round(quantity * unit_price,2)), " +
|
|
|
+ " charge_date=max(a.charge_date) " +
|
|
|
+ "FROM mz_charge_detail a ,zd_charge_item b " +
|
|
|
+ "where a.serial_no =#{serialNo} and " +
|
|
|
+ " a.pay_mark='0' and " +
|
|
|
+ " a.charge_item_code=b.code and " +
|
|
|
+ " a.req_no > 0 " +
|
|
|
+ "group by a.req_no")
|
|
|
+ List<MzChargeDetail> piPiJingEr(@Param("serialNo") Integer serialNo);
|
|
|
+
|
|
|
+
|
|
|
+ @Select("SELECT patient_id=a.patient_id, " +
|
|
|
+ " times=a.times, " +
|
|
|
+ " receipt_no=a.receipt_no, " +
|
|
|
+ " order_no=a.order_no, " +
|
|
|
+ " item_no=a.item_no, " +
|
|
|
+ " charge_code=a.charge_item_code, " +
|
|
|
+ " charge_name=b.name, " +
|
|
|
+ " je =round(quantity * unit_price,2), " +
|
|
|
+ " serial_no=a.serial_no, " +
|
|
|
+ " confirm_time=a.confirm_time, " +
|
|
|
+ " confirm_id=a.confirm_id, " +
|
|
|
+ " exec_dept=a.exec_dept, " +
|
|
|
+ " confirm_flag=a.confirm_flag, " +
|
|
|
+ " req_no =a.req_no " +
|
|
|
+ "FROM mz_charge_detail a ,zd_charge_item b " +
|
|
|
+ "where a.patient_id =#{patientId} and " +
|
|
|
+ " a.times =#{times} and " +
|
|
|
+ " a.req_no=#{reqNo} and " +
|
|
|
+ " a.pay_mark='0' and " +
|
|
|
+ " a.charge_item_code=b.code")
|
|
|
+ List<MzChargeDetail> getMingXi(@Param("patientId") String patientId,
|
|
|
+ @Param("times") Integer times,
|
|
|
+ @Param("reqNo") Integer reqNo);
|
|
|
+
|
|
|
+
|
|
|
+ @Update("<script>" +
|
|
|
+ "<foreach collection='list' item='item' separator=';'> " +
|
|
|
+ "update ${tableName} " +
|
|
|
+ "<set>" +
|
|
|
+ " confirm_flag = #{item.confirmFlag} , confirm_id =#{confirmId} , confirm_time =getdate() , exec_dept =#{execDept}" +
|
|
|
+ "</set>" +
|
|
|
+ "where " +
|
|
|
+ "patient_id = #{item.patientId} and times =#{item.times} and req_no =#{item.reqNo}" +
|
|
|
+ "</foreach>" +
|
|
|
+ "</script>")
|
|
|
+ void xiangMuQueRenHuoQuXiao(@Param("list") List<MzChargeDetail> list,
|
|
|
+ @Param("confirmId") String confirmId,
|
|
|
+ @Param("execDept") String execDept,
|
|
|
+ @Param("tableName") String tableName);
|
|
|
+
|
|
|
+ @Insert("<script>" +
|
|
|
+ "insert into yj_confirm_record_log ( patient_id , times , serial_no , order_no , item_no , item_name , req_no , confirm_flag , " +
|
|
|
+ "confirm_id , confirm_date , charge_date , name , item_je ) values " +
|
|
|
+ "<foreach collection='list' item='item' separator=','>" +
|
|
|
+ "( #{item.patientId} , #{item.times} , #{item.serialNo} , #{item.orderNo} , #{item.itemNo} , " +
|
|
|
+ "#{item.chargeName} , #{item.reqNo} , #{item.confirmFlag} , #{confirmId} , getdate() , " +
|
|
|
+ " #{chargeDateString} , #{name} , cast(#{item.je,jdbcType=DECIMAL} as decimal(14,5)) )" +
|
|
|
+ "</foreach>" +
|
|
|
+ "</script>")
|
|
|
+ void insertYjConfirmRecordLog(@Param("list") List<MzChargeDetail> list,
|
|
|
+ @Param("confirmId") String confirmId,
|
|
|
+ @Param("chargeDateString") String chargeDateString,
|
|
|
+ @Param("name") String name);
|
|
|
+
|
|
|
+}
|