@prodoctors/contracts 1.10.0 → 1.12.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
  };
package/gen/inventory.ts CHANGED
@@ -102,7 +102,18 @@ export interface Product {
102
102
  unitsPerPackage: number;
103
103
  allowFractionalSale: boolean;
104
104
  taxMxikCode?: string | undefined;
105
- taxPackageCode?: string | undefined;
105
+ taxPackageCode?:
106
+ | string
107
+ | undefined;
108
+ /**
109
+ * Mavjudlik (faqat so'ralganda to'ldiriladi — masalan web katalog ro'yxati).
110
+ * offers_count = mahsulot mavjud bo'lgan dorixonalar soni; 0 bo'lsa sotuvda yo'q.
111
+ */
112
+ offersCount?:
113
+ | number
114
+ | undefined;
115
+ /** Barcha dorixonalar bo'yicha jami mavjud miqdor (remaining - reserved). */
116
+ availableQuantity?: number | undefined;
106
117
  }
107
118
 
108
119
  export interface ProductBarcode {
@@ -212,7 +223,11 @@ export interface ListProductsRequest {
212
223
  categoryId?: string | undefined;
213
224
  internationalNameId?: string | undefined;
214
225
  manufacturerId?: string | undefined;
215
- status?: ProductStatus | undefined;
226
+ status?:
227
+ | ProductStatus
228
+ | undefined;
229
+ /** Faqat biror dorixonada mavjud (remaining - reserved > 0) mahsulotlar. */
230
+ inStockOnly?: boolean | undefined;
216
231
  }
217
232
 
218
233
  export interface ListProductsResponse {
@@ -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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prodoctors/contracts",
3
- "version": "1.10.0",
3
+ "version": "1.12.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",
@@ -91,6 +91,12 @@ message Product {
91
91
  bool allow_fractional_sale = 27;
92
92
  optional string tax_mxik_code = 28;
93
93
  optional string tax_package_code = 29;
94
+
95
+ // Mavjudlik (faqat so'ralganda to'ldiriladi — masalan web katalog ro'yxati).
96
+ // offers_count = mahsulot mavjud bo'lgan dorixonalar soni; 0 bo'lsa sotuvda yo'q.
97
+ optional int32 offers_count = 30;
98
+ // Barcha dorixonalar bo'yicha jami mavjud miqdor (remaining - reserved).
99
+ optional int32 available_quantity = 31;
94
100
  }
95
101
 
96
102
  message ProductBarcode {
@@ -112,19 +118,19 @@ message ProductBatch {
112
118
  google.protobuf.Timestamp expiry_date = 5;
113
119
  optional google.protobuf.Timestamp manufacture_date = 6;
114
120
  string purchase_price = 7;
115
- string selling_price = 8;
116
- int32 initial_quantity = 9;
117
- int32 remaining_quantity = 10;
118
- BatchStatus status = 11;
119
- optional string purchase_item_id = 12;
120
- optional Product product = 13;
121
+ string selling_price = 8;
122
+ int32 initial_quantity = 9;
123
+ int32 remaining_quantity = 10;
124
+ BatchStatus status = 11;
125
+ optional string purchase_item_id = 12;
126
+ optional Product product = 13;
121
127
  google.protobuf.Timestamp created_at = 14;
122
128
  google.protobuf.Timestamp updated_at = 15;
123
- int32 purchase_package_quantity = 16;
124
- int32 units_per_package = 17;
125
- optional string selling_price_per_base_unit = 18;
126
- int32 reserved_quantity = 19;
127
- }
129
+ int32 purchase_package_quantity = 16;
130
+ int32 units_per_package = 17;
131
+ optional string selling_price_per_base_unit = 18;
132
+ int32 reserved_quantity = 19;
133
+ }
128
134
 
129
135
  message StockMovement {
130
136
  string id = 1;
@@ -201,6 +207,8 @@ message ListProductsRequest {
201
207
  optional string international_name_id = 5;
202
208
  optional string manufacturer_id = 6;
203
209
  optional ProductStatus status = 7;
210
+ // Faqat biror dorixonada mavjud (remaining - reserved > 0) mahsulotlar.
211
+ optional bool in_stock_only = 8;
204
212
  }
205
213
 
206
214
  message ListProductsResponse {
@@ -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
+ }