Skip to content

Commit

Permalink
[DSM] PEPPER-853 sm id fix (#2636)
Browse files Browse the repository at this point in the history
* PEPPER-853 added a check for the number of scrolls and uss to not be zero

* I simplified the query to first check the numbers entered
PEPPER-853

* PEPPER-853 changes to consider NULL as 0 too
  • Loading branch information
pegahtah authored Aug 4, 2023
1 parent a36e412 commit ac44315
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class MercurySampleDao implements Dao<MercurySampleDto> {
+ "LEFT JOIN ddp_onc_history_detail oD on (mr.medical_record_id = oD.medical_record_id AND NOT oD.deleted <=> 1) "
+ "LEFT JOIN ddp_tissue t on (oD.onc_history_detail_id = t.onc_history_detail_id AND NOT t.deleted <=> 1) "
+ "WHERE oD.tissue_received IS NOT NULL AND p.ddp_participant_id = ? AND ddp.instance_name = ? "
+ "AND (IFNULL(t.uss_count, 0) <> 0 OR IFNULL(t.scrolls_count, 0) <> 0) "
+ "AND IFNULL(t.uss_count, 0) = (SELECT count(*) from sm_id sm "
+ "left join sm_id_type smtype on (sm.sm_id_type_id = smtype.sm_id_type_id) "
+ "where smtype.sm_id_type = \"uss\" and sm.tissue_id = t.tissue_id and NOT sm.deleted <=> 1 "
Expand All @@ -40,7 +41,7 @@ public class MercurySampleDao implements Dao<MercurySampleDto> {
+ "From ddp_mercury_sequencing where ddp_participant_id = ? group by (tissue_id) ) as table2 "
+ "on table2.seqt = table1.tissue_id "
+ "LEFT JOIN (select order_id, mercury_sequencing_id, order_status, order_date, mercury_pdo_id "
+ "FROM ddp_mercury_sequencing WHERE ddp_participant_id = ?) as table3 ON(table3.mercury_sequencing_id = table2.ms_id)";
+ "FROM ddp_mercury_sequencing WHERE ddp_participant_id = ?) as table3 ON(table3.mercury_sequencing_id = table2.ms_id) ";


public static String SQL_GET_ELIGIBLE_SAMPLES =
Expand Down

0 comments on commit ac44315

Please sign in to comment.