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.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.*;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.DispenseStatus;
|
||||
import com.openhis.common.enums.NotPerformedReasonEnum;
|
||||
import com.openhis.common.enums.OrganizationClass;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
@@ -27,6 +24,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -97,7 +95,7 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
||||
|
||||
// 查询条件设定
|
||||
String condition = encounterInfoSearchParam.getCondition();
|
||||
if (!condition.isEmpty()){
|
||||
if (StringUtils.isNotEmpty(condition)){
|
||||
Pattern pattern = Pattern.compile(".*\\d.*");
|
||||
Matcher matcher = pattern.matcher(encounterInfoSearchParam.getCondition());
|
||||
encounterInfoSearchParam.setIdCard(matcher.find() ? condition:"");
|
||||
@@ -126,11 +124,19 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
||||
// 患者基本信息查询
|
||||
PrescriptionPatientInfoDto prescriptionPatientInfoDto = westernMedicineDispenseMapper.
|
||||
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.
|
||||
selectPrescriptionMedicineInfoList(encounterId);
|
||||
|
||||
// 计算合计金额
|
||||
if(!prescriptionMedicineInfoList.isEmpty()) {
|
||||
BigDecimal totalPrice = new BigDecimal(0);
|
||||
@@ -139,11 +145,9 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
||||
}
|
||||
prescriptionPatientInfoDto.setTotalPrice(totalPrice);
|
||||
}
|
||||
|
||||
PrescriptionInfoDto prescriptionInfoDto = new PrescriptionInfoDto();
|
||||
prescriptionInfoDto.setPrescriptionPatientInfoDto(prescriptionPatientInfoDto);
|
||||
prescriptionInfoDto.setPrescriptionMedicineInfoDtoList(prescriptionMedicineInfoList);
|
||||
|
||||
return R.ok(prescriptionInfoDto);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,6 @@ public class PrescriptionPatientInfoDto implements Serializable {
|
||||
/** 就诊日期 */
|
||||
private String encounterDate;
|
||||
|
||||
/** 门诊诊断 */
|
||||
private String diagnoseName;
|
||||
|
||||
/** 总金额 */
|
||||
private BigDecimal totalPrice;
|
||||
}
|
||||
@@ -4,132 +4,116 @@
|
||||
<select id="selectEncounterInfoListPage" resultType="com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto">
|
||||
SELECT
|
||||
encounter_id,
|
||||
organization_id,
|
||||
department_name,
|
||||
id_card,
|
||||
patient_name,
|
||||
gender_enum,
|
||||
encounter_date
|
||||
|
||||
encounter_date,
|
||||
organization_id,
|
||||
id_card,
|
||||
start_time
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
DISTINCT
|
||||
T2.id AS encounter_id,
|
||||
TO_CHAR(T2.start_time,'YYYY-MM-DD') AS encounter_date,
|
||||
T2.organization_id,
|
||||
T3.gender_enum,
|
||||
T3.name AS patient_name,
|
||||
T3.id_card,
|
||||
T6.name AS department_name
|
||||
|
||||
FROM med_medication_dispense AS T1
|
||||
|
||||
INNER JOIN adm_encounter AS T2
|
||||
ON T1.encounter_id = T2.id
|
||||
|
||||
INNER JOIN adm_patient AS T3
|
||||
ON T1.patient_id = T3.id
|
||||
|
||||
INNER JOIN med_medication AS T4
|
||||
ON T1.medication_id = T4.id
|
||||
|
||||
INNER JOIN med_medication_definition AS T5
|
||||
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
|
||||
|
||||
T1.id AS encounter_id,
|
||||
T1.start_time,
|
||||
TO_CHAR(T1.start_time,'YYYY-MM-DD') AS encounter_date,
|
||||
T1.organization_id,
|
||||
T2.gender_enum,
|
||||
T2.name AS patient_name,
|
||||
T2.id_card,
|
||||
T3.name AS department_name
|
||||
FROM adm_encounter AS T1
|
||||
INNER JOIN adm_patient AS T2
|
||||
ON T1.patient_id = T2.id
|
||||
LEFT OUTER JOIN adm_organization AS T3
|
||||
ON T1.organization_id = T3.id
|
||||
GROUP BY
|
||||
T1.id,
|
||||
T1.start_time,
|
||||
T1.organization_id,
|
||||
T2.gender_enum,
|
||||
T2.name,
|
||||
T2.id_card,
|
||||
T3.name
|
||||
ORDER BY
|
||||
T2.start_time desc,
|
||||
T2.organization_id
|
||||
)
|
||||
T1.start_time desc,
|
||||
T1.organization_id,
|
||||
T1.patient_id
|
||||
)
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
<select id="selectPrescriptionPatientInfo" resultType="com.openhis.web.pharmacymanage.dto.PrescriptionPatientInfoDto">
|
||||
SELECT
|
||||
DISTINCT
|
||||
T1.name AS patient_name,
|
||||
T1.gender_enum,
|
||||
T1.birth_date,
|
||||
T4.category_enum,
|
||||
T1.id_card,
|
||||
T5.name AS organization_name,
|
||||
TO_CHAR(T2.start_time,'YYYY-MM-DD') AS encounter_date
|
||||
|
||||
T2.name AS patient_name,
|
||||
T2.gender_enum,
|
||||
T2.birth_date,
|
||||
T4.category_enum,
|
||||
T2.id_card,
|
||||
T5.name AS organization_name,
|
||||
TO_CHAR(T1.start_time,'YYYY-MM-DD') AS encounter_date
|
||||
FROM adm_encounter AS T1
|
||||
|
||||
INNER JOIN adm_patient AS T2
|
||||
ON T1.id = T2.encounter_id
|
||||
|
||||
INNER JOIN med_medication_request AS T3
|
||||
ON T1.patient_id = T2.id
|
||||
LEFT OUTER JOIN med_medication_request AS T3
|
||||
ON T1.id = T3.encounter_id
|
||||
|
||||
INNER JOIN fin_contract AS T4
|
||||
LEFT OUTER JOIN fin_contract AS T4
|
||||
ON T3.contract_no = T4.bus_no
|
||||
|
||||
INNER JOIN adm_organization AS T5
|
||||
LEFT OUTER JOIN adm_organization AS T5
|
||||
ON T1.organization_id = T5.id
|
||||
|
||||
WHERE
|
||||
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 id="selectPrescriptionMedicineInfoList" resultType="com.openhis.web.pharmacymanage.dto.PrescriptionMedicineInfoDto">
|
||||
SELECT
|
||||
T7.name AS department_name,
|
||||
T8.name AS doctor_name,
|
||||
T1.prescription_no,
|
||||
T3.name AS medicine_name,
|
||||
T2.total_volume,
|
||||
T1.dose,
|
||||
T1.rate_code,
|
||||
T1.method_code,
|
||||
T1.dose_unit_code,
|
||||
T1.max_dose,
|
||||
T1.first_dose,
|
||||
T1.first_duration,
|
||||
T1.dispense_interval,
|
||||
T1.dispense_per_quantity,
|
||||
T1.dispense_per_duration,
|
||||
T1.quantity,
|
||||
T4.unit_price,
|
||||
T4.total_price
|
||||
|
||||
FROM med_medication_request AS T1
|
||||
|
||||
INNER JOIN med_medication AS T2
|
||||
ON T1.medication_id = T2.id
|
||||
|
||||
INNER JOIN med_medication_definition AS T3
|
||||
ON T2.medication_def_id = T3.id
|
||||
AND T3.category_code IN ('1','2')
|
||||
|
||||
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
|
||||
|
||||
DISTINCT
|
||||
T7.name AS department_name,
|
||||
T8.name AS doctor_name,
|
||||
T2.prescription_no,
|
||||
T4.name AS medicine_name,
|
||||
T3.total_volume,
|
||||
T1.dose,
|
||||
T2.rate_code,
|
||||
T1.method_code,
|
||||
T1.dose_unit_code,
|
||||
T2.max_dose,
|
||||
T2.first_dose,
|
||||
T2.first_duration,
|
||||
T2.dispense_interval,
|
||||
T2.dispense_per_quantity,
|
||||
T2.dispense_per_duration,
|
||||
T1.quantity,
|
||||
T5.unit_price,
|
||||
T5.total_price
|
||||
FROM med_medication_dispense AS T1
|
||||
INNER JOIN med_medication_request AS T2
|
||||
ON T1.med_req_id = T2.id
|
||||
INNER JOIN med_medication AS T3
|
||||
ON T1.medication_id = T3.id
|
||||
INNER JOIN med_medication_definition AS T4
|
||||
ON T3.medication_def_id = T4.id
|
||||
AND T4.category_code IN ('1','2')
|
||||
INNER JOIN adm_charge_item AS T5
|
||||
ON T1.med_req_id = T5.service_id
|
||||
INNER JOIN adm_encounter AS T6
|
||||
ON T1.encounter_id = T6.id
|
||||
|
||||
INNER JOIN adm_organization AS T7
|
||||
LEFT OUTER JOIN adm_organization AS T7
|
||||
ON T6.organization_id = T7.id
|
||||
|
||||
INNER JOIN adm_practitioner AS T8
|
||||
LEFT OUTER JOIN adm_practitioner AS T8
|
||||
ON T1.practitioner_id = T8.id
|
||||
|
||||
WHERE
|
||||
T1.encountId = #{encounterId}
|
||||
AND T5.status_enum = 3
|
||||
|
||||
T1.encounter_id = #{encounterId}
|
||||
AND T1.status_enum = 2
|
||||
ORDER BY
|
||||
T1.prescription_no,
|
||||
T1.medication_id
|
||||
prescription_no,
|
||||
medicine_name
|
||||
</select>
|
||||
<select id="selectDispenseInventoryInfoByPrescriptionNo" resultType="com.openhis.web.pharmacymanage.dto.DispenseInventoryDto">
|
||||
SELECT
|
||||
@@ -142,22 +126,16 @@
|
||||
T3.min_unit_code AS inventory_min_unit_code,
|
||||
T3.min_quantity AS inventory_min_quantity,
|
||||
T5.part_percent
|
||||
|
||||
FROM med_medication_dispense AS T1
|
||||
|
||||
INNER JOIN med_medication_request AS T2
|
||||
ON T1.med_req_id = T2.id
|
||||
|
||||
INNER JOIN wor_inventory_item AS T3
|
||||
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
|
||||
ON T1.medication_id = T4.id
|
||||
|
||||
ON T1.medication_id = T4.id
|
||||
INNER JOIN med_medication_definition AS T5
|
||||
ON T4.medication_def_id = T5.id
|
||||
|
||||
ON T4.medication_def_id = T5.id
|
||||
WHERE
|
||||
T2.prescription_no = #{prescriptionNo}
|
||||
</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