|
@@ -106,7 +106,93 @@ func HisManagerApiRegistRouters() {
|
106
|
106
|
|
107
|
107
|
beego.Router("/api/getfapiaonumber", &HisApiController{}, "get:GetFaPiaoNumber")
|
108
|
108
|
|
|
109
|
+ //beego.Router("/api/associationprescription", &HisApiController{}, "get:AssociationHisPrescription")
|
|
110
|
+ //beego.Router("/api/checkhispatient", &HisApiController{}, "get:CheckHisPatient")
|
|
111
|
+
|
109
|
112
|
}
|
|
113
|
+
|
|
114
|
+//func (c *HisApiController) CheckHisPatient() {
|
|
115
|
+// record_date := c.GetString("record_date")
|
|
116
|
+// patient_id, _ := c.GetInt64("patient_id")
|
|
117
|
+//
|
|
118
|
+// timeLayout := "2006-01-02"
|
|
119
|
+// loc, _ := time.LoadLocation("Local")
|
|
120
|
+// theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
121
|
+// if err != nil {
|
|
122
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
123
|
+// return
|
|
124
|
+// }
|
|
125
|
+// recordDateTime := theTime.Unix()
|
|
126
|
+// adminInfo := c.GetAdminUserInfo()
|
|
127
|
+// patients, _ := service.GetHisPatientInfoTwo(adminInfo.CurrentOrgId, patient_id, recordDateTime)
|
|
128
|
+// if len(patients) > 1 {
|
|
129
|
+// ps, _ := service.GetHisPrescriptionByHisPatientID(recordDateTime, adminInfo.CurrentOrgId, patient_id)
|
|
130
|
+// if len(ps) > 0 {
|
|
131
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
132
|
+// "status": 1,
|
|
133
|
+// "msg": "关联",
|
|
134
|
+// "ps": ps,
|
|
135
|
+// })
|
|
136
|
+// } else {
|
|
137
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
138
|
+// "status": 0,
|
|
139
|
+// "msg": "无需关联",
|
|
140
|
+// })
|
|
141
|
+// }
|
|
142
|
+// } else {
|
|
143
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
144
|
+// "status": 0,
|
|
145
|
+// "msg": "无需关联",
|
|
146
|
+// })
|
|
147
|
+// return
|
|
148
|
+// }
|
|
149
|
+//}
|
|
150
|
+//func (c *HisApiController) AssociationHisPrescription() {
|
|
151
|
+// record_date, _ := c.GetInt64("record_date")
|
|
152
|
+// his_patient_id, _ := c.GetInt64("his_patient_id")
|
|
153
|
+// patient_id, _ := c.GetInt64("patient_id")
|
|
154
|
+// p_ids := c.GetString("p_ids")
|
|
155
|
+// p_ids_arr := strings.Split(p_ids, ",")
|
|
156
|
+// his_patient, _ := service.GetHisPatientByIdThree(his_patient_id)
|
|
157
|
+// if his_patient_id == 0 || his_patient.ID == 0 {
|
|
158
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
159
|
+// return
|
|
160
|
+// }
|
|
161
|
+// err := service.UpdateHisPrescriptionHisIDByPID(his_patient_id, patient_id, record_date, c.GetAdminUserInfo().CurrentOrgId, p_ids_arr)
|
|
162
|
+// if err == nil {
|
|
163
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
164
|
+// "msg": "关联处方成功",
|
|
165
|
+// })
|
|
166
|
+// return
|
|
167
|
+// } else {
|
|
168
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
169
|
+// return
|
|
170
|
+// }
|
|
171
|
+//}
|
|
172
|
+
|
|
173
|
+//func (c *HisApiController) AssociationHisPrescription() {
|
|
174
|
+// record_date, _ := c.GetInt64("record_date")
|
|
175
|
+// his_patient_id, _ := c.GetInt64("his_patient_id")
|
|
176
|
+// patient_id, _ := c.GetInt64("patient_id")
|
|
177
|
+// p_ids := c.GetString("p_ids")
|
|
178
|
+// p_ids_arr := strings.Split(p_ids, ",")
|
|
179
|
+// his_patient, _ := service.GetHisPatientByIdThree(his_patient_id)
|
|
180
|
+// if his_patient_id == 0 || his_patient.ID == 0 {
|
|
181
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
182
|
+// return
|
|
183
|
+// }
|
|
184
|
+// err := service.UpdateHisPrescriptionHisIDByPID(his_patient_id, patient_id, record_date, c.GetAdminUserInfo().CurrentOrgId, p_ids_arr)
|
|
185
|
+// if err == nil {
|
|
186
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
187
|
+// "msg": "关联处方成功",
|
|
188
|
+// })
|
|
189
|
+// return
|
|
190
|
+// } else {
|
|
191
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
192
|
+// return
|
|
193
|
+// }
|
|
194
|
+//}
|
|
195
|
+
|
110
|
196
|
func (c *HisApiController) GetFaPiaoNumber() {
|
111
|
197
|
max_order, _ := service.GetLastHisOrderTwo(c.GetAdminUserInfo().CurrentOrgId)
|
112
|
198
|
count, _ := strconv.ParseInt(max_order.FaPiaoNumber, 10, 64)
|
|
@@ -1845,11 +1931,16 @@ func (c *HisApiController) CreateHisPrescription() {
|
1845
|
1931
|
//查询该药品是否存在开药记录
|
1846
|
1932
|
advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
|
1847
|
1933
|
|
|
1934
|
+ fmt.Println("wooooooooooooo", advicelist.ID)
|
|
1935
|
+ fmt.Println("prescribingNumberUnit", prescribingNumberUnit)
|
|
1936
|
+ fmt.Println("prescribingNumberUnit", drug.MinUnit)
|
|
1937
|
+ fmt.Println("prescribingNumberUnit", drug.MaxUnit)
|
1848
|
1938
|
//新增处方
|
1849
|
1939
|
if advicelist.ID == 0 {
|
1850
|
1940
|
all_count, _ := strconv.ParseFloat(totals, 64)
|
1851
|
1941
|
if prescribingNumberUnit == drug.MinUnit {
|
1852
|
|
-
|
|
1942
|
+ fmt.Println("prescribing_number", prescribing_number)
|
|
1943
|
+ fmt.Println("all_count", all_count)
|
1853
|
1944
|
if drug.IsUse != 1 {
|
1854
|
1945
|
if drug.IsProject == 0 || drug.IsProject == 2 {
|
1855
|
1946
|
if all_count == 0 {
|
|
@@ -2307,7 +2398,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
2307
|
2398
|
var sum_in_count int64
|
2308
|
2399
|
warehouseInfo, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
|
2309
|
2400
|
sum_in_count = warehouseInfo.StockMaxNumber*drug.MinNumber + warehouseInfo.StockMinNumber
|
2310
|
|
-
|
|
2401
|
+ fmt.Println("sum_in_count", sum_in_count)
|
2311
|
2402
|
//如果修改的数量大于有库存的第一个批次
|
2312
|
2403
|
if number_count > sum_in_count {
|
2313
|
2404
|
c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(warehouseInfo.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(warehouseInfo.StockMinNumber, 10) + drug.MinUnit)
|
|
@@ -9088,7 +9179,7 @@ func (c *HisApiController) GetFaPiaoData() {
|
9088
|
9179
|
"name": order.PsnName, //姓名
|
9089
|
9180
|
"gender": patient.Gender, //性别
|
9090
|
9181
|
"psn_cash_money": order.PsnCashPay, //个人支付
|
9091
|
|
- "pay_way": "门诊", //结算方式
|
|
9182
|
+ "pay_way": "门诊", //结算方式
|
9092
|
9183
|
"medfee_sumamt": order.MedfeeSumamt, //总费用
|
9093
|
9184
|
"admin_user_name": admin.UserName, //收款员
|
9094
|
9185
|
"order": order,
|
|
@@ -10793,12 +10884,25 @@ func (c *HisApiController) GetHisMonthChargePatientInfo() {
|
10793
|
10884
|
case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
10794
|
10885
|
patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type, his_patient_id)
|
10795
|
10886
|
|
|
10887
|
+ month_p_info, _ := service.FindPatientPrescriptionInfoTen(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
|
|
10888
|
+
|
10796
|
10889
|
lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
|
10797
|
10890
|
|
10798
|
10891
|
doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
|
10799
|
10892
|
//获取所有科室信息
|
10800
|
10893
|
department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
|
10801
|
10894
|
|
|
10895
|
+ var dia string
|
|
10896
|
+ for _, item := range month_p_info {
|
|
10897
|
+ if len(dia) == 0 {
|
|
10898
|
+ dia = item.Diagnosis
|
|
10899
|
+ } else {
|
|
10900
|
+ dia = dia + "," + item.Diagnosis
|
|
10901
|
+ }
|
|
10902
|
+ }
|
|
10903
|
+
|
|
10904
|
+ dia_arr := removeDuplicates(strings.Split(dia, ","))
|
|
10905
|
+ dia_arr = removeEmptyStrings(dia_arr)
|
10802
|
10906
|
c.ServeSuccessJSON(map[string]interface{}{
|
10803
|
10907
|
"his_info": his_patient_info,
|
10804
|
10908
|
"xt_info": xt_patient_info,
|
|
@@ -10810,10 +10914,37 @@ func (c *HisApiController) GetHisMonthChargePatientInfo() {
|
10810
|
10914
|
"doctors": doctors,
|
10811
|
10915
|
"department": department,
|
10812
|
10916
|
"settle_total": settle_total,
|
|
10917
|
+ "dia_arr": dia_arr,
|
10813
|
10918
|
})
|
10814
|
10919
|
return
|
10815
|
10920
|
}
|
10816
|
10921
|
|
|
10922
|
+func removeEmptyStrings(input []string) []string {
|
|
10923
|
+ var output []string
|
|
10924
|
+
|
|
10925
|
+ for _, s := range input {
|
|
10926
|
+ if s != "" {
|
|
10927
|
+ output = append(output, s)
|
|
10928
|
+ }
|
|
10929
|
+ }
|
|
10930
|
+
|
|
10931
|
+ return output
|
|
10932
|
+}
|
|
10933
|
+
|
|
10934
|
+func removeDuplicates(input []string) []string {
|
|
10935
|
+ seen := make(map[string]bool)
|
|
10936
|
+ output := []string{}
|
|
10937
|
+
|
|
10938
|
+ for _, s := range input {
|
|
10939
|
+ if _, exists := seen[s]; !exists {
|
|
10940
|
+ seen[s] = true
|
|
10941
|
+ output = append(output, s)
|
|
10942
|
+ }
|
|
10943
|
+ }
|
|
10944
|
+
|
|
10945
|
+ return output
|
|
10946
|
+}
|
|
10947
|
+
|
10817
|
10948
|
func (c *HisApiController) GetHisMonthPatientInfo() {
|
10818
|
10949
|
patient_id, _ := c.GetInt64("patient_id")
|
10819
|
10950
|
his_patient_id, _ := c.GetInt64("his_patient_id")
|