@prodoctors/contracts 1.9.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,4 +10,5 @@ export declare const PROTO_PATHS: {
10
10
  readonly SHIFT: string;
11
11
  readonly RESERVATION: string;
12
12
  readonly ANALYTICS: string;
13
+ readonly PRESCRIPTION: string;
13
14
  };
@@ -14,4 +14,5 @@ exports.PROTO_PATHS = {
14
14
  SHIFT: (0, path_1.join)(__dirname, "../../proto/shift.proto"),
15
15
  RESERVATION: (0, path_1.join)(__dirname, "../../proto/reservation.proto"),
16
16
  ANALYTICS: (0, path_1.join)(__dirname, "../../proto/analytics.proto"),
17
+ PRESCRIPTION: (0, path_1.join)(__dirname, "../../proto/prescription.proto"),
17
18
  };
@@ -0,0 +1,150 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.5
4
+ // protoc v7.34.0
5
+ // source: prescription.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "prescription.v1";
12
+
13
+ /**
14
+ * Retsept qidirish (QR / PINFL / raqam). branch_id — qaysi filial stock'i
15
+ * bilan mos dorilarni ko'rsatish uchun.
16
+ */
17
+ export interface SearchPrescriptionRequest {
18
+ branchId: string;
19
+ safeCode: string;
20
+ patientId?: number | undefined;
21
+ pinfl?: string | undefined;
22
+ prescriptionNumber?:
23
+ | string
24
+ | undefined;
25
+ /** YYYY-MM-DD */
26
+ birthDate?: string | undefined;
27
+ isConfidant?:
28
+ | boolean
29
+ | undefined;
30
+ /** "prescription-{patient_id}-{safe_code}" — parse qilinadi */
31
+ qr?: string | undefined;
32
+ }
33
+
34
+ /** Bizning katalogdagi mos mahsulot (filialda mavjud stock bilan). */
35
+ export interface MatchedProduct {
36
+ productId: string;
37
+ name: string;
38
+ uzpharminfoId: string;
39
+ gtin: string;
40
+ availableQuantity: number;
41
+ price: string;
42
+ requiresPrescription: boolean;
43
+ }
44
+
45
+ /** Retseptdagi ruxsat etilgan dori + bizdagi mos stock. */
46
+ export interface PrescriptionDrugMatch {
47
+ uzpharminfoId: number;
48
+ products: MatchedProduct[];
49
+ }
50
+
51
+ export interface PrescriptionInfo {
52
+ id: number;
53
+ number: string;
54
+ /** active | partially_issued | issued | expired | canceled | draft */
55
+ status: string;
56
+ type: string;
57
+ safeCode: string;
58
+ expiresAt: string;
59
+ isAvailableForIssue: boolean;
60
+ issueBlockReason?: string | undefined;
61
+ allowedUzpharminfoIds: number[];
62
+ allowedAmount: number;
63
+ requiresExactAmount: boolean;
64
+ /** appointment (qisqacha) */
65
+ medicationTitle: string;
66
+ dosage: string;
67
+ totalAmount: number;
68
+ /** bizdagi mos dorilar (filial stock'i bilan) */
69
+ matches: PrescriptionDrugMatch[];
70
+ }
71
+
72
+ export interface SearchPrescriptionResponse {
73
+ prescriptions: PrescriptionInfo[];
74
+ }
75
+
76
+ /**
77
+ * check-issue va issue uchun umumiy so'rov. Dori: uzpharminfo_id / gtin /
78
+ * marking_code (DataMatrix) dan biri + serial.
79
+ */
80
+ export interface DispenseRequest {
81
+ prescriptionId: number;
82
+ uzpharminfoId?: number | undefined;
83
+ gtin?: string | undefined;
84
+ serialNumber?: string | undefined;
85
+ markingCode?: string | undefined;
86
+ drugAmount: number;
87
+ price: number;
88
+ }
89
+
90
+ export interface CheckIssueResponse {
91
+ isAvailable: boolean;
92
+ status: string;
93
+ }
94
+
95
+ export interface IssueResponse {
96
+ prescriptionId: number;
97
+ prescriptionStatus: string;
98
+ message: string;
99
+ }
100
+
101
+ export const PRESCRIPTION_V1_PACKAGE_NAME = "prescription.v1";
102
+
103
+ export interface PrescriptionServiceClient {
104
+ /** Retsept qidirish + bizdagi mos stockni topish. */
105
+
106
+ searchPrescription(request: SearchPrescriptionRequest): Observable<SearchPrescriptionResponse>;
107
+
108
+ /** Berishdan oldin DMED'da tekshirish. */
109
+
110
+ checkPrescriptionIssue(request: DispenseRequest): Observable<CheckIssueResponse>;
111
+
112
+ /** Dorini berish (DMED'da qayd). */
113
+
114
+ issuePrescription(request: DispenseRequest): Observable<IssueResponse>;
115
+ }
116
+
117
+ export interface PrescriptionServiceController {
118
+ /** Retsept qidirish + bizdagi mos stockni topish. */
119
+
120
+ searchPrescription(
121
+ request: SearchPrescriptionRequest,
122
+ ): Promise<SearchPrescriptionResponse> | Observable<SearchPrescriptionResponse> | SearchPrescriptionResponse;
123
+
124
+ /** Berishdan oldin DMED'da tekshirish. */
125
+
126
+ checkPrescriptionIssue(
127
+ request: DispenseRequest,
128
+ ): Promise<CheckIssueResponse> | Observable<CheckIssueResponse> | CheckIssueResponse;
129
+
130
+ /** Dorini berish (DMED'da qayd). */
131
+
132
+ issuePrescription(request: DispenseRequest): Promise<IssueResponse> | Observable<IssueResponse> | IssueResponse;
133
+ }
134
+
135
+ export function PrescriptionServiceControllerMethods() {
136
+ return function (constructor: Function) {
137
+ const grpcMethods: string[] = ["searchPrescription", "checkPrescriptionIssue", "issuePrescription"];
138
+ for (const method of grpcMethods) {
139
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
140
+ GrpcMethod("PrescriptionService", method)(constructor.prototype[method], method, descriptor);
141
+ }
142
+ const grpcStreamMethods: string[] = [];
143
+ for (const method of grpcStreamMethods) {
144
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
145
+ GrpcStreamMethod("PrescriptionService", method)(constructor.prototype[method], method, descriptor);
146
+ }
147
+ };
148
+ }
149
+
150
+ export const PRESCRIPTION_SERVICE_NAME = "PrescriptionService";
@@ -132,6 +132,16 @@ export interface GetWebOrderByNumberRequest {
132
132
  orderNumber: string;
133
133
  }
134
134
 
135
+ export interface FulfillWebOrderRequest {
136
+ orderId: string;
137
+ cashierId?:
138
+ | string
139
+ | undefined;
140
+ /** PaymentMethod (CASH/CARD/...) */
141
+ paymentMethod: string;
142
+ paidAmount?: string | undefined;
143
+ }
144
+
135
145
  export interface CreateWebOrderItem {
136
146
  productId: string;
137
147
  productBatchId: string;
@@ -230,6 +240,8 @@ export interface WebOrderServiceClient {
230
240
  listWebOrders(request: ListWebOrdersRequest): Observable<ListWebOrdersResponse>;
231
241
 
232
242
  updateWebOrderStatus(request: UpdateWebOrderStatusRequest): Observable<WebOrder>;
243
+
244
+ fulfillWebOrder(request: FulfillWebOrderRequest): Observable<WebOrder>;
233
245
  }
234
246
 
235
247
  export interface WebOrderServiceController {
@@ -244,6 +256,8 @@ export interface WebOrderServiceController {
244
256
  ): Promise<ListWebOrdersResponse> | Observable<ListWebOrdersResponse> | ListWebOrdersResponse;
245
257
 
246
258
  updateWebOrderStatus(request: UpdateWebOrderStatusRequest): Promise<WebOrder> | Observable<WebOrder> | WebOrder;
259
+
260
+ fulfillWebOrder(request: FulfillWebOrderRequest): Promise<WebOrder> | Observable<WebOrder> | WebOrder;
247
261
  }
248
262
 
249
263
  export function WebOrderServiceControllerMethods() {
@@ -254,6 +268,7 @@ export function WebOrderServiceControllerMethods() {
254
268
  "getWebOrderByNumber",
255
269
  "listWebOrders",
256
270
  "updateWebOrderStatus",
271
+ "fulfillWebOrder",
257
272
  ];
258
273
  for (const method of grpcMethods) {
259
274
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prodoctors/contracts",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Protobuf definitions and generated Typescript types for ProDoctors",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -0,0 +1,96 @@
1
+ syntax = "proto3";
2
+
3
+ package prescription.v1;
4
+
5
+
6
+ // POS retsept oqimi: DMED'da retsept qidirish → check-issue → issue.
7
+ // Dori uzpharminfo_id (= UzPharmInfo box_group_id) bo'yicha bog'lanadi.
8
+
9
+ // Retsept qidirish (QR / PINFL / raqam). branch_id — qaysi filial stock'i
10
+ // bilan mos dorilarni ko'rsatish uchun.
11
+ message SearchPrescriptionRequest {
12
+ string branch_id = 1;
13
+ string safe_code = 2;
14
+ optional int64 patient_id = 3;
15
+ optional string pinfl = 4;
16
+ optional string prescription_number = 5;
17
+ optional string birth_date = 6; // YYYY-MM-DD
18
+ optional bool is_confidant = 7;
19
+ optional string qr = 8; // "prescription-{patient_id}-{safe_code}" — parse qilinadi
20
+ }
21
+
22
+ // Bizning katalogdagi mos mahsulot (filialda mavjud stock bilan).
23
+ message MatchedProduct {
24
+ string product_id = 1;
25
+ string name = 2;
26
+ string uzpharminfo_id = 3;
27
+ string gtin = 4;
28
+ int32 available_quantity = 5;
29
+ string price = 6;
30
+ bool requires_prescription = 7;
31
+ }
32
+
33
+ // Retseptdagi ruxsat etilgan dori + bizdagi mos stock.
34
+ message PrescriptionDrugMatch {
35
+ int64 uzpharminfo_id = 1;
36
+ repeated MatchedProduct products = 2;
37
+ }
38
+
39
+ message PrescriptionInfo {
40
+ int64 id = 1;
41
+ string number = 2;
42
+ string status = 3; // active | partially_issued | issued | expired | canceled | draft
43
+ string type = 4;
44
+ string safe_code = 5;
45
+ string expires_at = 6;
46
+ bool is_available_for_issue = 7;
47
+ optional string issue_block_reason = 8;
48
+
49
+ repeated int64 allowed_uzpharminfo_ids = 9;
50
+ int32 allowed_amount = 10;
51
+ bool requires_exact_amount = 11;
52
+
53
+ // appointment (qisqacha)
54
+ string medication_title = 12;
55
+ string dosage = 13;
56
+ int32 total_amount = 14;
57
+
58
+ // bizdagi mos dorilar (filial stock'i bilan)
59
+ repeated PrescriptionDrugMatch matches = 15;
60
+ }
61
+
62
+ message SearchPrescriptionResponse {
63
+ repeated PrescriptionInfo prescriptions = 1;
64
+ }
65
+
66
+ // check-issue va issue uchun umumiy so'rov. Dori: uzpharminfo_id / gtin /
67
+ // marking_code (DataMatrix) dan biri + serial.
68
+ message DispenseRequest {
69
+ int64 prescription_id = 1;
70
+ optional int64 uzpharminfo_id = 2;
71
+ optional string gtin = 3;
72
+ optional string serial_number = 4;
73
+ optional string marking_code = 5;
74
+ int32 drug_amount = 6;
75
+ int64 price = 7;
76
+ }
77
+
78
+ message CheckIssueResponse {
79
+ bool is_available = 1;
80
+ string status = 2;
81
+ }
82
+
83
+ message IssueResponse {
84
+ int64 prescription_id = 1;
85
+ string prescription_status = 2;
86
+ string message = 3;
87
+ }
88
+
89
+ service PrescriptionService {
90
+ // Retsept qidirish + bizdagi mos stockni topish.
91
+ rpc SearchPrescription(SearchPrescriptionRequest) returns (SearchPrescriptionResponse);
92
+ // Berishdan oldin DMED'da tekshirish.
93
+ rpc CheckPrescriptionIssue(DispenseRequest) returns (CheckIssueResponse);
94
+ // Dorini berish (DMED'da qayd).
95
+ rpc IssuePrescription(DispenseRequest) returns (IssueResponse);
96
+ }
@@ -142,6 +142,13 @@ message GetWebOrderByNumberRequest {
142
142
  string order_number = 1;
143
143
  }
144
144
 
145
+ message FulfillWebOrderRequest {
146
+ string order_id = 1;
147
+ optional string cashier_id = 2;
148
+ string payment_method = 3; // PaymentMethod (CASH/CARD/...)
149
+ optional string paid_amount = 4;
150
+ }
151
+
145
152
  message CreateWebOrderItem {
146
153
  string product_id = 1;
147
154
  string product_batch_id = 2;
@@ -196,4 +203,5 @@ service WebOrderService {
196
203
  rpc GetWebOrderByNumber(GetWebOrderByNumberRequest) returns (WebOrder);
197
204
  rpc ListWebOrders(ListWebOrdersRequest) returns (ListWebOrdersResponse);
198
205
  rpc UpdateWebOrderStatus(UpdateWebOrderStatusRequest) returns (WebOrder);
206
+ rpc FulfillWebOrder(FulfillWebOrderRequest) returns (WebOrder);
199
207
  }