Merge branch 'dev-remun-diskondpjp' into dev-deploy
This commit is contained in:
commit
fae942fd6e
@ -0,0 +1,12 @@
|
||||
package com.jasamedika.medifirst2000.dao;
|
||||
|
||||
import com.jasamedika.medifirst2000.entities.JumlahDiskonDokter;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
* @author salmanoe
|
||||
* @version 1.0.0
|
||||
* @since 07/02/2024
|
||||
*/
|
||||
public interface JumlahDiskonDokterDao extends JpaRepository<JumlahDiskonDokter, Long> {
|
||||
}
|
||||
@ -206,7 +206,8 @@ public interface PelayananPasienDao extends JpaRepository<PelayananPasien, Strin
|
||||
+ "apd.noRec as idAntrianPasienDiperiksa,apd.pegawaiId as idDPJP," + "apd.ruanganId as idRuangan,"
|
||||
+ "case when lower(ru.namaRuangan) like '%eksekutif%' then 'Eksekutif' else 'Reguler' end as jenisRuangan,"
|
||||
+ "ru.departemenId as idDepartemen," + "pd.noRec as idPasienDaftar,pd.pasienId as pasienId,"
|
||||
+ "sum(case when ppd.komponenHargaId = 35 then ppd.hargaDiscount else 0.0 end) as totalDiskon) "
|
||||
+ "sum(case when ppd.komponenHargaId = 35 then ppd.hargaDiscount else 0.0 end) as totalDiskon,"
|
||||
+ "sum(case when ppd.komponenHargaId = 35 then ppd.hargaJual else 0.0 end) as totalKomponen) "
|
||||
+ "from PelayananPasienDetail ppd, PelayananPasienPetugas ppp " + "inner join ppp.pelayananPasien pp "
|
||||
+ "inner join pp.pasienDaftar apd " + "inner join apd.pasienDaftar pd " + "left join pp.produk pr "
|
||||
+ "left join pp.kelas kls " + "left join pd.kelompokPasien kp " + "left join apd.ruangan ru "
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package com.jasamedika.medifirst2000.service;
|
||||
|
||||
import com.jasamedika.medifirst2000.dto.JumlahDiskonDokterDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author salmanoe
|
||||
* @version 1.0.0
|
||||
* @since 07/02/2024
|
||||
*/
|
||||
public interface JumlahDiskonDokterService {
|
||||
|
||||
void save(List<JumlahDiskonDokterDto> dtos);
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.jasamedika.medifirst2000.service.impl;
|
||||
|
||||
import com.jasamedika.medifirst2000.dao.JumlahDiskonDokterDao;
|
||||
import com.jasamedika.medifirst2000.dto.JumlahDiskonDokterDto;
|
||||
import com.jasamedika.medifirst2000.entities.JumlahDiskonDokter;
|
||||
import com.jasamedika.medifirst2000.service.JumlahDiskonDokterService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author salmanoe
|
||||
* @version 1.0.0
|
||||
* @since 07/02/2024
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class JumlahDiskonDokterServiceImpl implements JumlahDiskonDokterService {
|
||||
|
||||
@Autowired
|
||||
private JumlahDiskonDokterDao jumlahDiskonDokterDao;
|
||||
|
||||
@Override
|
||||
public void save(List<JumlahDiskonDokterDto> dtos) {
|
||||
List<JumlahDiskonDokter> entities = new ArrayList<>();
|
||||
dtos.forEach(
|
||||
dto -> entities.add(JumlahDiskonDokter.builder().persenDiskon(new BigDecimal(dto.getPersenDiskon()))
|
||||
.statusEnabled(dto.getStatusEnabled()).kdProfile((short) 0).build()));
|
||||
jumlahDiskonDokterDao.save(entities);
|
||||
}
|
||||
}
|
||||
@ -586,13 +586,14 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
|
||||
double hargaJual = Double.parseDouble(d.get("hargaJual").toString());
|
||||
if (Boolean.parseBoolean(d.get("isSelisihPaket").toString()))
|
||||
hargaJual -= Double.parseDouble(d.get("hargaDiskon").toString());
|
||||
if (DOKTER_PEMERIKSA.equals(d.get("idJenisPelaksana")) && CommonUtil.isNotNullOrEmpty(d.get("totalDiskon"))
|
||||
if (CommonUtil.isNotNullOrEmpty(d.get("totalDiskon"))
|
||||
&& Double.parseDouble(d.get("totalDiskon").toString()) > 0.0
|
||||
&& CommonUtil.isNullOrEmpty(d.get("idSayatan"))) {
|
||||
/*
|
||||
* Untuk diskon jasa medis oleh dpjp
|
||||
* Untuk diskon jasa medis oleh dokter
|
||||
*/
|
||||
d.put("hargaJasa", 0.0);
|
||||
d.put("hargaJasa", Double.parseDouble(d.get("totalKomponen").toString())
|
||||
- Double.parseDouble(d.get("totalDiskon").toString()));
|
||||
} else if (KLINIK_KARYAWAN.equals(d.get("idRuangan")) || KLINIK_GIGI_KARYAWAN.equals(d.get("idRuangan"))) {
|
||||
/*
|
||||
* Untuk semua klaim di ruangan klinik karyawan
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
package com.jasamedika.medifirst2000.dto;
|
||||
|
||||
import com.jasamedika.medifirst2000.helper.Caption;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author salmanoe
|
||||
* @version 1.0.0
|
||||
* @since 07/02/2024
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class JumlahDiskonDokterDto {
|
||||
protected Long id;
|
||||
|
||||
private Boolean statusEnabled;
|
||||
|
||||
private Short kdProfile;
|
||||
|
||||
@NotBlank
|
||||
@Caption("Persen Diskon")
|
||||
private String persenDiskon;
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.jasamedika.medifirst2000.entities;
|
||||
|
||||
import com.jasamedika.medifirst2000.helper.Caption;
|
||||
import lombok.*;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import static javax.persistence.GenerationType.SEQUENCE;
|
||||
|
||||
/**
|
||||
* @author salmanoe
|
||||
* @version 1.0.0
|
||||
* @since 07/02/2024
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "jumlah_diskon_dokter_m")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class JumlahDiskonDokter implements Serializable {
|
||||
private static final long serialVersionUID = 7600189956745393785L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = SEQUENCE, generator = "sg_jumlah_diskon_dokter_m")
|
||||
@SequenceGenerator(name = "sg_jumlah_diskon_dokter_m", sequenceName = "jumlah_diskon_dokter_m_seq", allocationSize = 1)
|
||||
@Column(name = "id")
|
||||
protected Long id;
|
||||
|
||||
private Boolean statusEnabled;
|
||||
|
||||
private Short kdProfile;
|
||||
|
||||
@Column(nullable = false, unique = true, columnDefinition = "numeric(6,2)")
|
||||
@NotBlank
|
||||
@Caption("Persen Diskon")
|
||||
private BigDecimal persenDiskon;
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import com.jasamedika.medifirst2000.dto.JumlahDiskonDokterDto;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.JumlahDiskonDokterService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import org.apache.commons.collections4.map.SingletonMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
/**
|
||||
* @author salmanoe
|
||||
* @version 1.0.0
|
||||
* @since 07/02/2024
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/master/dokter/jumlah-diskon")
|
||||
public class JumlahDiskonDokterController {
|
||||
private static final Logger LOGGER = getLogger(JumlahDiskonDokterController.class);
|
||||
|
||||
@Autowired
|
||||
private JumlahDiskonDokterService jumlahDiskonDokterService;
|
||||
|
||||
@RequestMapping(method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<JumlahDiskonDokterDto>> save(HttpServletRequest request,
|
||||
@Valid @RequestBody List<JumlahDiskonDokterDto> dtos) {
|
||||
try {
|
||||
jumlahDiskonDokterService.save(dtos);
|
||||
return RestUtil.getJsonResponse(dtos, CREATED, new SingletonMap<>("status", CREATED.getReasonPhrase()));
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add jumlah diskon dokter", e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user