Fix Bug #550: AI修复

This commit is contained in:
2026-05-27 03:00:08 +08:00
parent 8e6cb5c79f
commit 16c42ca108
5433 changed files with 171 additions and 778731 deletions

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.AccountMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.BizUserMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.BizUserRoleMapper">
</mapper>

View File

@@ -1,209 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.ChangePriceRecordMapper">
<select id="searchMedChangePriceByBusNo" resultType="com.openhis.administration.dto.ChangePriceDataDto">
select md.name as itemName,
record.origin_buying_price as originBuyingPrice,
record.new_buying_price as newBuyingPrice,
record.origin_retail_price as originRetailPrice,
record.new_retail_price as newRetailPrice,
record.reason as reason,
record.bus_no as busNo,
record.unit_code as unitCode,
med.total_volume as totalVolume,
sum(record.item_quantity) as itemQuantity,
sum(record.difference_buying_price) as differenceBuyingPrice,
sum(record.difference_retail_price) as differenceRetailPrice
from adm_change_price_record record
left join med_medication_definition md on record.item_id = md.id
left join med_medication med on medication_def_id = md.id
where record.bus_no = #{busNo}
and record.item_category_enum = #{categoryEnum}
<if test="statusEnum != null">
and record.status_enum = #{statusEnum}
</if>
group by md.name, record.origin_buying_price, record.new_buying_price, record.origin_retail_price,
record.new_retail_price, record.reason, record.bus_no,record.unit_code,med.total_volume
</select>
<select id="searchMedChangePriceByItemId" resultType="com.openhis.administration.dto.ChangePriceDataDto">
select md.name as itemName,
record.origin_buying_price as originBuyingPrice,
record.new_buying_price as newBuyingPrice,
record.origin_retail_price as originRetailPrice,
record.new_retail_price as newRetailPrice,
record.reason as reason,
record.bus_no as busNo,
record.unit_code as unitCode,
med.total_volume as totalVolume,
sum(record.item_quantity) as itemQuantity,
sum(record.difference_buying_price) as differenceBuyingPrice,
sum(record.difference_retail_price) as differenceRetailPrice
from adm_change_price_record record
left join med_medication_definition md on record.item_id = md.id
left join med_medication med on medication_def_id = md.id
where record.item_id = #{itemId}
and record.item_category_enum = #{categoryEnum}
and record.status_enum = #{statusEnum}
group by md.name, record.origin_buying_price, record.new_buying_price, record.origin_retail_price,
record.new_retail_price, record.reason, record.bus_no,record.unit_code,med.total_volume
</select>
<select id="searchDeviceChangePriceByBusNo" resultType="com.openhis.administration.dto.ChangePriceDataDto">
select deivce.name as itemName,
record.origin_buying_price as originBuyingPrice,
record.new_buying_price as newBuyingPrice,
record.origin_retail_price as originRetailPrice,
record.new_retail_price as newRetailPrice,
record.reason as reason,
record.bus_no as busNo,
deivce.size as totalVolume,
sum(record.item_quantity) as itemQuantity,
sum(record.difference_buying_price) as differenceBuyingPrice,
sum(record.difference_retail_price) as differenceRetailPrice
from adm_change_price_record record
left join adm_device_definition deivce on record.item_id = deivce.id
where record.bus_no = #{busNo}
and record.item_category_enum = #{categoryEnum}
<if test="statusEnum != null">
and record.status_enum = #{statusEnum}
</if>
group by deivce.name, record.origin_buying_price, record.new_buying_price, record.origin_retail_price,
record.new_retail_price, record.reason, record.bus_no,deivce.size
</select>
<select id="searchDeviceChangePriceByItemId" resultType="com.openhis.administration.dto.ChangePriceDataDto">
select deivce.name as itemName,
record.origin_buying_price as originBuyingPrice,
record.new_buying_price as newBuyingPrice,
record.origin_retail_price as originRetailPrice,
record.new_retail_price as newRetailPrice,
record.reason as reason,
record.bus_no as busNo,
deivce.size as totalVolume,
sum(record.item_quantity) as itemQuantity,
sum(record.difference_buying_price) as differenceBuyingPrice,
sum(record.difference_retail_price) as differenceRetailPrice
from adm_change_price_record record
left join adm_device_definition deivce on record.item_id = deivce.id
where record.item_id = #{itemId}
and record.item_category_enum = #{categoryEnum}
and record.status_enum = #{statusEnum}
group by deivce.name, record.origin_buying_price, record.new_buying_price, record.origin_retail_price,
record.new_retail_price, record.reason, record.bus_no,deivce.size
</select>
<select id="searchActivityChangePriceByBusNo" resultType="com.openhis.administration.dto.ChangePriceDataDto">
select activity.name as itemName,
record.origin_buying_price as originBuyingPrice,
record.new_buying_price as newBuyingPrice,
record.origin_retail_price as originRetailPrice,
record.new_retail_price as newRetailPrice,
record.reason as reason,
record.bus_no as busNo,
sum(record.item_quantity) as itemQuantity,
sum(record.difference_buying_price) as differenceBuyingPrice,
sum(record.difference_retail_price) as differenceRetailPrice
from adm_change_price_record record
left join wor_activity_definition activity on record.item_id = activity.id
where record.bus_no = #{busNo}
and record.item_category_enum = #{categoryEnum}
<if test="statusEnum != null">
and record.status_enum = #{statusEnum}
</if>
group by activity.name, record.origin_buying_price, record.new_buying_price, record.origin_retail_price,
record.new_retail_price, record.reason, record.bus_no
</select>
<select id="searchActivityChangePriceByItemId" resultType="com.openhis.administration.dto.ChangePriceDataDto">
select activity.name as itemName,
record.origin_buying_price as originBuyingPrice,
record.new_buying_price as newBuyingPrice,
record.origin_retail_price as originRetailPrice,
record.new_retail_price as newRetailPrice,
record.reason as reason,
record.bus_no as busNo,
sum(record.item_quantity) as itemQuantity,
sum(record.difference_buying_price) as differenceBuyingPrice,
sum(record.difference_retail_price) as differenceRetailPrice
from adm_change_price_record record
left join wor_activity_definition activity on record.item_id = activity.id
where record.item_id = #{itemId}
and record.item_category_enum = #{categoryEnum}
and record.status_enum = #{statusEnum}
group by activity.name, record.origin_buying_price, record.new_buying_price, record.origin_retail_price,
record.new_retail_price, record.reason, record.bus_no
</select>
<select id="searchHealthChangePriceByBusNo" resultType="com.openhis.administration.dto.ChangePriceDataDto">
select hearlth.name as itemName,
org.name as orgName,
record.origin_buying_price as originBuyingPrice,
record.new_buying_price as newBuyingPrice,
record.origin_retail_price as originRetailPrice,
record.new_retail_price as newRetailPrice,
record.reason as reason,
record.bus_no as busNo,
sum(record.item_quantity) as itemQuantity,
sum(record.difference_buying_price) as differenceBuyingPrice,
sum(record.difference_retail_price) as differenceRetailPrice
from adm_change_price_record record
left join adm_healthcare_service hearlth on record.item_id = hearlth.id
left join adm_organization org on hearlth.offered_org_id = org.id
where record.bus_no = #{busNo}
and record.item_category_enum = #{categoryEnum}
<if test="statusEnum != null">
and record.status_enum = #{statusEnum}
</if>
group by hearlth.name, record.origin_buying_price, record.new_buying_price, record.origin_retail_price,
record.new_retail_price, record.reason, record.bus_no, org.name
</select>
<select id="searchHealthChangePriceByItemId" resultType="com.openhis.administration.dto.ChangePriceDataDto">
select hearlth.name as itemName,
org.name as orgName,
record.origin_buying_price as originBuyingPrice,
record.new_buying_price as newBuyingPrice,
record.origin_retail_price as originRetailPrice,
record.new_retail_price as newRetailPrice,
record.reason as reason,
record.bus_no as busNo,
sum(record.item_quantity) as itemQuantity,
sum(record.difference_buying_price) as differenceBuyingPrice,
sum(record.difference_retail_price) as differenceRetailPrice
from adm_change_price_record record
left join adm_healthcare_service hearlth on record.item_id = hearlth.id
left join adm_organization org on hearlth.offered_org_id = org.id
where record.item_id = #{itemId}
and record.item_category_enum = #{categoryEnum}
and record.status_enum = #{statusEnum}
group by hearlth.name, record.origin_buying_price, record.new_buying_price, record.origin_retail_price,
record.new_retail_price, record.reason, record.bus_no, org.name
</select>
<select id="searchChangePriceRecordDataByBusNo" resultType="com.openhis.administration.dto.ChangePriceDataDto">
select record.origin_buying_price as originBuyingPrice,
record.new_buying_price as newBuyingPrice,
record.origin_retail_price as originRetailPrice,
record.new_retail_price as newRetailPrice,
record.reason as reason,
record.bus_no as busNo,
cid.id as chargeId,
record.id as changePriceRecordId,
record.lot_number as lotNumber
from adm_change_price_record record
left join adm_charge_item_definition cid on record.item_id = cid.instance_id
where record.bus_no = #{busNo}
and record.status_enum = #{statusEnum}
and cid.status_enum = 2
</select>
<select id="searchChangePriceDataGroupByBusNo" resultType="com.openhis.administration.domain.ChangePriceRecord">
select
bus_no as busNo,applicant_time as applicantTime,status_enum as statusEnum,item_id as itemId
from adm_change_price_record where bus_no = #{busNo} group by busNo,applicantTime,statusEnum,item_id
</select>
</mapper>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.ChargeItemDefDetailAppMapper">
<select id="searchChargeDetailDataByBusNo" resultType="com.openhis.administration.domain.ChargeItemDefDetail">
select create_time
from adm_charge_item_def_detail
where
condition_value = #{value} and condition_code = #{code} and (delete_flag = '0' or delete_flag = '1')
</select>
</mapper>

View File

@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.ChargeItemDefinitionMapper">
<select id="getMedPriceByParam" resultType="com.openhis.administration.dto.ChargeItemDefDetailPriceDto">
SELECT cidd.amount as price, mmd.part_percent as partPercent
from adm_charge_item_definition cid
left join adm_charge_item_def_detail cidd on cid.id = cidd.definition_id
left join med_medication_definition mmd on cid.instance_id = mmd.id
where cidd.condition_code = #{conditionCode}
and cid.instance_id = #{instanceId}
and cidd.delete_flag = '0'
order by cidd.create_time desc limit 1
</select>
<select id="getDevicePriceByParam" resultType="com.openhis.administration.dto.ChargeItemDefDetailPriceDto">
SELECT cidd.amount as price, device.part_percent as partPercent
from adm_charge_item_definition cid
left join adm_charge_item_def_detail cidd on cid.id = cidd.definition_id
left join adm_device_definition device on cid.instance_id = device.id
where cidd.condition_code = #{conditionCode}
and cid.instance_id = #{instanceId}
and cidd.delete_flag = '0'
order by cidd.create_time desc limit 1
</select>
<select id="getProductPrice" resultType="com.openhis.administration.dto.ChargeItemDefDetailPriceDto">
SELECT cid.price as price
from adm_charge_item_definition cid
where cid.instance_id = #{instanceId}
and cid.status_enum = #{statusEnum}
and cid.delete_flag = '0'
order by cid.create_time desc limit 1
</select>
</mapper>

View File

@@ -1,353 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.ChargeItemMapper">
<select id="getChargeItemBaseInfoByIds" resultType="com.openhis.administration.dto.ChargeItemBaseInfoDto">
SELECT
a.id ,
a.status_enum ,
a.bus_no ,
a.patient_id ,
a.context_enum ,
a.encounter_id ,
a.occurrence_time ,
a.performer_id ,
a.performing_org_id ,
a.requesting_org_id ,
a.cost_org_id ,
a.quantity_value ,
a.quantity_unit ,
a.unit_price ,
a.total_price ,
a.definition_id ,
a.def_detail_id ,
a.base_amount ,
a.discount_amount ,
a.surcharge_amount ,
a.override_reason_code ,
a.override_reason_text ,
a.enterer_id ,
a.entered_date ,
a.service_table ,
a.service_id ,
a.claim_state_enum ,
a.account_id ,
a.org_id ,
a.tenant_id ,
a.delete_flag ,
a.create_by ,
a.create_time ,
a.update_by ,
a.update_time ,
a.print_count ,
a.product_table ,
a.product_id ,
a.refund_id ,
a.prescription_no ,
a.generate_source_enum ,
a.children_json ,
a.condition_id ,
a.encounter_diagnosis_id ,
a.tcm_flag ,
COALESCE(b1.bus_no, b2.bus_no, b3.bus_no) AS request_bus_no,
COALESCE(b6.bus_no, b7.bus_no, b8.bus_no) AS base_bus_no,
COALESCE(b6.name, b7.name, b8.name) AS "name",
COALESCE(b6.category_code, b7.category_code, b8.category_code) AS category_code,
COALESCE(b6.approval_number, b7.approval_number) AS approval_number,
COALESCE(b6.yb_no, b7.yb_no, b8.yb_no) AS yb_no,
CASE WHEN b6.children_flag is NOT NULL THEN b6.children_flag ELSE '0' END AS children_flag,
COALESCE(b6.chrgitm_lv, b7.chrgitm_lv, b8.chrgitm_lv) AS chrgitm_lv,
CASE WHEN b6.rx_flag is NOT NULL THEN b6.rx_flag ELSE 0 END AS children_flag,
COALESCE(b1.yb_class_enum, b2.yb_class_enum, b3.yb_class_enum) AS yb_class_enum,
COALESCE(b1.trace_no, b2.trace_no) AS trace_no,
CASE WHEN b1.suffering_flag is NOT NULL THEN b1.suffering_flag ELSE 0 END AS suffering_flag,
b5.yb_type,
org."name" as dept_name,
org.yb_no as dept_yb_no,
pra."name" as doct_name,
pra.yb_no as doct_yb_no,
contract.bus_no as contract_no,
T2.charge_name,
T2.title,
T2.status_enum,
T2.org_id,
T2.description,
T2.instance_table,
T2.instance_id,
T2.effective_start,
T2.effective_end,
T2.type_code,
T2.yb_type,
T2.condition_flag,
T2.price
-- 添加更多需要的字段
FROM
adm_charge_item a
LEFT JOIN
adm_charge_item_definition T2 ON a.definition_id = T2.ID AND T2.delete_flag = '0'
LEFT JOIN
med_medication_request b1 ON a.service_id = b1.id AND a.service_table = 'med_medication_request'
LEFT JOIN
wor_device_request b2 ON a.service_id = b2.id AND a.service_table = 'wor_device_request'
LEFT JOIN
wor_service_request b3 ON a.service_id = b3.id AND a.service_table = 'wor_service_request'
LEFT JOIN
adm_healthcare_service b4 ON a.service_id = b4.id AND a.service_table = 'adm_healthcare_service'
LEFT JOIN
med_medication_definition b6 ON a.product_id = b6.id AND a.product_table = 'med_medication_definition'
LEFT JOIN
adm_device_definition b7 ON a.product_id = b7.id AND a.product_table = 'adm_device_definition'
LEFT JOIN
wor_activity_definition b8 ON a.product_id = b8.id AND a.product_table = 'wor_activity_definition'
LEFT JOIN
adm_charge_item_definition b5 ON a.definition_id = b5.id
LEFT JOIN
adm_organization org ON a.requesting_org_id = org.id
LEFT JOIN
adm_practitioner pra ON a.enterer_id = pra.id
LEFT JOIN
adm_account acc ON a.account_id = acc.id
LEFT JOIN
fin_contract contract ON acc.contract_no = contract.bus_no
WHERE
a.delete_flag = '0'
AND
a.id IN
<foreach collection="chargeItemIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getChargeItemDefInfoByIds" resultType="com.openhis.administration.dto.ChargeItemDefInfo">
SELECT
T1.id,
T1.status_enum,
T1.generate_source_enum,
T1.bus_no,
T1.prescription_no,
T1.patient_id,
T1.context_enum,
T1.encounter_id,
T1.occurrence_time,
T1.performer_id,
T1.performing_org_id,
T1.requesting_org_id,
T1.cost_org_id,
T1.quantity_value,
T1.quantity_unit,
T1.unit_price,
T1.total_price,
T1.definition_id,
T1.def_detail_id,
T1.base_amount,
T1.discount_amount,
T1.surcharge_amount,
T1.override_reason_code,
T1.override_reason_text,
T1.enterer_id,
T1.entered_date,
T1.service_table,
T1.service_id,
T1.product_table,
T1.product_id,
T1.claim_state_enum,
T1.print_count,
T1.account_id,
T1.org_id,
T1.refund_id,
T1.children_json,
T1.condition_id,
T1.encounter_diagnosis_id,
T1.tcm_flag,
T1.create_time,
T1.create_by,
T1.update_time,
T1.update_by,
T1.system_discount_price,
T1.manual_adjusted_price,
T2.charge_name,
T2.title,
T2.status_enum,
T2.org_id,
T2.description,
T2.instance_table,
T2.instance_id,
T2.effective_start,
T2.effective_end,
T2.type_code,
T2.yb_type,
T2.condition_flag,
T2.price
FROM
adm_charge_item T1
LEFT JOIN adm_charge_item_definition T2 ON T1.definition_id = T2.ID
AND T2.delete_flag = '0'
WHERE
T1.id IN
<foreach collection="chargeItemIds" item="itemId" open="(" separator="," close=")">
#{itemId}
</foreach>
AND T1.delete_flag = '0'
</select>
<!-- 查询费用明细 -->
<select id="getCostDetails" resultType="com.openhis.administration.dto.CostDetailDto">
SELECT final_res.charge_name,
final_res.charge_item_enum,
final_res.unit_price,
final_res.quantity_value,
final_res.total_price,
final_res.org_id,
final_res.practitioner,
final_res.recorded_time,
final_res.chrgitm_lv,
final_res.remark,
final_res.encounter_id,
final_res.patient_id,
final_res.patient_name,
final_res.birth_date,
final_res.gender_enum,
final_res.bus_no,
final_res.bed_name,
final_res.condition_names,
final_res.admitting_doctor_name,
final_res.balance_amount,
final_res.contract_name
FROM (WITH execution_table AS (SELECT cp.request_id,
cp.org_id,
ap.NAME,
cp.occurrence_time AS recorded_time
FROM cli_procedure cp
LEFT JOIN cli_procedure_performer cpp ON cpp.procedure_id = cp.ID
AND cpp.delete_flag = '0'
LEFT JOIN adm_practitioner ap ON ap.ID = cpp.practitioner_id
AND ap.active_flag = 1
AND ap.delete_flag = '0'
WHERE cp.delete_flag = '0'),
diagnosis AS (SELECT aed.encounter_id,
STRING_AGG(ccd.NAME, ', ') AS condition_names
FROM adm_encounter_diagnosis aed
INNER JOIN cli_condition cc ON cc.ID = aed.condition_id
AND cc.delete_flag = '0'
INNER JOIN cli_condition_definition ccd ON ccd.ID = cc.definition_id
AND ccd.delete_flag = '0'
WHERE aed.delete_flag = '0'
GROUP BY aed.encounter_id),
hospitalization AS (SELECT aep.encounter_id,
pra.NAME
FROM adm_encounter_participant aep
LEFT JOIN adm_practitioner pra ON aep.practitioner_id = pra.ID
AND pra.delete_flag = '0'
WHERE aep.delete_flag = '0'
AND aep.status_enum = #{ active }
AND aep.type_code = #{ admittingDoctor }),
account AS (SELECT aa.ID,
aa.encounter_id,
(
aa.balance_amount - COALESCE(SUM(CASE
WHEN aci.status_enum IN (#{ billed }, #{ billable })
THEN aci.total_price
ELSE 0 END), 0) + COALESCE(
SUM(CASE WHEN aci.status_enum = #{refunded} THEN aci.total_price ELSE 0 END),
0)
) AS balance_amount
FROM adm_account aa
LEFT JOIN adm_charge_item aci ON aa.encounter_id = aci.encounter_id
AND aci.delete_flag = '0'
WHERE aa.type_code = #{ personalCashAccount }
AND aa.delete_flag = '0'
GROUP BY aa.ID,
aa.encounter_id,
aa.balance_amount),
contract AS (SELECT fc.contract_name, aa.encounter_id
FROM adm_account aa
LEFT JOIN fin_contract fc ON aa.contract_no = fc.bus_no AND fc.delete_flag = '0'
WHERE aa.encounter_flag = 1
AND aa.delete_flag = '0')
SELECT T1.tenant_id,
T2.charge_name,
T2.yb_type AS charge_item_enum,
T1.unit_price,
T1.quantity_value,
T1.total_price,
T6.org_id,
T6.NAME AS practitioner,
T6.recorded_time,
CASE
WHEN T2.instance_table = 'adm_device_definition' THEN
T3.chrgitm_lv
WHEN T2.instance_table = 'med_medication_definition' THEN
T4.chrgitm_lv
WHEN T2.instance_table = 'wor_activity_definition' THEN
T5.chrgitm_lv
ELSE NULL
END AS chrgitm_lv,
'' AS remark,
T1.encounter_id,
T1.patient_id,
T7.NAME AS patient_name,
T7.birth_date,
T7.gender_enum,
T8.bus_no,
T10.NAME AS bed_name,
T11.condition_names,
T12.NAME AS admitting_doctor_name,
T13.balance_amount,
T14.contract_name
FROM adm_charge_item T1
LEFT JOIN adm_charge_item_definition T2 ON T2.ID = T1.definition_id
AND T2.delete_flag = '0'
LEFT JOIN adm_device_definition T3 ON T2.instance_id = T3.ID
AND T2.instance_table = 'adm_device_definition'
AND T3.delete_flag = '0'
LEFT JOIN med_medication_definition T4 ON T2.instance_id = T4.ID
AND T2.instance_table = 'med_medication_definition'
AND T4.delete_flag = '0'
LEFT JOIN wor_activity_definition T5 ON T2.instance_id = T5.ID
AND T2.instance_table = 'wor_activity_definition'
AND T5.delete_flag = '0'
LEFT JOIN execution_table T6 ON T6.request_id = T1.service_id
LEFT JOIN adm_patient T7 ON T7.ID = T1.patient_id
AND T7.delete_flag = '0'
LEFT JOIN adm_encounter T8 ON T8.ID = T1.encounter_id
AND T8.delete_flag = '0'
LEFT JOIN adm_encounter_location T9 ON T8.ID = T9.encounter_id
AND T9.delete_flag = '0'
AND T9.status_enum = #{active}
AND T9.form_enum = #{bed}
LEFT JOIN adm_location T10 ON T9.location_id = T10.ID
AND T10.delete_flag = '0'
LEFT JOIN diagnosis T11 ON T1.encounter_id = T11.encounter_id
LEFT JOIN hospitalization T12 ON T1.encounter_id = T12.encounter_id
LEFT JOIN account T13 ON T1.encounter_id = T13.encounter_id
LEFT JOIN contract T14 ON T1.encounter_id = T14.encounter_id
WHERE T1.delete_flag = '0'
GROUP BY T1.tenant_id,
T2.charge_name,
T2.yb_type,
T1.unit_price,
T1.quantity_value,
T1.total_price,
T6.org_id,
T6.NAME,
T6.recorded_time,
T2.instance_table,
T3.chrgitm_lv,
T4.chrgitm_lv,
T5.chrgitm_lv,
T1.encounter_id,
T1.patient_id,
T7.NAME,
T7.birth_date,
T7.gender_enum,
T8.bus_no,
T10.NAME,
T11.condition_names,
T12.NAME,
T13.balance_amount,
T14.contract_name
ORDER BY T6.recorded_time DESC) final_res
${ew.customSqlSegment}
</select>
</mapper>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.DeviceDefinitionMapper">
<!-- 根据关键字查询 如果关键字为空查询10条否则返回查询到的所有 -->
<select id="searchDeviceListByKeyWord" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
select df.id as targetId, df.name as name, df.size as volume, details.amount as
originRetailPrice,def_details.amount as originBuyingPrice,df.bus_no as busNo,df.min_unit_code as unitCode
from adm_device_definition df
inner join adm_charge_item_definition actd on actd.instance_id = df.id
left join adm_charge_item_def_detail details on actd.id = details.definition_id
and details.id = (select cidd.id from adm_charge_item_def_detail cidd where actd.id = cidd.definition_id and
cidd.condition_code = '5' and cidd.delete_flag = '0' ORDER BY create_time DESC
LIMIT 1)
left join adm_charge_item_def_detail def_details on actd.id = def_details.definition_id
and def_details.id = (select cidd.id from adm_charge_item_def_detail cidd where actd.id = cidd.definition_id and
cidd.condition_code = '1' and cidd.delete_flag = '0' ORDER BY create_time DESC
LIMIT 1)
WHERE 1 = 1 and df.id in (select inventoty.item_id FROM wor_inventory_item inventoty where
inventoty.quantity > 0 and inventoty.delete_flag = '0' )
<if test="keyWord == ''">
limit 10
</if>
<if test="keyWord !=''">
and
(df.name like concat('%',#{keyWord},'%') or df.py_str like concat('%',#{keyWord},'%') or df.wb_str like
concat('%',#{keyWord},'%'))
</if>
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.DeviceMapper">
</mapper>

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.EncounterDiagnosisMapper">
<delete id="deleteByEncounterId">
DELETE
FROM adm_encounter_diagnosis
WHERE encounter_id = #{encounterId}
AND tcm_flag = 0
</delete>
<delete id="deleteTcmByEncounterId">
DELETE
FROM adm_encounter_diagnosis
WHERE encounter_id = #{encounterId}
AND tcm_flag = 0
</delete>
<select id="getEncounterDiagnosisByEncounterConDefId"
resultType="com.openhis.administration.domain.EncounterDiagnosis">
SELECT *
FROM adm_encounter_diagnosis T1
INNER JOIN cli_condition T2 ON T1.condition_id = T2.id
WHERE T1.encounter_id = #{encounterId}
AND T2.definition_id = #{conditionDefId}
AND T1.delete_flag = '0'
AND T2.delete_flag = '0'
AND T1.tenant_id = #{tenantId}
</select>
</mapper>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.EncounterLocationMapper">
<select id="searchEncounterDataByLocationId" resultType="com.openhis.administration.dto.PatientBedInfoDto">
select encounter_id as encounterId , location_id as bedLocationId
from adm_encounter_location where location_id = #{locationId} and status_enum = #{statusEnum} and form_enum = #{formEnum}
</select>
</mapper>

View File

@@ -1,65 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.EncounterMapper">
<select id="getEncounterInfoByTime" resultType="com.openhis.administration.dto.EncounterAccountDto">
SELECT T1.ID,
T1.patient_id,
T1.group_id,
T1.bus_no,
T1.status_enum,
T1.class_enum,
T1.yb_class_enum,
T1.yb_class_text,
T1.class_json,
T1.priority_enum,
T1.type_enum,
T1.service_type_id,
T1.subject_status_enum,
T1.start_time,
T1.end_time,
T1.reception_time,
T1.organization_id,
T1.display_order,
T1.first_enum,
T1.admit_source_code,
T1.in_way_code,
T1.amb_encounter_id,
T1.registrar_id,
T2.status_enum,
T2.billing_status_enum,
T2.type_code,
T2.NO,
T2.NAME,
T2.patient_id,
T2.encounter_id,
T2.balance_amount,
T2.yb_area_no,
T2.contract_no,
T2.limit_account,
T2.encounter_flag
FROM adm_encounter T1
LEFT JOIN adm_account T2 ON T1.ID = T2.encounter_id
AND T2.encounter_flag = 1
AND T2.delete_flag = '0'
WHERE T1.create_time &gt;
#{startDate}
AND T1.create_time &lt;
#{endDate};
</select>
<select id="searchEncounterDataByIds" resultType="com.openhis.administration.dto.EncounterDataDto">
select * from adm_encounter
where (class_enum = #{imp} or class_enum = #{amb}) and status_enum = #{encounterStatus}
and id in
<foreach collection="encounterIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getPatientIdByParam" resultType="com.openhis.administration.dto.EncounterDataDto">
select patient_id as patientId,id as encounterId
from adm_encounter encounter where id = #{encounterId} and class_enum = #{classEnum}
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.EncounterParticipantMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.EncounterReasonMapper">
</mapper>

View File

@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.FrequencyMapper">
<resultMap id="BaseResultMap" type="com.openhis.administration.domain.Frequency">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="rateCode" column="rate_code" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="dayCount" column="day_count" jdbcType="INTEGER"/>
<result property="dayInterval" column="day_interval" jdbcType="INTEGER"/>
<result property="dayTimes" column="day_times" jdbcType="VARCHAR"/>
<result property="weekCycleFlag" column="week_cycle_flag" jdbcType="INTEGER"/>
<result property="weekInterval" column="week_interval" jdbcType="INTEGER"/>
<result property="weekTimes" column="week_times" jdbcType="INTEGER"/>
<result property="continueFlag" column="continue_flag" jdbcType="INTEGER"/>
<result property="totalExecutionCount" column="total_execution_count" jdbcType="INTEGER"/>
<result property="executionPeriod" column="execution_period" jdbcType="INTEGER"/>
<result property="executionPeriodUnit" column="execution_period_unit" jdbcType="VARCHAR"/>
<result property="thirdCode" column="third_code" jdbcType="VARCHAR"/>
<result property="memo" column="memo" jdbcType="VARCHAR"/>
<result property="concurrencyStamp" column="concurrency_stamp" jdbcType="INTEGER"/>
<result property="tenantId" column="tenant_id" jdbcType="BIGINT"/>
<result property="deleteFlag" column="delete_flag" jdbcType="CHAR"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,rate_code,name,
day_count,day_interval,day_times,
week_cycle_flag,week_interval,week_times,
continue_flag,total_execution_count,execution_period,
execution_period_unit,third_code,memo,
concurrency_stamp,tenant_id,delete_flag,
create_by,create_time,update_by,
update_time
</sql>
</mapper>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.HealthcareServiceMapper">
<select id="searchHealthByIds" resultType="com.openhis.administration.dto.HealthcareDto">
<!-- 根据项目id数组 加载挂号集合 -->
SELECT
health.id as itemId,
health.offered_org_id as orgId,health.name as name,health.category_code as categoryCode,health.type_code as
typeCode
FROM adm_healthcare_service as health
WHERE health.ID IN
<foreach collection="itemIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!-- 查询所有 挂号数据 -->
<select id="searchAllHeathData" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
SELECT heal.id AS targetId,heal.name AS name,cid.price AS originRetailPrice,org.name as orgName
FROM public.adm_healthcare_service heal
INNER JOIN adm_charge_item_definition cid ON heal.id = cid.instance_id
INNER JOIN adm_organization org ON heal.offered_org_id = org.id
WHERE heal.delete_flag = '0' AND heal.offered_org_id = #{orgId} AND cid.status_enum = #{statusEnum}
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.InstrumentMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.InvoiceMapper">
</mapper>

View File

@@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.LocationMapper">
<!-- 根据区域id数组查询 区域表 -->
<select id="searchLocationDataByIds" resultType="com.openhis.administration.dto.LocationDataDto">
select id as locationId,
bus_no as busNo,
name as areaName,
status_enum as statusEnum,
mode_enum as modeEnum,
operational_enum as operationalEnum
from adm_location
where delete_flag = '0'
and id in
<foreach collection="locationIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!-- 根据区域id数组查询 区域表 -->
<select id="searchLocationDataByBusNo" resultType="com.openhis.administration.dto.PatientBedInfoDto">
select id as bedLocationId,
bus_no as busNo,
name as bedName,
status_enum as statusEnum,
mode_enum as modeEnum,
operational_enum as operationalEnum
from adm_location
where delete_flag = '0'
and bus_no like concat(#{busNo}, '%')
and form_enum = #{formEnum}
and status_enum = #{statusEnum}
</select>
<select id="isExistName" resultType="java.lang.Boolean">
SELECT EXISTS (SELECT 1
FROM adm_location
WHERE REPLACE(REPLACE(name, ' ', ''), ' ', '') = #{name}
<if test="locId != null">
AND id != #{locId}
</if>
<if test="busNo != null">
AND bus_no like CONCAT(#{busNo}, '%')
</if>
AND delete_flag = #{delFlag}) AS exists_flag;
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.ObservationDefinitionMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.OrgContrastMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.OrganizationLocationMapper">
</mapper>

View File

@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.OrganizationMapper">
<select id="searchOrgDataByHealth" resultType="com.openhis.administration.dto.OrgDataDto">
SELECT org.id AS orgId, org.name AS orgName
FROM adm_organization AS org
WHERE id IN
(SELECT offered_org_id
FROM adm_healthcare_service heal
WHERE heal.delete_flag = '0'
GROUP BY heal.offered_org_id)
</select>
<!-- 分页查询挂号科室列表,关联租户表获取租户名称 -->
<select id="selectRegisterOrganizationsWithTenant" resultType="com.openhis.administration.domain.Organization">
SELECT
org.id,
org.bus_no,
org.name,
org.active_flag,
org.type_enum,
org.class_enum,
org.py_str,
org.wb_str,
org.yb_no,
org.yb_name,
org.caty,
org.display_order,
org.medins_id,
org.medins_admdvs,
org.medins_type,
org.medins_lv,
org.def_doctor_id,
org.register_flag,
org.location,
org.intro,
org.remark,
org.tenant_id,
org.delete_flag,
org.create_by,
org.create_time,
org.update_by,
org.update_time,
st.tenant_name AS tenantName
FROM adm_organization org
LEFT JOIN sys_tenant st ON org.tenant_id = st.id
<where>
<if test="registerFlag != null">
AND org.register_flag = #{registerFlag}
</if>
<if test="deleteFlag != null">
AND org.delete_flag = #{deleteFlag}
</if>
<if test="name != null and name != ''">
AND org.name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="orgName != null and orgName != ''">
AND st.tenant_name = #{orgName}
</if>
</where>
ORDER BY org.bus_no ASC
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.PatientIdentifierMapper">
</mapper>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.PatientMapper">
<select id="searchPatientDataByPatientId" resultType="com.openhis.administration.dto.PatientDataDto">
select id as patientId,name as patientName,gender_enum as gender,id_card as idCard from adm_patient
where delete_flag = '0' and id = #{patientId} and active_flag = #{activeFlag}
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.PatientStudentMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.PractitionerMapper">
</mapper>

View File

@@ -1,111 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.PractitionerPatientMapper">
<resultMap type="com.openhis.administration.domain.PractitionerPatient" id="PractitionerPatientResult">
<result property="id" column="id" />
<result property="practitionerId" column="practitioner_id" />
<result property="patientId" column="patient_id" />
<result property="relationshipType" column="relationship_type" />
<result property="organizationId" column="organization_id" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="tenantId" column="tenant_id" />
<result property="deleteFlag" column="delete_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectPractitionerPatientVo">
select id, practitioner_id, patient_id, relationship_type, organization_id,
start_date, end_date, status, remark, tenant_id,
delete_flag, create_by, create_time, update_by, update_time
from adm_practitioner_patient
</sql>
<select id="selectPractitionerPatientList" parameterType="com.openhis.administration.domain.PractitionerPatient" resultMap="PractitionerPatientResult">
<include refid="selectPractitionerPatientVo"/>
<where>
delete_flag = '0'
<if test="practitionerId != null">
and practitioner_id = #{practitionerId}
</if>
<if test="patientId != null">
and patient_id = #{patientId}
</if>
<if test="relationshipType != null">
and relationship_type = #{relationshipType}
</if>
<if test="organizationId != null">
and organization_id = #{organizationId}
</if>
<if test="status != null">
and status = #{status}
</if>
</where>
order by create_time desc
</select>
<select id="selectPractitionerPatientById" parameterType="Long" resultMap="PractitionerPatientResult">
<include refid="selectPractitionerPatientVo"/>
where id = #{id} and delete_flag = '0'
</select>
<!-- 获取医生的所有有效患者(带详细信息) -->
<select id="getValidPatientsByPractitionerWithDetail" parameterType="Long" resultType="java.util.Map">
SELECT
pp.id as relationship_id,
pp.practitioner_id,
pp.patient_id,
pp.relationship_type,
pp.start_date,
pp.end_date,
pp.status,
pp.remark,
pt.name as patient_name,
pt.bus_no as patient_bus_no,
pt.gender_enum as patient_gender,
pt.phone as patient_phone,
pt.id_card as patient_id_card,
pt.birth_date as patient_birth_date
FROM adm_practitioner_patient pp
LEFT JOIN adm_patient pt ON pp.patient_id = pt.ID AND pt.delete_flag = '0'
WHERE pp.practitioner_id = #{practitionerId}
AND pp.status = 1
AND pp.delete_flag = '0'
ORDER BY pp.create_time DESC
</select>
<!-- 获取患者的所有有效医生(带详细信息) -->
<select id="getValidPractitionersByPatientWithDetail" parameterType="Long" resultType="java.util.Map">
SELECT
pp.id as relationship_id,
pp.practitioner_id,
pp.patient_id,
pp.relationship_type,
pp.start_date,
pp.end_date,
pp.status,
pp.remark,
prac.name as practitioner_name,
prac.bus_no as practitioner_bus_no,
prac.gender_enum as practitioner_gender,
prac.phone as practitioner_phone,
prac.dr_profttl_code as practitioner_title,
org.name as organization_name
FROM adm_practitioner_patient pp
LEFT JOIN adm_practitioner prac ON pp.practitioner_id = prac.ID AND prac.delete_flag = '0'
LEFT JOIN adm_organization org ON pp.organization_id = org.ID AND org.delete_flag = '0'
WHERE pp.patient_id = #{patientId}
AND pp.status = 1
AND pp.delete_flag = '0'
ORDER BY pp.relationship_type, pp.create_time DESC
</select>
</mapper>

View File

@@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.PractitionerRoleMapper">
<!-- 根据员工ID 查询权限数据集 -->
<select id="searchPractitionerRoleByPractitionerId" resultType="com.openhis.administration.dto.RoleDataDto">
select id as roleId,org_id as orgId,location_id as locationId,specialty_enum as specialtyEnum,type_code as
typeCode
from adm_practitioner_role
where delete_flag = '0'
<if test="practitionerId != null and practitionerId!= ''">
and practitioner_id = #{practitionerId}
</if>
<if test="roleCode != null and roleCode!= ''">
and role_code = #{roleCode}
</if>
and location_id is not null order by id desc
</select>
<!-- 根据员工ID数组 查询权限数据集 -->
<select id="searchPractitionerRoleByPractitionerIds" resultType="com.openhis.administration.dto.RoleDataDto">
select id as roleId,org_id as orgId,location_id as locationId,specialty_enum as specialtyEnum,type_code as
typeCode
from adm_practitioner_role
where delete_flag = '0'
<if test="practitionerId != null and practitionerId!= ''">
and practitioner_id in
<foreach collection="practitionerIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="roleCode != null and roleCode!= ''">
and role_code = #{roleCode}
</if>
and location_id is not null order by id desc
</select>
<!-- 根据员工ID 查询位置ID数组 -->
<select id="searchPractitionerRoleLocationIds" resultType="java.lang.Long">
select location_id as locationId
from adm_practitioner_role
where delete_flag = '0'
<if test="practitionerId != null and practitionerId!= ''">
and practitioner_id = #{practitionerId}
</if>
<if test="roleCode != null and roleCode!= ''">
and role_code = #{roleCode}
</if>
and location_id is not null order by id desc
</select>
</mapper>

View File

@@ -1,461 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.appointmentmanage.mapper.ScheduleSlotMapper">
<!--
统一状态值映射: DB 数值 → 规范化输出
0=待约 1=已约(签到后) 2=锁定(预约后) 3=已签到 4=已停诊 5=已退号
-->
<sql id="slotStatusNormExpr">
CASE
WHEN LOWER(CONCAT('', s.status)) IN ('0', 'unbooked', 'available') THEN 0
WHEN LOWER(CONCAT('', s.status)) IN ('1', 'booked') THEN 1
WHEN LOWER(CONCAT('', s.status)) IN ('2', 'locked') THEN 2
WHEN LOWER(CONCAT('', s.status)) IN ('3', 'checked', 'checked_in', 'checkin') THEN 3
WHEN LOWER(CONCAT('', s.status)) IN ('4', 'cancelled', 'canceled', 'stopped') THEN 4
WHEN LOWER(CONCAT('', s.status)) IN ('5', 'returned') THEN 5
ELSE NULL
END
</sql>
<sql id="orderStatusNormExpr">
CASE
WHEN LOWER(CONCAT('', o.status)) IN ('1', 'booked') THEN 1
WHEN LOWER(CONCAT('', o.status)) IN ('2', 'checked', 'checked_in', 'checkin') THEN 2
WHEN LOWER(CONCAT('', o.status)) IN ('3', 'cancelled', 'canceled') THEN 3
WHEN LOWER(CONCAT('', o.status)) IN ('4', 'returned') THEN 4
ELSE NULL
END
</sql>
<sql id="poolStatusNormExpr">
CASE
WHEN LOWER(CONCAT('', p.status)) IN ('0', 'unbooked', 'available') THEN 0
WHEN LOWER(CONCAT('', p.status)) IN ('1', 'booked') THEN 1
WHEN LOWER(CONCAT('', p.status)) IN ('2', 'locked') THEN 2
WHEN LOWER(CONCAT('', p.status)) IN ('3', 'checked', 'checked_in', 'checkin') THEN 3
WHEN LOWER(CONCAT('', p.status)) IN ('4', 'cancelled', 'canceled', 'stopped') THEN 4
WHEN LOWER(CONCAT('', p.status)) IN ('5', 'returned') THEN 5
ELSE NULL
END
</sql>
<!-- 注意这里的 resultType 指向了您刚建好的 DTO 实体类 -->
<select id="selectAllTicketSlots" resultType="com.openhis.appointmentmanage.domain.TicketSlotDTO">
SELECT
s.id AS slotId,
s.seq_no AS seqNo,
p.schedule_id AS scheduleId,
p.doctor_name AS doctor,
p.dept_id AS departmentId,
p.fee AS fee,
o.patient_id AS patientId,
o.patient_name AS patientName,
o.medical_card AS medicalCard,
o.phone AS phone,
<include refid="orderStatusNormExpr" /> AS orderStatus,
<include refid="slotStatusNormExpr" /> AS slotStatus,
s.expect_time AS expectTime,
p.schedule_date AS scheduleDate,
d.reg_type AS regType,
<include refid="poolStatusNormExpr" /> AS poolStatus,
p.stop_reason AS stopReason,
d.is_stopped AS isStopped
FROM
adm_schedule_slot s
INNER JOIN adm_schedule_pool p ON s.pool_id = p.id
LEFT JOIN adm_doctor_schedule d ON p.schedule_id = d.id
LEFT JOIN (
SELECT DISTINCT
ON (slot_id) slot_id,
patient_id,
patient_name,
medical_card,
phone,
status
FROM
order_main
WHERE
LOWER(CONCAT('', status)) IN ('1', '2', '4', 'booked', 'checked', 'checked_in', 'checkin', 'returned')
ORDER BY
slot_id,
create_time DESC
) o ON o.slot_id = s.id
WHERE
p.delete_flag = '0'
AND s.delete_flag = '0'
ORDER BY
p.schedule_date,
p.doctor_id,
s.expect_time,
s.seq_no ASC
</select>
<select id="selectTicketSlotById" resultType="com.openhis.appointmentmanage.domain.TicketSlotDTO">
SELECT
s.id AS slotId,
s.seq_no AS seqNo,
p.schedule_id AS scheduleId,
p.doctor_name AS doctor,
p.doctor_id AS doctorId,
p.dept_id AS departmentId,
org.name AS departmentName,
p.fee AS fee,
o.patient_id AS patientId,
o.patient_name AS patientName,
o.medical_card AS medicalCard,
o.phone AS phone,
o.id AS orderId,
o.order_no AS orderNo,
COALESCE(CAST(o.gender AS VARCHAR), CAST(pinfo.gender_enum AS VARCHAR)) AS patientGender,
pinfo.gender_enum AS genderEnum,
pinfo.id_card AS idCard,
o.appointment_time AS appointmentTime,
<include refid="orderStatusNormExpr" /> AS orderStatus,
<include refid="slotStatusNormExpr" /> AS slotStatus,
s.expect_time AS expectTime,
p.schedule_date AS scheduleDate,
d.reg_type AS regType,
<include refid="poolStatusNormExpr" /> AS poolStatus,
p.stop_reason AS stopReason,
d.is_stopped AS isStopped
FROM
adm_schedule_slot s
INNER JOIN adm_schedule_pool p ON s.pool_id = p.id
LEFT JOIN adm_doctor_schedule d ON p.schedule_id = d.id
LEFT JOIN adm_organization org ON p.dept_id = org.id
AND org.delete_flag = '0'
LEFT JOIN (
SELECT DISTINCT
ON (slot_id) slot_id,
patient_id,
patient_name,
medical_card,
phone,
id,
order_no,
gender,
appointment_time,
status
FROM
order_main
WHERE
LOWER(CONCAT('', status)) IN ('1', '2', '4', 'booked', 'checked', 'checked_in', 'checkin', 'returned')
ORDER BY
slot_id,
create_time DESC
) o ON o.slot_id = s.id
LEFT JOIN adm_patient pinfo ON o.patient_id = pinfo.id
WHERE
s.id = #{id}
</select>
<!-- 预约锁定: 0→#{lockedStatus} (AVAILABLE→LOCKED),由枚举传入 -->
<update id="lockSlotForBooking">
UPDATE adm_schedule_slot
SET
status = #{lockedStatus},
update_time = now()
WHERE
id = #{slotId}
AND status = 0
AND delete_flag = '0'
</update>
<!-- status=0(待约)时清空order_id释放号源使退号后号源可再被预约 -->
<update id="updateSlotStatus">
UPDATE adm_schedule_slot
SET
status = #{status},
<if test="status != null and status == 0">
order_id = NULL,
</if>
update_time = now()
WHERE
id = #{slotId}
AND delete_flag = '0'
</update>
<!-- 签到: #{requiredStatus}→#{status} (LOCKED→BOOKED),前置条件由枚举传入 -->
<update id="updateSlotStatusAndCheckInTime">
UPDATE adm_schedule_slot
SET
status = #{status},
check_in_time = #{checkInTime},
update_time = NOW()
WHERE
id = #{slotId}
AND status = #{requiredStatus}
AND delete_flag = '0'
</update>
<select id="selectPoolIdBySlotId" resultType="java.lang.Long">
SELECT
pool_id
FROM
adm_schedule_slot
WHERE
id = #{slotId}
AND delete_flag = '0'
</select>
<update id="bindOrderToSlot">
UPDATE adm_schedule_slot
SET
order_id = #{orderId},
update_time = now()
WHERE
id = #{slotId}
AND status = 2
AND delete_flag = '0'
</update>
<select id="selectTicketSlotsPage" resultType="com.openhis.appointmentmanage.domain.TicketSlotDTO">
SELECT
s.id AS slotId,
s.seq_no AS seqNo,
p.schedule_id AS scheduleId,
p.doctor_name AS doctor,
p.doctor_id AS doctorId,
p.dept_id AS departmentId,
org.name AS departmentName,
p.fee AS fee,
o.patient_id AS patientId,
o.patient_name AS patientName,
o.medical_card AS medicalCard,
o.phone AS phone,
o.id AS orderId,
o.order_no AS orderNo,
COALESCE(CAST(o.gender AS VARCHAR), CAST(pinfo.gender_enum AS VARCHAR)) AS patientGender,
pinfo.gender_enum AS genderEnum,
pinfo.id_card AS idCard,
o.appointment_time AS appointmentTime,
<include refid="orderStatusNormExpr" /> AS orderStatus,
<include refid="slotStatusNormExpr" /> AS slotStatus,
s.expect_time AS expectTime,
p.schedule_date AS scheduleDate,
d.reg_type AS regType,
<include refid="poolStatusNormExpr" /> AS poolStatus,
p.stop_reason AS stopReason,
d.is_stopped AS isStopped
FROM
adm_schedule_slot s
INNER JOIN adm_schedule_pool p ON s.pool_id = p.id
LEFT JOIN adm_doctor_schedule d ON p.schedule_id = d.id
LEFT JOIN adm_organization org ON p.dept_id = org.id
AND org.delete_flag = '0'
LEFT JOIN (
SELECT DISTINCT
ON (slot_id) slot_id,
patient_id,
patient_name,
medical_card,
phone,
id,
order_no,
gender,
appointment_time,
status
FROM
order_main
WHERE
LOWER(CONCAT('', status)) IN ('1', '2', '4', 'booked', 'checked', 'checked_in', 'checkin', 'returned')
ORDER BY
slot_id,
create_time DESC
) o ON o.slot_id = s.id
LEFT JOIN adm_patient pinfo ON o.patient_id = pinfo.id
<where>
p.delete_flag = '0'
AND s.delete_flag = '0'
<!-- 1. 按日期查 -->
<if test="query.date != null and query.date != ''">
AND p.schedule_date = CAST(#{query.date} AS DATE)
</if>
<!-- 2. 按科室查 -->
<if test="query.department != null and query.department != '' and query.department != 'all'">
AND org.name = #{query.department}
</if>
<if test="query.doctorId != null">
AND p.doctor_id = #{query.doctorId}
</if>
<!-- 3. 按号源类型查 (专家/普通) -->
<if test="query.type != null and query.type != ''">
<choose>
<when test="query.type == 'expert'">
AND d.reg_type = 1
</when>
<when test="query.type == 'general'">
AND (
d.reg_type != 1
OR d.reg_type IS NULL
)
</when>
</choose>
</if>
<!-- 4. 模糊搜索患者信息 -->
<if test="query.name != null and query.name != ''">
AND o.patient_name LIKE CONCAT('%', #{query.name}, '%')
</if>
<if test="query.card != null and query.card != ''">
AND o.medical_card LIKE CONCAT('%', #{query.card}, '%')
</if>
<if test="query.phone != null and query.phone != ''">
AND o.phone LIKE CONCAT('%', #{query.phone}, '%')
</if>
<!-- 5. 时间过滤: 仅待约(0)受时间限制,已锁定(2)/已约(1)/已签到(3)/已退号(5)不受影响 -->
AND (
(<include refid="slotStatusNormExpr" /> = 0 AND (p.schedule_date > CURRENT_DATE OR (p.schedule_date = CURRENT_DATE AND (CAST(p.schedule_date AS TIMESTAMP) + CAST(s.expect_time AS TIME)) >= NOW())))
OR <include refid="slotStatusNormExpr" /> = 1
OR <include refid="slotStatusNormExpr" /> = 2
OR <include refid="slotStatusNormExpr" /> = 3
OR <include refid="slotStatusNormExpr" /> = 5
OR <include refid="orderStatusNormExpr" /> = 4
)
<!-- 6. 状态筛选: unbooked(0) locked(2) booked(2) checked(1) cancelled(4) returned(5) -->
<if test="query.status != null and query.status != '' and query.status != 'all'">
<choose>
<when test="'unbooked'.equals(query.status) or '未预约'.equals(query.status)">
AND <include refid="slotStatusNormExpr" /> = 0
AND (
d.is_stopped IS NULL
OR d.is_stopped = FALSE
)
</when>
<when test="'booked'.equals(query.status) or '已预约'.equals(query.status)">
AND <include refid="slotStatusNormExpr" /> = 2
AND <include refid="orderStatusNormExpr" /> = 1
AND (
d.is_stopped IS NULL
OR d.is_stopped = FALSE
)
</when>
<when test="'locked'.equals(query.status) or '已锁定'.equals(query.status)">
AND <include refid="slotStatusNormExpr" /> = 2
AND <include refid="orderStatusNormExpr" /> = 1
AND (
d.is_stopped IS NULL
OR d.is_stopped = FALSE
)
</when>
<when test="'checked'.equals(query.status) or '已取号'.equals(query.status)">
AND <include refid="slotStatusNormExpr" /> = 1
AND (
d.is_stopped IS NULL
OR d.is_stopped = FALSE
)
</when>
<when test="'cancelled'.equals(query.status) or '已停诊'.equals(query.status) or '已取消'.equals(query.status)">
AND (
<include refid="slotStatusNormExpr" /> = 4
OR d.is_stopped = TRUE
)
</when>
<when test="'returned'.equals(query.status) or '已退号'.equals(query.status)">
AND (
<include refid="slotStatusNormExpr" /> = 5
OR <include refid="orderStatusNormExpr" /> = 4
)
</when>
<otherwise>
AND 1 = 2
</otherwise>
</choose>
</if>
</where>
ORDER BY
p.schedule_date DESC,
s.expect_time ASC,
s.seq_no ASC
</select>
<select id="selectDoctorAvailabilitySummary" resultType="com.openhis.appointmentmanage.domain.DoctorAvailabilityDTO">
SELECT
p.doctor_id AS doctorId,
p.doctor_name AS doctorName,
p.schedule_date AS scheduleDate,
<!-- 直接 COUNT 未预约的号源,前端已经做了时间过滤,这里只按日期统计 -->
COUNT(
CASE
WHEN s.delete_flag = '0'
AND <include refid="slotStatusNormExpr" /> = 0
<!-- 使用前端传来的当前时间戳过滤过期号源,保证和前端完全一致 -->
AND (
p.schedule_date > CURRENT_DATE
OR (
p.schedule_date = CURRENT_DATE
AND (CAST(p.schedule_date AS TIMESTAMP) + CAST(s.expect_time AS TIME)) >= NOW()
)
)
THEN s.id
ELSE NULL
END
) AS available,
COUNT(DISTINCT p.id) AS poolCount,
CASE
WHEN MAX(
CASE
WHEN d.reg_type = 1 THEN 1
ELSE 0
END
) = 1 THEN 'expert'
ELSE 'general'
END AS ticketType
FROM
adm_schedule_pool p
LEFT JOIN adm_doctor_schedule d ON p.schedule_id = d.id
LEFT JOIN adm_organization org ON p.dept_id = org.id AND org.delete_flag = '0'
LEFT JOIN adm_schedule_slot s ON s.pool_id = p.id AND s.delete_flag = '0'
<where>
p.delete_flag = '0'
<!-- 排除医生已停诊的号源 -->
AND (d.is_stopped IS NULL OR d.is_stopped = FALSE)
<!-- 过滤未来号源:只统计当前日期及未来日期的号源 -->
<if test="query.date != null and query.date != ''">
AND p.schedule_date = CAST(#{query.date} AS DATE)
</if>
<!-- 增加时间过滤:排除已过去的就诊日期 -->
AND (p.schedule_date > CURRENT_DATE OR (p.schedule_date = CURRENT_DATE AND (CAST(p.schedule_date AS TIMESTAMP) + CAST(s.expect_time AS TIME)) >= NOW()))
<if test="query.department != null and query.department != '' and query.department != 'all'">
AND org.name = #{query.department}
</if>
<if test="query.type != null and query.type != '' and query.type != 'all'">
<choose>
<when test="query.type == 'expert'">
AND d.reg_type = 1
</when>
<when test="query.type == 'general'">
AND (
d.reg_type != 1
OR d.reg_type IS NULL
)
</when>
</choose>
</if>
<if test="query.doctorId != null">
AND p.doctor_id = #{query.doctorId}
</if>
</where>
GROUP BY
p.doctor_id,
p.doctor_name,
p.schedule_date
ORDER BY
p.schedule_date ASC,
p.doctor_name ASC
</select>
<select id="selectSeqNoBySlotIds" resultType="com.openhis.appointmentmanage.domain.ScheduleSlot">
SELECT id, seq_no
FROM adm_schedule_slot
WHERE id IN
<foreach collection="slotIds" item="slotId" open="(" separator="," close=")">
#{slotId}
</foreach>
AND delete_flag = '0'
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.SpecimenDefinitionMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.SupplierMapper">
</mapper>

View File

@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.administration.mapper.TraceNoManageMapper">
<select id="getItemTraceNoInfo" resultType="com.openhis.administration.domain.TraceNoManage">
SELECT item_table,
item_id,
location_id,
lot_number,
trace_no,
MAX(create_time)
FROM adm_trace_no_manage
WHERE item_table = #{itemTable}
AND item_id = #{itemId}
AND location_id = #{locationId}
AND lot_number = #{lotNumber}
AND (trace_no) IN (SELECT trace_no
FROM adm_trace_no_manage
WHERE item_table = #{itemTable}
AND item_id = #{itemId}
AND location_id = #{locationId}
AND lot_number = #{lotNumber}
AND delete_flag = '0'
GROUP BY trace_no
HAVING SUM(CASE WHEN status_enum = 1 THEN 1 ELSE 0 END) > -- 进库次数
SUM(CASE WHEN status_enum = 2 THEN 1 ELSE 0 END) -- 出库次数
)
AND delete_flag = '0'
GROUP BY item_table,
item_id,
location_id,
lot_number,
trace_no
</select>
<select id="tracePatient" resultType="com.openhis.administration.dto.TracePatientInfoDto">
SELECT T2.name,
T2.gender_enum,
T2.birth_date,
T2.phone,
T3.create_time AS register_time
FROM med_medication_dispense T1
LEFT JOIN adm_patient T2 ON T2.ID = T1.patient_id
AND T2.delete_flag = '0'
LEFT JOIN adm_encounter T3 ON T3.ID = T1.encounter_id
AND T3.delete_flag = '0'
WHERE T1.medication_id = #{ medId }
<if test="dispenseStatus != null">
AND T1.status_enum = #{dispenseStatus}
</if>
AND T1.trace_no = #{traceNo}
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.clinical.mapper.AllergyIntoleranceMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.clinical.mapper.ConditionDefinitionMapper">
</mapper>

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.clinical.mapper.ConditionMapper">
<delete id="deleteByEncounterId">
DELETE
FROM cli_condition
WHERE ID IN (SELECT condition_id FROM adm_encounter_diagnosis WHERE encounter_id = #{encounterId})
AND tcm_flag = 0
</delete>
<delete id="deleteTcmByEncounterId">
DELETE
FROM cli_condition
WHERE ID IN (SELECT condition_id FROM adm_encounter_diagnosis WHERE encounter_id = #{encounterId})
AND tcm_flag = 1
</delete>
</mapper>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.clinical.mapper.ConditionNoDefinitionMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.clinical.mapper.DiagnosisBelongBindingMapper">
</mapper>

View File

@@ -1,308 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.clinical.mapper.OrderMapper">
<resultMap type="com.openhis.clinical.domain.Order" id="OrderResult">
<id property="id" column="id"/>
<result property="orderNo" column="order_no"/>
<result property="patientId" column="patient_id"/>
<result property="patientName" column="patient_name"/>
<result property="medicalCard" column="medical_card"/>
<result property="phone" column="phone"/>
<result property="gender" column="gender"/>
<result property="scheduleId" column="schedule_id"/>
<result property="slotId" column="slot_id"/>
<result property="departmentId" column="department_id"/>
<result property="departmentName" column="department_name"/>
<result property="doctorId" column="doctor_id"/>
<result property="doctorName" column="doctor_name"/>
<result property="regType" column="reg_type"/>
<result property="fee" column="fee"/>
<result property="appointmentDate" column="appointment_date"/>
<result property="appointmentTime" column="appointment_time"/>
<result property="cancelTime" column="cancel_time"/>
<result property="cancelReason" column="cancel_reason"/>
<result property="status" column="status"/>
<result property="payStatus" column="pay_status"/>
<result property="version" column="version"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="selectOrderList" resultMap="OrderResult">
select * from order_main
<where>
<if test="orderNo != null and orderNo != ''">
and order_no = #{orderNo}
</if>
<if test="patientId != null">
and patient_id = #{patientId}
</if>
<if test="patientName != null and patientName != ''">
and patient_name like #{patientName}
</if>
<if test="medicalCard != null and medicalCard != ''">
and medical_card = #{medicalCard}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone}
</if>
<if test="scheduleId != null">
and schedule_id = #{scheduleId}
</if>
<if test="slotId != null">
and slot_id = #{slotId}
</if>
<if test="departmentId != null">
and department_id = #{departmentId}
</if>
<if test="doctorId != null">
and doctor_id = #{doctorId}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="payStatus != null">
and pay_status = #{payStatus}
</if>
<if test="appointmentDate != null">
and appointment_date = #{appointmentDate}
</if>
</where>
</select>
<select id="selectOrderPage" resultMap="OrderResult">
select * from order_main
<where>
<if test="order.orderNo != null and order.orderNo != ''">
and order_no = #{order.orderNo}
</if>
<if test="order.patientId != null">
and patient_id = #{order.patientId}
</if>
<if test="order.patientName != null and order.patientName != ''">
and patient_name like #{order.patientName}
</if>
<if test="order.medicalCard != null and order.medicalCard != ''">
and medical_card = #{order.medicalCard}
</if>
<if test="order.phone != null and order.phone != ''">
and phone = #{order.phone}
</if>
<if test="order.scheduleId != null">
and schedule_id = #{order.scheduleId}
</if>
<if test="order.slotId != null">
and slot_id = #{order.slotId}
</if>
<if test="order.departmentId != null">
and department_id = #{order.departmentId}
</if>
<if test="order.doctorId != null">
and doctor_id = #{order.doctorId}
</if>
<if test="order.status != null">
and status = #{order.status}
</if>
<if test="order.payStatus != null">
and pay_status = #{order.payStatus}
</if>
<if test="order.appointmentDate != null">
and appointment_date = #{order.appointmentDate}
</if>
</where>
</select>
<!-- status=1: 只查有效订单(0=患者取消 1=有效 2=系统取消 3=已完成) -->
<select id="selectOrderById" resultMap="OrderResult">
select * from order_main where id = #{id}
and status = 1
order by create_time desc
</select>
<!-- status=1: 只查有效订单 -->
<select id="selectOrderBySlotId" resultMap="OrderResult">
select * from order_main where slot_id = #{slotId} and status = 1
</select>
<insert id="insertOrder" parameterType="com.openhis.clinical.domain.Order" useGeneratedKeys="true" keyProperty="id">
insert into order_main
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderNo != null and orderNo != ''">order_no,</if>
<if test="patientId != null">patient_id,</if>
<if test="patientName != null and patientName != ''">patient_name,</if>
<if test="medicalCard != null and medicalCard != ''">medical_card,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="gender != null">gender,</if>
<if test="scheduleId != null">schedule_id,</if>
<if test="slotId != null">slot_id,</if>
<if test="departmentId != null">department_id,</if>
<if test="departmentName != null and departmentName != ''">department_name,</if>
<if test="doctorId != null">doctor_id,</if>
<if test="doctorName != null and doctorName != ''">doctor_name,</if>
<if test="regType != null and regType != ''">reg_type,</if>
<if test="fee != null">fee,</if>
<if test="appointmentDate != null">appointment_date,</if>
<if test="appointmentTime != null">appointment_time,</if>
<if test="cancelTime != null">cancel_time,</if>
<if test="cancelReason != null and cancelReason != ''">cancel_reason,</if>
<if test="status != null">status,</if>
<if test="payStatus != null">pay_status,</if>
<if test="version != null">version,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderNo != null and orderNo != ''">#{orderNo},</if>
<if test="patientId != null">#{patientId},</if>
<if test="patientName != null and patientName != ''">#{patientName},</if>
<if test="medicalCard != null and medicalCard != ''">#{medicalCard},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="gender != null">#{gender},</if>
<if test="scheduleId != null">#{scheduleId},</if>
<if test="slotId != null">#{slotId},</if>
<if test="departmentId != null">#{departmentId},</if>
<if test="departmentName != null and departmentName != ''">#{departmentName},</if>
<if test="doctorId != null">#{doctorId},</if>
<if test="doctorName != null and doctorName != ''">#{doctorName},</if>
<if test="regType != null and regType != ''">#{regType},</if>
<if test="fee != null">#{fee},</if>
<if test="appointmentDate != null">#{appointmentDate},</if>
<if test="appointmentTime != null">#{appointmentTime},</if>
<if test="cancelTime != null">#{cancelTime},</if>
<if test="cancelReason != null and cancelReason != ''">#{cancelReason},</if>
<if test="status != null">#{status},</if>
<if test="payStatus != null">#{payStatus},</if>
<if test="version != null">#{version},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateOrder" parameterType="com.openhis.clinical.domain.Order">
update order_main
<trim prefix="set" suffixOverrides=",">
<if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
<if test="patientId != null">patient_id = #{patientId},</if>
<if test="patientName != null and patientName != ''">patient_name = #{patientName},</if>
<if test="medicalCard != null and medicalCard != ''">medical_card = #{medicalCard},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="scheduleId != null">schedule_id = #{scheduleId},</if>
<if test="slotId != null">slot_id = #{slotId},</if>
<if test="departmentId != null">department_id = #{departmentId},</if>
<if test="departmentName != null and departmentName != ''">department_name = #{departmentName},</if>
<if test="doctorId != null">doctor_id = #{doctorId},</if>
<if test="doctorName != null and doctorName != ''">doctor_name = #{doctorName},</if>
<if test="regType != null and regType != ''">reg_type = #{regType},</if>
<if test="fee != null">fee = #{fee},</if>
<if test="appointmentDate != null">appointment_date = #{appointmentDate},</if>
<if test="appointmentTime != null">appointment_time = #{appointmentTime},</if>
<if test="cancelTime != null">cancel_time = #{cancelTime},</if>
<if test="cancelReason != null and cancelReason != ''">cancel_reason = #{cancelReason},</if>
<if test="status != null">status = #{status},</if>
<if test="payStatus != null">pay_status = #{payStatus},</if>
<if test="version != null">version = #{version},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<select id="countPatientDeptOrdersInPeriod" resultType="int">
select count(*)
from order_main
<where>
and patient_id = #{patientId}
<choose>
<when test="departmentId != null">
and department_id = #{departmentId}
</when>
<when test="departmentName != null and departmentName != ''">
and trim(department_name) = trim(#{departmentName})
</when>
<otherwise>
and 1 = 0
</otherwise>
</choose>
and appointment_time &gt;= #{startTime}
and appointment_time &lt; #{endTime}
<if test="statuses != null and statuses.size() &gt; 0">
and status in
<foreach item="s" collection="statuses" open="(" separator="," close=")">
#{s}
</foreach>
</if>
</where>
</select>
<update id="updateOrderStatusById">
update order_main set status = #{status} where id = #{id}
</update>
<!-- status=0: 患者取消 (OrderStatus.PATIENT_CANCELLED) -->
<update id="updateOrderCancelInfoById">
update order_main set status = 0, cancel_time = #{cancelTime}, cancel_reason = #{cancelReason} where id = #{id}
</update>
<update id="updatePayStatus">
update order_main
set pay_status = #{payStatus}, pay_time = #{payTime}, update_time = NOW()
where id = #{orderId}
</update>
<delete id="deleteOrderById">
delete from order_main where id = #{id}
</delete>
<delete id="deleteOrderByIds">
delete from order_main where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="countOrders" resultType="int">
select count(*) from order_main
<where>
<if test="params.orderNo != null and params.orderNo != ''">
and order_no = #{params.orderNo}
</if>
<if test="params.patientId != null">
and patient_id = #{params.patientId}
</if>
<if test="params.scheduleId != null">
and schedule_id = #{params.scheduleId}
</if>
<if test="params.slotId != null">
and slot_id = #{params.slotId}
</if>
<if test="params.departmentId != null">
and department_id = #{params.departmentId}
</if>
<if test="params.doctorId != null">
and doctor_id = #{params.doctorId}
</if>
<if test="params.status != null">
and status = #{params.status}
</if>
<if test="params.payStatus != null">
and pay_status = #{params.payStatus}
</if>
<if test="params.appointmentDate != null">
and appointment_date = #{params.appointmentDate}
</if>
</where>
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.clinical.mapper.ProcedureMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.clinical.mapper.ProcedurePerformerMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.clinical.mapper.ReservationRecordMapper">
</mapper>

View File

@@ -1,245 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.clinical.mapper.TicketMapper">
<resultMap type="com.openhis.clinical.domain.Ticket" id="TicketResult">
<id property="id" column="id"/>
<result property="busNo" column="bus_no"/>
<result property="department" column="department"/>
<result property="doctor" column="doctor"/>
<result property="ticketType" column="ticket_type"/>
<result property="time" column="time"/>
<result property="status" column="status"/>
<result property="fee" column="fee"/>
<result property="patientId" column="patient_id"/>
<result property="patientName" column="patient_name"/>
<result property="medicalCard" column="medical_card"/>
<result property="phone" column="phone"/>
<result property="appointmentDate" column="appointment_date"/>
<result property="appointmentTime" column="appointment_time"/>
<result property="departmentId" column="department_id"/>
<result property="doctorId" column="doctor_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="selectTicketList" parameterType="com.openhis.clinical.domain.Ticket" resultMap="TicketResult">
select * from clinical_ticket
<where>
<!-- 逻辑删除条件 -->
and delete_flag = '0'
<!-- 其他查询条件 -->
<if test="ticketType != null and ticketType != ''">
and ticket_type = #{ticketType}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
<if test="appointmentDate != null">
and appointment_date = cast(#{appointmentDate} as date)
</if>
<if test="doctorId != null">
and doctor_id = #{doctorId}
</if>
<if test="departmentId != null">
and department_id = #{departmentId}
</if>
<if test="time != null and time != ''">
and time like #{time}
</if>
<if test="patientName != null and patientName != ''">
and patient_name = #{patientName}
</if>
<if test="medicalCard != null and medicalCard != ''">
and medical_card = #{medicalCard}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone}
</if>
</where>
</select>
<select id="selectTicketPage" resultMap="TicketResult">
select * from clinical_ticket
<where>
<!-- 逻辑删除条件 -->
and delete_flag = '0'
<!-- 其他查询条件 -->
<if test="ticket.ticketType != null and ticket.ticketType != ''">
and ticket_type = #{ticket.ticketType}
</if>
<if test="ticket.status != null and ticket.status != ''">
and status = #{ticket.status}
</if>
<if test="ticket.appointmentDate != null">
and appointment_date = cast(#{ticket.appointmentDate} as date)
</if>
<if test="ticket.doctorId != null">
and doctor_id = #{ticket.doctorId}
</if>
<if test="ticket.departmentId != null">
and department_id = #{ticket.departmentId}
</if>
<if test="ticket.time != null and ticket.time != ''">
and time like #{ticket.time}
</if>
<if test="ticket.patientName != null and ticket.patientName != ''">
and patient_name = #{ticket.patientName}
</if>
<if test="ticket.medicalCard != null and ticket.medicalCard != ''">
and medical_card = #{ticket.medicalCard}
</if>
<if test="ticket.phone != null and ticket.phone != ''">
and phone = #{ticket.phone}
</if>
</where>
</select>
<!-- 自定义COUNT查询解决MyBatis-Plus自动生成的COUNT查询结果不正确的问题 -->
<select id="selectTicketPage_mpCount" resultType="java.lang.Long">
select count(*) from clinical_ticket
<where>
<!-- 逻辑删除条件 -->
and delete_flag = '0'
<!-- 其他查询条件 -->
<if test="ticket.ticketType != null and ticket.ticketType != ''">
and ticket_type = #{ticket.ticketType}
</if>
<if test="ticket.status != null and ticket.status != ''">
and status = #{ticket.status}
</if>
<if test="ticket.appointmentDate != null">
and appointment_date = #{ticket.appointmentDate}
</if>
<if test="ticket.doctorId != null">
and doctor_id = #{ticket.doctorId}
</if>
<if test="ticket.departmentId != null">
and department_id = #{ticket.departmentId}
</if>
<if test="ticket.time != null and ticket.time != ''">
and time like #{ticket.time}
</if>
<if test="ticket.patientName != null and ticket.patientName != ''">
and patient_name = #{ticket.patientName}
</if>
<if test="ticket.medicalCard != null and ticket.medicalCard != ''">
and medical_card = #{ticket.medicalCard}
</if>
<if test="ticket.phone != null and ticket.phone != ''">
and phone = #{ticket.phone}
</if>
</where>
</select>
<select id="selectTicketById" resultMap="TicketResult">
select * from clinical_ticket where id = #{id} and delete_flag = '0'
</select>
<insert id="insertTicket" parameterType="com.openhis.clinical.domain.Ticket">
insert into clinical_ticket
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="busNo != null and busNo != ''">bus_no,</if>
<if test="department != null and department != ''">department,</if>
<if test="doctor != null and doctor != ''">doctor,</if>
<if test="ticketType != null and ticketType != ''">ticket_type,</if>
<if test="time != null and time != ''">time,</if>
<if test="status != null and status != ''">status,</if>
<if test="fee != null and fee != ''">fee,</if>
<if test="patientId != null">patient_id,</if>
<if test="patientName != null and patientName != ''">patient_name,</if>
<if test="medicalCard != null and medicalCard != ''">medical_card,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="appointmentDate != null">appointment_date,</if>
<if test="appointmentTime != null">appointment_time,</if>
<if test="departmentId != null">department_id,</if>
<if test="doctorId != null">doctor_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="busNo != null and busNo != ''">#{busNo},</if>
<if test="department != null and department != ''">#{department},</if>
<if test="doctor != null and doctor != ''">#{doctor},</if>
<if test="ticketType != null and ticketType != ''">#{ticketType},</if>
<if test="time != null and time != ''">#{time},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="fee != null and fee != ''">#{fee},</if>
<if test="patientId != null">#{patientId},</if>
<if test="patientName != null and patientName != ''">#{patientName},</if>
<if test="medicalCard != null and medicalCard != ''">#{medicalCard},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="appointmentDate != null">#{appointmentDate},</if>
<if test="appointmentTime != null">#{appointmentTime},</if>
<if test="departmentId != null">#{departmentId},</if>
<if test="doctorId != null">#{doctorId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTicket" parameterType="com.openhis.clinical.domain.Ticket">
update clinical_ticket
<trim prefix="set" suffixOverrides=",">
<if test="busNo != null and busNo != ''">bus_no = #{busNo},</if>
<if test="department != null and department != ''">department = #{department},</if>
<if test="doctor != null and doctor != ''">doctor = #{doctor},</if>
<if test="ticketType != null and ticketType != ''">ticket_type = #{ticketType},</if>
<if test="time != null and time != ''">time = #{time},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="fee != null and fee != ''">fee = #{fee},</if>
<if test="patientId != null">patient_id = #{patientId},</if>
<if test="patientName != null and patientName != ''">patient_name = #{patientName},</if>
<if test="medicalCard != null and medicalCard != ''">medical_card = #{medicalCard},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="appointmentDate != null">appointment_date = #{appointmentDate},</if>
<if test="appointmentTime != null">appointment_time = #{appointmentTime},</if>
<if test="departmentId != null">department_id = #{departmentId},</if>
<if test="doctorId != null">doctor_id = #{doctorId},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTicketById">
delete from clinical_ticket where id = #{id}
</delete>
<delete id="deleteTicketByIds">
delete from clinical_ticket where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="countTickets" resultType="int">
select count(*) from clinical_ticket
<where>
<if test="ticketType != null and ticketType != ''">
and ticket_type = #{ticketType}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
<if test="appointmentDate != null">
and appointment_date = cast(#{appointmentDate} as date)
</if>
<if test="doctorId != null">
and doctor_id = #{doctorId}
</if>
<if test="departmentId != null">
and department_id = #{departmentId}
</if>
</where>
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.DocDefinitionMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.DocDefinitionOrganizationMapper">
</mapper>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.DocInventoryItemStaticMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.DocRecordMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.DocStatisticsDefinitionMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.DocStatisticsDefinitionOptionMapper">
</mapper>

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.DocStatisticsMapper">
<select id="getTempList" resultType="com.openhis.document.domain.DocStatistics">
SELECT ds.id,
ds.record_id,
ds.value,
ds.record_time,
dsd.type_code AS statistic_definition_code
FROM doc_statistics ds
LEFT JOIN doc_statistics_definition dsd ON dsd.ID = ds.statistic_definition_id
WHERE ds.encounter_id = #{encounterId}
AND ds.patient_id = #{ patientId }
<if test="tempId != null">
AND ds.definition_id = #{ tempId }
</if>
AND ds.source = #{source}
AND ds.delete_flag = '0'
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.DocTemplateMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.EmrDetailMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.EmrDictMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.EmrMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.EmrTemplateMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.OrderProcessMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.RequestFormMapper">
</mapper>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.document.mapper.VitalSignsMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.financial.mapper.ClaimMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.financial.mapper.ClaimResponseMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.financial.mapper.ContractMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.financial.mapper.PaymentNoticeMapper">
</mapper>

View File

@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.financial.mapper.PaymentRecDetailMapper">
<select id="getListByReconciliationIds"
resultType="com.openhis.financial.model.PaymentRecDetailAccountResult">
SELECT
T1.ID,
T1.predecessor_id,
T1.reconciliation_id,
T1.target_enum,
T1.account_id,
T1.account_code,
T1.pay_enum,
T1.pay_level_enum,
T1.amount,
T1.return_amount,
T1.charge_amount,
T1.pay_trans_no,
T1.pay_trans_text,
T1.pay_trans_date,
T1.before_balance,
T1.after_balance,
T1.result_enum,
--id,
T2.status_enum,
T2.billing_status_enum,
T2.type_code,
T2.NO,
T2.NAME,
T2.patient_id,
T2.encounter_id,
T2.balance_amount,
T2.yb_area_no,
T2.contract_no,
T2.limit_account,
T2.encounter_flag
FROM
fin_payment_rec_detail T1
LEFT JOIN adm_account T2 ON T1.account_id = T2."id"
LEFT JOIN fin_payment_reconciliation T3 ON T3.ID = T1.reconciliation_id
AND T2.delete_flag = '0'
WHERE
T1.reconciliation_id IN
<foreach collection="paymentIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
AND T3.kind_enum = #{kindEnum}
AND T1.pay_enum NOT IN (310201,8,1,2,3,4,5,6,7,9,510100,340100,390100,390200,610100,640100,390400,620100,360100,999900,390300,9999981,360300)
AND T1.delete_flag = '0';
</select>
</mapper>

View File

@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.financial.mapper.PaymentReconciliationMapper">
<select id="getPaymentAccountContract"
resultType="com.openhis.financial.model.PaymentReconciliationAccountDel">
SELECT payment.*,
account.contract_no AS account_contract_no
FROM fin_payment_reconciliation payment
LEFT JOIN fin_payment_rec_detail paydel ON payment."id" = paydel.reconciliation_id
LEFT JOIN adm_account account ON account."id" = paydel.account_id
WHERE payment.bill_date &gt; #{startTime} :: timestamp
AND payment.bill_date &lt; #{endTime} :: timestamp
AND payment.delete_flag = '0'
AND payment.status_enum IN (#{success}, #{returnAll})
AND payment.kind_enum = #{clinic}
AND account.contract_no IS NOT NULL
<if test="entererId != null">
AND payment.enterer_id = #{entererId}
</if>
<if test="contractNo != null">
AND account.contract_no = #{contractNo}
</if>
GROUP BY payment.ID,
account.ID
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.financial.mapper.ThreePartPayCallBackMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.jlau.mapper.ReviewPrescriptionRecordsMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.lab.mapper.ActivityDefDeviceDefMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.lab.mapper.ActivityDefObservationDefMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.lab.mapper.ActivityDefSpecimenDefMapper">
</mapper>

View File

@@ -1,83 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.lab.mapper.InspectionPackageDetailMapper">
<!-- 根据套餐ID删除明细数据 -->
<delete id="deleteByPackageId">
DELETE FROM inspection_package_detail
WHERE basic_information_id = #{packageId} AND del_flag = false
</delete>
<!-- 根据套餐ID查询明细列表 -->
<select id="selectByPackageId" resultType="com.openhis.lab.domain.InspectionPackageDetail">
SELECT
detail_id,
basic_information_id,
package_name,
item_name,
dosage,
route,
frequency,
days,
quantity,
unit,
unit_price,
amount,
service_fee,
total_amount,
origin,
create_time,
update_time,
del_flag
FROM inspection_package_detail
WHERE basic_information_id = #{packageId} AND del_flag = false
ORDER BY create_time ASC
</select>
<!-- 批量插入明细数据 -->
<insert id="batchInsert">
INSERT INTO inspection_package_detail (
detail_id,
basic_information_id,
package_name,
item_name,
dosage,
route,
frequency,
days,
quantity,
unit,
unit_price,
amount,
service_fee,
total_amount,
origin,
create_time,
update_time,
del_flag
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.detailId},
#{item.basicInformationId},
#{item.packageName},
#{item.itemName},
#{item.dosage},
#{item.route},
#{item.frequency},
#{item.days},
#{item.quantity},
#{item.unit},
#{item.unitPrice},
#{item.amount},
#{item.serviceFee},
#{item.totalAmount},
#{item.origin},
#{item.createTime},
#{item.updateTime},
#{item.delFlag}
)
</foreach>
</insert>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.lab.mapper.LabActivityDefinitionMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.lab.mapper.ObservationMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.lab.mapper.SpecimenMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.medication.mapper.MedicationDefinitionMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.medication.mapper.MedicationDispenseMapper">
</mapper>

View File

@@ -1,74 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.medication.mapper.MedicationMapper">
<select id="selectDetailList" resultType="com.openhis.medication.domain.MedicationDetail">
SELECT T1.id,
T1.medication_product_id,
T1.status_enum,
T1.org_id,
T1.dose_form_code,
T1.total_volume,
T1.ingredient_item,
T1.active_flag,
T1.lot_number,
T1.effective_date,
T1.expiration_date,
T1.effective_date,
T1.method_code,
T1.rate_code,
T1.dose,
T1.dose_unit_code,
T1.max_unit,
T1.definition,
T2.code,
T2.name,
T2.domain_enum,
T2.name_en,
T2.py_code,
T2.wb_code,
T2.category_code,
T2.merchandise_name,
T2.merchandise_py_code,
T2.merchandise_wb_code,
T2.unit_code,
T2.min_unit_code,
T2.part_percent,
T2.dose_from
FROM med_medication AS T1
LEFT JOIN med_medication_definition AS T2
ON T1.medication_product_id = T2.id
WHERE T1.delete_flag = 0
</select>
<!-- 根据关键字查询 如果关键字为空查询10条否则返回查询到的所有 -->
<select id="searchMedListByKeyWord" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
select med_def.id as targetId, med_def.name as name, med.total_volume as volume, details.amount as
originRetailPrice,def_details.amount as originBuyingPrice,med_def.bus_no as busNo,med_def.min_unit_code as unitCode
from med_medication med
inner join med_medication_definition med_def on med.medication_def_id = med_def.id
inner join adm_charge_item_definition actd on actd.instance_id = med_def.id
left join adm_charge_item_def_detail details on actd.id = details.definition_id
and details.id = (select cidd.id from adm_charge_item_def_detail cidd where actd.id = cidd.definition_id and
cidd.condition_code = '5' and cidd.delete_flag = '0' ORDER BY create_time DESC
LIMIT 1)
left join adm_charge_item_def_detail def_details on actd.id = def_details.definition_id
and def_details.id = (select cidd.id from adm_charge_item_def_detail cidd where actd.id = cidd.definition_id and
cidd.condition_code = '1' and cidd.delete_flag = '0' ORDER BY create_time DESC
LIMIT 1)
WHERE med.delete_flag = '0' and med_def.id in (select inventoty.item_id FROM wor_inventory_item inventoty where
inventoty.quantity > 0 and inventoty.delete_flag = '0' )
<if test="keyWord == ''">
limit 10
</if>
<if test="keyWord !=''">
and
(med_def.name like concat('%',#{keyWord},'%') or med_def.merchandise_name like concat('%',#{keyWord},'%') or
med_def.py_str like concat('%',#{keyWord},'%') or
med_def.wb_str like concat('%',#{keyWord},'%') or med_def.merchandise_py_str like concat('%',#{keyWord},'%')
or med_def.merchandise_wb_str like concat('%',#{keyWord},'%'))
</if>
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.medication.mapper.MedicationRequestMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.nenu.mapper.GfRatioApplicationMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.nenu.mapper.GfRatioMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.sys.mapper.OperationRecordMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.sys.mapper.OptionMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.template.mapper.ActivityDeviceMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.template.mapper.EncounterAutoRollMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.template.mapper.OrderGroupMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.template.mapper.OrdersGroupPackageDetailMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.template.mapper.OrdersGroupPackageMapper">
</mapper>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.workflow.mapper.ActivityDefinitionMapper">
<select id="getAppointActivityDefinitionId" resultType="long">
SELECT ID
FROM wor_activity_definition
WHERE delete_flag = '0'
AND status_enum = #{status}
AND NAME = #{activityName} LIMIT 1
</select>
<!-- 根据项目id数组 加载诊疗集合 -->
<select id="searchActivityDefinitionByIds" resultType="com.openhis.workflow.dto.ActivityDto">
SELECT id as itemId, bus_no as busNo, name as name
FROM wor_activity_definition
WHERE id IN
<foreach collection="itemIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!-- 根据关键字查询 如果关键字为空查询10条否则返回查询到的所有 -->
<select id="searchActivityListByKeyWord" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
SELECT cid.price AS originRetailPrice, ad.id AS targetId, ad.bus_no AS busNo, ad.name AS name
FROM wor_activity_definition ad
inner join adm_charge_item_definition cid on ad.id = cid.instance_id
WHERE ad.delete_flag = '0'
AND (name LIKE concat('%', #{keyWord}, '%') or py_str LIKE concat('%', #{keyWord}, '%') or
wb_str LIKE concat('%', #{keyWord}, '%'))
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.workflow.mapper.DeviceDispenseMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.workflow.mapper.DeviceRequestMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.workflow.mapper.ElepMedicationRequestMapper">
</mapper>

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.workflow.mapper.InventoryItemMapper">
<!-- 根据药品、耗材ID数组查询 存库大于 零 并且分组的集合数据 -->
<select id="searchResultDataList" resultType="com.openhis.workflow.dto.AdjustPriceDto">
SELECT item_id as itemId, item_table as itemTable ,location_id as locationId,quantity as totalCount,lot_number as
lotNumber,unit_code as unitCode
FROM wor_inventory_item
WHERE
quantity > 0 AND delete_flag = '0' AND
item_id IN
<foreach collection="itemIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!-- 根据药品、耗材ID数组查询 存库大于 零 并且分组的集合数据 -->
<select id="searchResultDataListByGroup" resultType="com.openhis.workflow.dto.AdjustPriceDto">
SELECT item_id as itemId
FROM wor_inventory_item
WHERE
quantity > 0 AND delete_flag = '0' AND
item_id IN
<foreach collection="itemIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY item_id
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.workflow.mapper.ServiceRequestDetailMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.workflow.mapper.ServiceRequestMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.workflow.mapper.SupplyDeliveryMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.workflow.mapper.SupplyRequestAutoMapper">
</mapper>

View File

@@ -1,217 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.workflow.mapper.SupplyRequestMapper">
<!-- 根据 调价单号 查询 supplyrequest 和 价格主表 -->
<select id="searchDataForBusNo" resultType="com.openhis.workflow.dto.ChangePriceDto">
SELECT acid.id as chargeId,
wsr.item_id as itemId,
wsr.price as newPrice,
wsr.retail_price as retailPrice,
wsr.reason as reason,
wsr.item_quantity as quantity,
wsr.id as supplyRequestId
FROM wor_supply_request wsr
INNER JOIN adm_charge_item_definition acid ON wsr.item_id = acid.instance_id
WHERE wsr.bus_no = #{busNo}
</select>
<select id="searchGroupDataForBusNo" resultType="com.openhis.workflow.dto.ChangePriceDto">
SELECT wsr.item_id as itemId, wsr.item_table as itemTable, wsr.retail_price as newPrice
FROM wor_supply_request wsr
WHERE wsr.bus_no = #{busNo}
GROUP BY wsr.item_id, wsr.item_table, wsr.retail_price
</select>
<!-- 根据调价单号 查询未审核的详情-->
<select id="searchMedInfoDataForBusNo" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
SELECT sr.item_id as targetId,
med_def.name as name,
med.total_volume as volume,
sr.price as newBuyingPrice,
sr.retail_price as newRetailPrice,
details.amount as originRetailPrice,
sr.reason as reason,
def_details.amount as originBuyingPrice,
sr.unit_code as unitCode,
sum(sr.item_quantity) as totalQuantity
FROM wor_supply_request sr
LEFT JOIN med_medication_definition med_def ON sr.item_id = med_def.id
LEFT JOIN med_medication med ON sr.item_id = med.id
LEFT JOIN adm_charge_item_definition actd ON actd.instance_id = med_def.id
LEFT JOIN adm_charge_item_def_detail details ON actd.id = details.definition_id
AND details.id = (SELECT cidd.id
FROM adm_charge_item_def_detail cidd
WHERE actd.id = cidd.definition_id
AND cidd.condition_code = '5'
AND cidd.delete_flag = '0'
ORDER BY create_time DESC
LIMIT 1)
LEFT JOIN adm_charge_item_def_detail def_details
ON actd.id = def_details.definition_id
AND def_details.id = (SELECT cidd.id
FROM adm_charge_item_def_detail cidd
WHERE actd.id = cidd.definition_id
AND cidd.condition_code = '1'
AND cidd.delete_flag = '0'
ORDER BY create_time DESC
LIMIT 1)
WHERE sr.bus_no = #{busNo}
GROUP BY sr.item_id, med_def.name, med.total_volume, sr.price, details.amount, sr.reason, sr.retail_price, def_details.amount, sr.unit_code
</select>
<!-- 根据调价单号 查询已经审核过的详情-->
<select id="searchHistoryMedInfoData" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
SELECT sr.item_id as targetId,
med_def.name as name,
med.total_volume as volume,
sr.price as newBuyingPrice,
sr.retail_price as newRetailPrice,
details.amount as originRetailPrice,
def_details.amount as originBuyingPrice,
sr.reason as reason,
sr.unit_code as unitCode,
sum(item_quantity) as totalQuantity
FROM wor_supply_request sr
LEFT JOIN med_medication_definition med_def ON sr.item_id = med_def.id
LEFT JOIN med_medication med ON sr.item_id = med.id
LEFT JOIN adm_charge_item_definition actd ON actd.instance_id = med_def.id
LEFT JOIN adm_charge_item_def_detail details ON actd.id = details.definition_id
AND details.id = (SELECT cidd.id
FROM adm_charge_item_def_detail cidd
WHERE actd.id = cidd.definition_id
AND cidd.condition_code = '5'
AND cidd.create_time <![CDATA[ < ]]> #{createTime} LIMIT 1)
LEFT JOIN adm_charge_item_def_detail def_details
ON actd.id = def_details.definition_id
AND def_details.id = (SELECT acidd.id
FROM adm_charge_item_def_detail acidd
WHERE actd.id = acidd.definition_id
AND acidd.condition_code = '1'
AND acidd.create_time <![CDATA[ < ]]> #{createTime} LIMIT 1)
WHERE sr.bus_no = #{busNo}
GROUP BY sr.item_id, med_def.name, med.total_volume, sr.price, details.amount, sr.reason, sr.retail_price, def_details.amount, sr.unit_code
</select>
<!-- 查询device -->
<select id="searchDeviceInfoDataForBusNo" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
SELECT sr.item_id as targetId,
ad.name as name,
ad.size as volume,
sr.price as newBuyingPrice,
sr.retail_price as newRetailPrice,
details.amount as originRetailPrice,
sr.reason as reason,
def_details.amount as originBuyingPrice
FROM wor_supply_request sr
LEFT JOIN adm_device_definition ad on sr.item_id = ad.id
LEFT JOIN adm_charge_item_definition actd ON actd.instance_id = ad.id
LEFT JOIN adm_charge_item_def_detail details ON actd.id = details.definition_id
AND details.id = (SELECT cidd.id
FROM adm_charge_item_def_detail cidd
WHERE actd.id = cidd.definition_id
AND cidd.condition_code = '5'
AND cidd.delete_flag = '0'
ORDER BY create_time DESC
LIMIT 1)
LEFT JOIN adm_charge_item_def_detail def_details
ON actd.id = def_details.definition_id
AND def_details.id = (SELECT cidd.id
FROM adm_charge_item_def_detail cidd
WHERE actd.id = cidd.definition_id
AND cidd.condition_code = '1'
AND cidd.delete_flag = '0'
ORDER BY create_time DESC
LIMIT 1)
WHERE sr.bus_no = #{busNo}
GROUP BY sr.item_id, ad.name, ad.size, sr.price, details.amount, sr.reason, sr.retail_price, def_details.amount
</select>
<!-- 查询device 历史记录-->
<select id="searchHistoryDeviceInfoDataForBusNo" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
SELECT sr.item_id as targetId,
ad.name as name,
ad.size as volume,
sr.price as newBuyingPrice,
sr.retail_price as newRetailPrice,
details.amount as originRetailPrice,
def_details.amount as originBuyingPrice,
sr.reason as reason,
sr.unit_code as unitCode,
sum(item_quantity) as totalQuantity
FROM wor_supply_request sr
LEFT JOIN adm_device_definition ad on sr.item_id = ad.id
LEFT JOIN adm_charge_item_definition actd ON actd.instance_id = ad.id
LEFT JOIN adm_charge_item_def_detail details ON actd.id = details.definition_id
AND details.id = (SELECT cidd.id
FROM adm_charge_item_def_detail cidd
WHERE actd.id = cidd.definition_id
AND cidd.condition_code = '5'
AND cidd.delete_flag = '0'
AND cidd.create_time <![CDATA[ < ]]> #{createTime} LIMIT 1)
LEFT JOIN adm_charge_item_def_detail def_details
ON actd.id = def_details.definition_id
AND def_details.id = (SELECT acidd.id
FROM adm_charge_item_def_detail acidd
WHERE actd.id = acidd.definition_id
AND acidd.condition_code = '1'
AND acidd.delete_flag = '0'
AND acidd.create_time <![CDATA[ < ]]> #{createTime} LIMIT 1)
WHERE sr.bus_no = #{busNo}
GROUP BY sr.item_id, ad.name, ad.size, sr.price, details.amount, sr.reason, def_details.amount, sr.unit_code, sr.retail_price
</select>
<select id="searchActivityInfoDataForBusNo" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
SELECT sr.id as targetId,
ad.name as name,
sr.retal_price as newRetailPrice,
cid.price as originBuyingPrice,
sr.reason as reason
FROM wor_supply_request sr
LEFT JOIN wor_activity_definition ad ON sr.item_id = ad.id
LEFT JOIN adm_charge_item_definition cid on ad.id = cid.instance_id
WHERE ad.delete_flag = '0'
AND sr.bus_no = #{busNo}
</select>
<select id="searchHistoryActivityInfoDataForBusNo" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
SELECT sr.id as targetId,
ad.name as name,
sr.price as originBuyingPrice,
sr.retal_price as newRetailPrice,
sr.reason as reason
FROM wor_supply_request sr
LEFT JOIN wor_activity_definition ad ON sr.item_id = ad.id
LEFT JOIN adm_charge_item_definition cid on ad.id = cid.instance_id
WHERE ad.delete_flag = '0'
AND sr.bus_no = #{busNo}
</select>
<select id="searchHealthInfoDataForBusNo" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
SELECT sr.id as targetId,
heal.name as name,
sr.retail_price as newRetailPrice,
cid.price as originBuyingPrice,
sr.reason as reason,
org.name as orgName
FROM wor_supply_request sr
LEFT JOIN adm_healthcare_service heal ON sr.item_id = heal.id
LEFT JOIN adm_organization org ON heal.offered_org_id = org.id
LEFT JOIN adm_charge_item_definition cid on heal.id = cid.instance_id
WHERE heal.delete_flag = '0'
AND sr.bus_no = #{busNo}
</select>
<select id="searchHistoryHealthInfoDataForBusNo" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
SELECT sr.id as targetId,
heal.name as name,
sr.price as originBuyingPrice,
sr.retail_price as newRetailPrice,
sr.reason as reason,
org.name as orgName
FROM wor_supply_request sr
LEFT JOIN adm_healthcare_service heal ON sr.item_id = heal.id
LEFT JOIN adm_organization org ON heal.offered_org_id = org.id
LEFT JOIN adm_charge_item_definition cid on heal.id = cid.instance_id
WHERE heal.delete_flag = '0'
AND sr.bus_no = #{busNo}
</select>
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.yb.mapper.ClinicSettleMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.yb.mapper.ClinicUnSettleMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.yb.mapper.ClinicPreSettleMapper">
</mapper>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.yb.mapper.ClinicUnRegMapper">
</mapper>

Some files were not shown because too many files have changed in this diff Show More