update
This commit is contained in:
@@ -3,15 +3,12 @@ package com.openhis.web.pharmacymanage.appservice.impl;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.core.common.utils.DateUtils;
|
import com.core.common.utils.*;
|
||||||
import com.core.common.utils.MessageUtils;
|
|
||||||
import com.core.common.utils.SecurityUtils;
|
|
||||||
import com.openhis.administration.domain.Organization;
|
import com.openhis.administration.domain.Organization;
|
||||||
import com.openhis.administration.service.IOrganizationService;
|
import com.openhis.administration.service.IOrganizationService;
|
||||||
import com.openhis.common.constant.PromptMsgConstant;
|
import com.openhis.common.constant.PromptMsgConstant;
|
||||||
import com.openhis.common.enums.DispenseStatus;
|
import com.openhis.common.enums.*;
|
||||||
import com.openhis.common.enums.NotPerformedReasonEnum;
|
import com.openhis.common.utils.EnumUtils;
|
||||||
import com.openhis.common.enums.OrganizationClass;
|
|
||||||
import com.openhis.common.utils.HisQueryUtils;
|
import com.openhis.common.utils.HisQueryUtils;
|
||||||
import com.openhis.medication.domain.MedicationDispense;
|
import com.openhis.medication.domain.MedicationDispense;
|
||||||
import com.openhis.medication.service.IMedicationDispenseService;
|
import com.openhis.medication.service.IMedicationDispenseService;
|
||||||
@@ -27,6 +24,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -97,7 +95,7 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
|
|
||||||
// 查询条件设定
|
// 查询条件设定
|
||||||
String condition = encounterInfoSearchParam.getCondition();
|
String condition = encounterInfoSearchParam.getCondition();
|
||||||
if (!condition.isEmpty()){
|
if (StringUtils.isNotEmpty(condition)){
|
||||||
Pattern pattern = Pattern.compile(".*\\d.*");
|
Pattern pattern = Pattern.compile(".*\\d.*");
|
||||||
Matcher matcher = pattern.matcher(encounterInfoSearchParam.getCondition());
|
Matcher matcher = pattern.matcher(encounterInfoSearchParam.getCondition());
|
||||||
encounterInfoSearchParam.setIdCard(matcher.find() ? condition:"");
|
encounterInfoSearchParam.setIdCard(matcher.find() ? condition:"");
|
||||||
@@ -126,11 +124,19 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
// 患者基本信息查询
|
// 患者基本信息查询
|
||||||
PrescriptionPatientInfoDto prescriptionPatientInfoDto = westernMedicineDispenseMapper.
|
PrescriptionPatientInfoDto prescriptionPatientInfoDto = westernMedicineDispenseMapper.
|
||||||
selectPrescriptionPatientInfo(encounterId);
|
selectPrescriptionPatientInfo(encounterId);
|
||||||
|
// 年龄
|
||||||
|
prescriptionPatientInfoDto.setAge(AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirth_date()));
|
||||||
|
// 性别
|
||||||
|
prescriptionPatientInfoDto.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class,
|
||||||
|
prescriptionPatientInfoDto.getGenderEnum()));
|
||||||
|
// 合同类型
|
||||||
|
if (StringUtils.isNull(prescriptionPatientInfoDto.getCategoryEnum())){
|
||||||
|
prescriptionPatientInfoDto.setCategoryEnum_enumText(EnumUtils.getInfoByValue(FinCategory.class,
|
||||||
|
prescriptionPatientInfoDto.getCategoryEnum()));
|
||||||
|
}
|
||||||
// 处方单信息查询
|
// 处方单信息查询
|
||||||
List<PrescriptionMedicineInfoDto> prescriptionMedicineInfoList = westernMedicineDispenseMapper.
|
List<PrescriptionMedicineInfoDto> prescriptionMedicineInfoList = westernMedicineDispenseMapper.
|
||||||
selectPrescriptionMedicineInfoList(encounterId);
|
selectPrescriptionMedicineInfoList(encounterId);
|
||||||
|
|
||||||
// 计算合计金额
|
// 计算合计金额
|
||||||
if(!prescriptionMedicineInfoList.isEmpty()) {
|
if(!prescriptionMedicineInfoList.isEmpty()) {
|
||||||
BigDecimal totalPrice = new BigDecimal(0);
|
BigDecimal totalPrice = new BigDecimal(0);
|
||||||
@@ -139,11 +145,9 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
}
|
}
|
||||||
prescriptionPatientInfoDto.setTotalPrice(totalPrice);
|
prescriptionPatientInfoDto.setTotalPrice(totalPrice);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrescriptionInfoDto prescriptionInfoDto = new PrescriptionInfoDto();
|
PrescriptionInfoDto prescriptionInfoDto = new PrescriptionInfoDto();
|
||||||
prescriptionInfoDto.setPrescriptionPatientInfoDto(prescriptionPatientInfoDto);
|
prescriptionInfoDto.setPrescriptionPatientInfoDto(prescriptionPatientInfoDto);
|
||||||
prescriptionInfoDto.setPrescriptionMedicineInfoDtoList(prescriptionMedicineInfoList);
|
prescriptionInfoDto.setPrescriptionMedicineInfoDtoList(prescriptionMedicineInfoList);
|
||||||
|
|
||||||
return R.ok(prescriptionInfoDto);
|
return R.ok(prescriptionInfoDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,6 @@ public class PrescriptionPatientInfoDto implements Serializable {
|
|||||||
/** 就诊日期 */
|
/** 就诊日期 */
|
||||||
private String encounterDate;
|
private String encounterDate;
|
||||||
|
|
||||||
/** 门诊诊断 */
|
|
||||||
private String diagnoseName;
|
|
||||||
|
|
||||||
/** 总金额 */
|
/** 总金额 */
|
||||||
private BigDecimal totalPrice;
|
private BigDecimal totalPrice;
|
||||||
}
|
}
|
||||||
@@ -4,132 +4,116 @@
|
|||||||
<select id="selectEncounterInfoListPage" resultType="com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto">
|
<select id="selectEncounterInfoListPage" resultType="com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto">
|
||||||
SELECT
|
SELECT
|
||||||
encounter_id,
|
encounter_id,
|
||||||
organization_id,
|
|
||||||
department_name,
|
department_name,
|
||||||
id_card,
|
|
||||||
patient_name,
|
patient_name,
|
||||||
gender_enum,
|
gender_enum,
|
||||||
encounter_date
|
encounter_date,
|
||||||
|
organization_id,
|
||||||
|
id_card,
|
||||||
|
start_time
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT
|
T1.id AS encounter_id,
|
||||||
T2.id AS encounter_id,
|
T1.start_time,
|
||||||
TO_CHAR(T2.start_time,'YYYY-MM-DD') AS encounter_date,
|
TO_CHAR(T1.start_time,'YYYY-MM-DD') AS encounter_date,
|
||||||
T2.organization_id,
|
T1.organization_id,
|
||||||
T3.gender_enum,
|
T2.gender_enum,
|
||||||
T3.name AS patient_name,
|
T2.name AS patient_name,
|
||||||
T3.id_card,
|
T2.id_card,
|
||||||
T6.name AS department_name
|
T3.name AS department_name
|
||||||
|
FROM adm_encounter AS T1
|
||||||
FROM med_medication_dispense AS T1
|
INNER JOIN adm_patient AS T2
|
||||||
|
ON T1.patient_id = T2.id
|
||||||
INNER JOIN adm_encounter AS T2
|
LEFT OUTER JOIN adm_organization AS T3
|
||||||
ON T1.encounter_id = T2.id
|
ON T1.organization_id = T3.id
|
||||||
|
GROUP BY
|
||||||
INNER JOIN adm_patient AS T3
|
T1.id,
|
||||||
ON T1.patient_id = T3.id
|
T1.start_time,
|
||||||
|
T1.organization_id,
|
||||||
INNER JOIN med_medication AS T4
|
T2.gender_enum,
|
||||||
ON T1.medication_id = T4.id
|
T2.name,
|
||||||
|
T2.id_card,
|
||||||
INNER JOIN med_medication_definition AS T5
|
T3.name
|
||||||
ON T4.medication_def_id = T5.id
|
|
||||||
AND T5.category_code IN ('1','2')
|
|
||||||
|
|
||||||
INNER JOIN adm_organization AS T6
|
|
||||||
ON T2.organization_id = T6.id
|
|
||||||
|
|
||||||
WHERE
|
|
||||||
T1.status_enum = 3
|
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
T2.start_time desc,
|
T1.start_time desc,
|
||||||
T2.organization_id
|
T1.organization_id,
|
||||||
|
T1.patient_id
|
||||||
)
|
)
|
||||||
${ew.customSqlSegment}
|
${ew.customSqlSegment}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectPrescriptionPatientInfo" resultType="com.openhis.web.pharmacymanage.dto.PrescriptionPatientInfoDto">
|
<select id="selectPrescriptionPatientInfo" resultType="com.openhis.web.pharmacymanage.dto.PrescriptionPatientInfoDto">
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT
|
T2.name AS patient_name,
|
||||||
T1.name AS patient_name,
|
T2.gender_enum,
|
||||||
T1.gender_enum,
|
T2.birth_date,
|
||||||
T1.birth_date,
|
|
||||||
T4.category_enum,
|
T4.category_enum,
|
||||||
T1.id_card,
|
T2.id_card,
|
||||||
T5.name AS organization_name,
|
T5.name AS organization_name,
|
||||||
TO_CHAR(T2.start_time,'YYYY-MM-DD') AS encounter_date
|
TO_CHAR(T1.start_time,'YYYY-MM-DD') AS encounter_date
|
||||||
|
|
||||||
FROM adm_encounter AS T1
|
FROM adm_encounter AS T1
|
||||||
|
|
||||||
INNER JOIN adm_patient AS T2
|
INNER JOIN adm_patient AS T2
|
||||||
ON T1.id = T2.encounter_id
|
ON T1.patient_id = T2.id
|
||||||
|
LEFT OUTER JOIN med_medication_request AS T3
|
||||||
INNER JOIN med_medication_request AS T3
|
|
||||||
ON T1.id = T3.encounter_id
|
ON T1.id = T3.encounter_id
|
||||||
|
LEFT OUTER JOIN fin_contract AS T4
|
||||||
INNER JOIN fin_contract AS T4
|
|
||||||
ON T3.contract_no = T4.bus_no
|
ON T3.contract_no = T4.bus_no
|
||||||
|
LEFT OUTER JOIN adm_organization AS T5
|
||||||
INNER JOIN adm_organization AS T5
|
|
||||||
ON T1.organization_id = T5.id
|
ON T1.organization_id = T5.id
|
||||||
|
|
||||||
WHERE
|
WHERE
|
||||||
T1.id = #{encounterId}
|
T1.id = #{encounterId}
|
||||||
|
GROUP BY
|
||||||
|
T2.name,
|
||||||
|
T2.gender_enum,
|
||||||
|
T2.birth_date,
|
||||||
|
T4.category_enum,
|
||||||
|
T2.id_card,
|
||||||
|
T5.name,
|
||||||
|
T1.start_time
|
||||||
</select>
|
</select>
|
||||||
<select id="selectPrescriptionMedicineInfoList" resultType="com.openhis.web.pharmacymanage.dto.PrescriptionMedicineInfoDto">
|
<select id="selectPrescriptionMedicineInfoList" resultType="com.openhis.web.pharmacymanage.dto.PrescriptionMedicineInfoDto">
|
||||||
SELECT
|
SELECT
|
||||||
|
DISTINCT
|
||||||
T7.name AS department_name,
|
T7.name AS department_name,
|
||||||
T8.name AS doctor_name,
|
T8.name AS doctor_name,
|
||||||
T1.prescription_no,
|
T2.prescription_no,
|
||||||
T3.name AS medicine_name,
|
T4.name AS medicine_name,
|
||||||
T2.total_volume,
|
T3.total_volume,
|
||||||
T1.dose,
|
T1.dose,
|
||||||
T1.rate_code,
|
T2.rate_code,
|
||||||
T1.method_code,
|
T1.method_code,
|
||||||
T1.dose_unit_code,
|
T1.dose_unit_code,
|
||||||
T1.max_dose,
|
T2.max_dose,
|
||||||
T1.first_dose,
|
T2.first_dose,
|
||||||
T1.first_duration,
|
T2.first_duration,
|
||||||
T1.dispense_interval,
|
T2.dispense_interval,
|
||||||
T1.dispense_per_quantity,
|
T2.dispense_per_quantity,
|
||||||
T1.dispense_per_duration,
|
T2.dispense_per_duration,
|
||||||
T1.quantity,
|
T1.quantity,
|
||||||
T4.unit_price,
|
T5.unit_price,
|
||||||
T4.total_price
|
T5.total_price
|
||||||
|
FROM med_medication_dispense AS T1
|
||||||
FROM med_medication_request AS T1
|
INNER JOIN med_medication_request AS T2
|
||||||
|
ON T1.med_req_id = T2.id
|
||||||
INNER JOIN med_medication AS T2
|
INNER JOIN med_medication AS T3
|
||||||
ON T1.medication_id = T2.id
|
ON T1.medication_id = T3.id
|
||||||
|
INNER JOIN med_medication_definition AS T4
|
||||||
INNER JOIN med_medication_definition AS T3
|
ON T3.medication_def_id = T4.id
|
||||||
ON T2.medication_def_id = T3.id
|
AND T4.category_code IN ('1','2')
|
||||||
AND T3.category_code IN ('1','2')
|
INNER JOIN adm_charge_item AS T5
|
||||||
|
ON T1.med_req_id = T5.service_id
|
||||||
INNER JOIN adm_charge_item AS T4
|
|
||||||
ON T1.id = T4.service_id
|
|
||||||
|
|
||||||
INNER JOIN med_medication_dispense AS T5
|
|
||||||
ON T1.id = T5.med_req_id
|
|
||||||
|
|
||||||
INNER JOIN adm_encounter AS T6
|
INNER JOIN adm_encounter AS T6
|
||||||
ON T1.encounter_id = T6.id
|
ON T1.encounter_id = T6.id
|
||||||
|
LEFT OUTER JOIN adm_organization AS T7
|
||||||
INNER JOIN adm_organization AS T7
|
|
||||||
ON T6.organization_id = T7.id
|
ON T6.organization_id = T7.id
|
||||||
|
LEFT OUTER JOIN adm_practitioner AS T8
|
||||||
INNER JOIN adm_practitioner AS T8
|
|
||||||
ON T1.practitioner_id = T8.id
|
ON T1.practitioner_id = T8.id
|
||||||
|
|
||||||
WHERE
|
WHERE
|
||||||
T1.encountId = #{encounterId}
|
T1.encounter_id = #{encounterId}
|
||||||
AND T5.status_enum = 3
|
AND T1.status_enum = 2
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
T1.prescription_no,
|
prescription_no,
|
||||||
T1.medication_id
|
medicine_name
|
||||||
</select>
|
</select>
|
||||||
<select id="selectDispenseInventoryInfoByPrescriptionNo" resultType="com.openhis.web.pharmacymanage.dto.DispenseInventoryDto">
|
<select id="selectDispenseInventoryInfoByPrescriptionNo" resultType="com.openhis.web.pharmacymanage.dto.DispenseInventoryDto">
|
||||||
SELECT
|
SELECT
|
||||||
@@ -142,22 +126,16 @@
|
|||||||
T3.min_unit_code AS inventory_min_unit_code,
|
T3.min_unit_code AS inventory_min_unit_code,
|
||||||
T3.min_quantity AS inventory_min_quantity,
|
T3.min_quantity AS inventory_min_quantity,
|
||||||
T5.part_percent
|
T5.part_percent
|
||||||
|
|
||||||
FROM med_medication_dispense AS T1
|
FROM med_medication_dispense AS T1
|
||||||
|
|
||||||
INNER JOIN med_medication_request AS T2
|
INNER JOIN med_medication_request AS T2
|
||||||
ON T1.med_req_id = T2.id
|
ON T1.med_req_id = T2.id
|
||||||
|
|
||||||
INNER JOIN wor_inventory_item AS T3
|
INNER JOIN wor_inventory_item AS T3
|
||||||
ON T1.medication_id = T3.item_id
|
ON T1.medication_id = T3.item_id
|
||||||
AND T1.item_table = 'med_medication_definition'
|
AND T3.item_table = 'med_medication_definition'
|
||||||
|
|
||||||
INNER JOIN med_medication AS T4
|
INNER JOIN med_medication AS T4
|
||||||
ON T1.medication_id = T4.id
|
ON T1.medication_id = T4.id
|
||||||
|
|
||||||
INNER JOIN med_medication_definition AS T5
|
INNER JOIN med_medication_definition AS T5
|
||||||
ON T4.medication_def_id = T5.id
|
ON T4.medication_def_id = T5.id
|
||||||
|
|
||||||
WHERE
|
WHERE
|
||||||
T2.prescription_no = #{prescriptionNo}
|
T2.prescription_no = #{prescriptionNo}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.openhis.common.enums;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum FinCategory implements HisEnumInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自费
|
||||||
|
*/
|
||||||
|
SELF_PAY(1, "1", "自费"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 省医保
|
||||||
|
*/
|
||||||
|
PROVINCIAL_MEDICAL_INSURANCE(2, "2", "省医保"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 市医保
|
||||||
|
*/
|
||||||
|
MUNICIPAL_MEDICAL_INSURANCE(4, "4", "市医保");
|
||||||
|
|
||||||
|
private Integer value;
|
||||||
|
private String code;
|
||||||
|
private String info;
|
||||||
|
|
||||||
|
public static FinCategory getByValue(Integer value) {
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (FinCategory val : values()) {
|
||||||
|
if (val.getValue().equals(value)) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user