|
@@ -32,6 +32,7 @@ func HisManagerApiRegistRouters() {
|
32
|
32
|
beego.Router("/api/hisprescription/delete", &HisApiController{}, "post:DeletePrescription")
|
33
|
33
|
beego.Router("/api/advice/delete", &HisApiController{}, "post:DeleteDoctorAdvice")
|
34
|
34
|
beego.Router("/api/project/delete", &HisApiController{}, "post:DeleteProject")
|
|
35
|
+ beego.Router("/api/addition_charge/delete", &HisApiController{}, "post:DeleteAddition")
|
35
|
36
|
|
36
|
37
|
beego.Router("/api/hisprescription/list", &HisApiController{}, "get:GetHisPrescriptionList")
|
37
|
38
|
beego.Router("/api/hisprescription/info", &HisApiController{}, "get:GetHisPrescriptionInfo")
|
|
@@ -145,17 +146,16 @@ func (c *HisApiController) GetHisPatientInfo() {
|
145
|
146
|
patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
146
|
147
|
lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
147
|
148
|
order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
|
148
|
|
- addtions, _ := service.GetAllAdditionCharge(admin.CurrentOrgId, patient_id, recordDateTime)
|
|
149
|
+ //addtions, _ := service.GetAllAdditionCharge(admin.CurrentOrgId, patient_id, recordDateTime)
|
149
|
150
|
|
150
|
151
|
c.ServeSuccessJSON(map[string]interface{}{
|
151
|
|
- "his_info": his_patient_info,
|
152
|
|
- "xt_info": xt_patient_info,
|
153
|
|
- "prescription": prescriptions,
|
154
|
|
- "case_history": case_history,
|
155
|
|
- "info": patientPrescriptionInfo,
|
156
|
|
- "last_info": lastPatientPrescriptionInfo,
|
157
|
|
- "order": order,
|
158
|
|
- "addtions_charge": addtions,
|
|
152
|
+ "his_info": his_patient_info,
|
|
153
|
+ "xt_info": xt_patient_info,
|
|
154
|
+ "prescription": prescriptions,
|
|
155
|
+ "case_history": case_history,
|
|
156
|
+ "info": patientPrescriptionInfo,
|
|
157
|
+ "last_info": lastPatientPrescriptionInfo,
|
|
158
|
+ "order": order,
|
159
|
159
|
})
|
160
|
160
|
return
|
161
|
161
|
|
|
@@ -200,7 +200,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
200
|
200
|
diagnose := c.GetString("diagnose")
|
201
|
201
|
sick_history := c.GetString("sick_history")
|
202
|
202
|
doctor_id, _ := c.GetInt64("doctor", 0)
|
203
|
|
- department := c.GetString("department")
|
|
203
|
+ department, _ := c.GetInt64("department", 0)
|
204
|
204
|
his_patient_id, _ := c.GetInt64("his_patient_id")
|
205
|
205
|
dataBody := make(map[string]interface{}, 0)
|
206
|
206
|
err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
|
|
@@ -386,6 +386,40 @@ func (c *HisApiController) CreateHisPrescription() {
|
386
|
386
|
}
|
387
|
387
|
}
|
388
|
388
|
}
|
|
389
|
+ if items["addition"] != nil && reflect.TypeOf(items["addition"]).String() == "[]interface {}" {
|
|
390
|
+ addition := items["addition"].([]interface{})
|
|
391
|
+ //group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
|
|
392
|
+ ctime := time.Now().Unix()
|
|
393
|
+ mtime := ctime
|
|
394
|
+ if len(addition) > 0 {
|
|
395
|
+ for _, item := range addition {
|
|
396
|
+ var s models.HisAdditionalCharge
|
|
397
|
+ s.PrescriptionId = prescription.ID
|
|
398
|
+ s.Status = 1
|
|
399
|
+ s.UserOrgId = adminInfo.CurrentOrgId
|
|
400
|
+ s.RecordDate = recordDateTime
|
|
401
|
+ s.CreatedTime = ctime
|
|
402
|
+ s.UpdatedTime = mtime
|
|
403
|
+ s.PatientId = patient_id
|
|
404
|
+ s.HisPatientId = his_patient_id
|
|
405
|
+ errcode := c.setAddtionWithJSON(&s, item.(map[string]interface{}))
|
|
406
|
+ if errcode > 0 {
|
|
407
|
+ c.ServeFailJSONWithSGJErrorCode(errcode)
|
|
408
|
+ return
|
|
409
|
+ }
|
|
410
|
+ service.CreateAdditionalCharge(&s)
|
|
411
|
+ var randNum int
|
|
412
|
+ randNum = rand.Intn(10000) + 1000
|
|
413
|
+ timestamp := time.Now().Unix()
|
|
414
|
+ tempTime := time.Unix(timestamp, 0)
|
|
415
|
+ timeFormat := tempTime.Format("20060102150405")
|
|
416
|
+ s.FeedetlSn = timeFormat + strconv.FormatInt(int64(randNum), 10) + "-" + "3" + "-" + strconv.FormatInt(s.ID, 10)
|
|
417
|
+ service.CreateAdditionalCharge(&s)
|
|
418
|
+
|
|
419
|
+ }
|
|
420
|
+ }
|
|
421
|
+ }
|
|
422
|
+
|
389
|
423
|
}
|
390
|
424
|
}
|
391
|
425
|
}
|
|
@@ -864,6 +898,34 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
|
864
|
898
|
return 0
|
865
|
899
|
}
|
866
|
900
|
|
|
901
|
+func (c *HisApiController) setAddtionWithJSON(additionalCharge *models.HisAdditionalCharge, json map[string]interface{}) int {
|
|
902
|
+ if json["id"] != nil || reflect.TypeOf(json["id"]).String() == "float64" {
|
|
903
|
+ id := int64(json["id"].(float64))
|
|
904
|
+ additionalCharge.ID = id
|
|
905
|
+ }
|
|
906
|
+ if json["item_id"] != nil || reflect.TypeOf(json["item_id"]).String() == "float64" {
|
|
907
|
+ item_id := int64(json["item_id"].(float64))
|
|
908
|
+ additionalCharge.ItemId = item_id
|
|
909
|
+ }
|
|
910
|
+ if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
|
|
911
|
+ price := int64(json["price"].(float64))
|
|
912
|
+ formatInt_price := strconv.FormatInt(price, 10)
|
|
913
|
+ float_price, _ := strconv.ParseFloat(formatInt_price, 64)
|
|
914
|
+ additionalCharge.Price = float_price
|
|
915
|
+ }
|
|
916
|
+ if json["count"] != nil && reflect.TypeOf(json["count"]).String() == "string" {
|
|
917
|
+ count, _ := json["count"].(string)
|
|
918
|
+ counts, _ := strconv.ParseInt(count, 10, 64)
|
|
919
|
+ additionalCharge.Count = counts
|
|
920
|
+ }
|
|
921
|
+ if json["item_name"] != nil && reflect.TypeOf(json["item_name"]).String() == "string" {
|
|
922
|
+ item_name, _ := json["item_name"].(string)
|
|
923
|
+ additionalCharge.ItemName = item_name
|
|
924
|
+ }
|
|
925
|
+
|
|
926
|
+ return 0
|
|
927
|
+}
|
|
928
|
+
|
867
|
929
|
func (c *HisApiController) GetHisOrderList() {
|
868
|
930
|
adminUser := c.GetAdminUserInfo()
|
869
|
931
|
org_id := adminUser.CurrentOrgId
|
|
@@ -1202,11 +1264,14 @@ func (c *HisApiController) GetRegisterInfo() {
|
1202
|
1264
|
ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
|
1203
|
1265
|
|
1204
|
1266
|
count, _ := service.FindHisRegisterRecord(theTime.Unix(), patient.ID, adminInfo.CurrentOrgId)
|
|
1267
|
+
|
|
1268
|
+ department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
|
|
1269
|
+
|
1205
|
1270
|
if count <= 0 {
|
1206
|
1271
|
api := "http://127.0.0.1:9531/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" +
|
1207
|
1272
|
res.Output.Iinfo[0].Insutype + "&psn_no=" + res.Output.Baseinfo.PsnNo +
|
1208
|
1273
|
"&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&ipt_otp_no=" + ipt_otp_no +
|
1209
|
|
- "&dept=" + patientPrescription.Departments + "&fixmedins_code=" + miConfig.Code
|
|
1274
|
+ "&dept=" + department.Name + "&fixmedins_code=" + miConfig.Code
|
1210
|
1275
|
resp, requestErr := http.Get(api)
|
1211
|
1276
|
if requestErr != nil {
|
1212
|
1277
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
@@ -1256,7 +1321,7 @@ func (c *HisApiController) GetRegisterInfo() {
|
1256
|
1321
|
err := service.CreateHisPatientTwo(&his)
|
1257
|
1322
|
if err == nil {
|
1258
|
1323
|
api := "http://127.0.0.1:9531/" + "gdyb/four?psn_no=" + his.PsnNo +
|
1259
|
|
- "&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + patientPrescription.Departments +
|
|
1324
|
+ "&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
|
1260
|
1325
|
"&diag=" + patientPrescription.Diagnosis + "&org_name=" + miConfig.OrgName + "&med_type=" + "11" + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code
|
1261
|
1326
|
resp, requestErr := http.Get(api)
|
1262
|
1327
|
if requestErr != nil {
|
|
@@ -1345,7 +1410,6 @@ func (c *HisApiController) GetUploadInfo() {
|
1345
|
1410
|
recordDateTime := theTime.Unix()
|
1346
|
1411
|
adminUser := c.GetAdminUserInfo()
|
1347
|
1412
|
prescriptions, _ := service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
|
1348
|
|
- additions, _ := service.GetAllAdditionCharge(adminUser.CurrentOrgId, id, recordDateTime)
|
1349
|
1413
|
|
1350
|
1414
|
his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
1351
|
1415
|
|
|
@@ -1372,15 +1436,12 @@ func (c *HisApiController) GetUploadInfo() {
|
1372
|
1436
|
data["fixmedins_code"] = miConfig.Code
|
1373
|
1437
|
|
1374
|
1438
|
var ids []int64
|
1375
|
|
- var idsTwo []int64
|
1376
|
|
-
|
|
1439
|
+ //var idsTwo []int64
|
|
1440
|
+ //
|
1377
|
1441
|
for _, item := range prescriptions {
|
1378
|
1442
|
ids = append(ids, item.ID)
|
1379
|
1443
|
}
|
1380
|
1444
|
|
1381
|
|
- for _, item := range additions {
|
1382
|
|
- idsTwo = append(idsTwo, item.ID)
|
1383
|
|
- }
|
1384
|
1445
|
config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
1385
|
1446
|
|
1386
|
1447
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
|
@@ -1631,11 +1692,10 @@ func (c *HisApiController) GetUploadInfo() {
|
1631
|
1692
|
total = total + (subItem.Price * float64(subItem.Count))
|
1632
|
1693
|
}
|
1633
|
1694
|
}
|
1634
|
|
- }
|
1635
|
|
-
|
1636
|
|
- for _, item := range additions {
|
1637
|
|
- total = total + item.Price
|
1638
|
1695
|
|
|
1696
|
+ for _, subItem := range item.HisAdditionalCharge {
|
|
1697
|
+ total = total + (subItem.Price * float64(subItem.Count))
|
|
1698
|
+ }
|
1639
|
1699
|
}
|
1640
|
1700
|
|
1641
|
1701
|
allTotal := fmt.Sprintf("%.2f", total)
|
|
@@ -1679,6 +1739,7 @@ func (c *HisApiController) GetUploadInfo() {
|
1679
|
1739
|
|
1680
|
1740
|
if item.Type == 2 { //项目
|
1681
|
1741
|
for _, subItem := range item.HisPrescriptionProject {
|
|
1742
|
+
|
1682
|
1743
|
cus := &Custom{
|
1683
|
1744
|
AdviceId: 0,
|
1684
|
1745
|
ProjectId: subItem.ID,
|
|
@@ -1693,22 +1754,23 @@ func (c *HisApiController) GetUploadInfo() {
|
1693
|
1754
|
customs = append(customs, cus)
|
1694
|
1755
|
}
|
1695
|
1756
|
}
|
1696
|
|
- }
|
1697
|
1757
|
|
1698
|
|
- for _, item := range additions {
|
1699
|
|
- cus := &Custom{
|
1700
|
|
- ItemId: item.ID,
|
1701
|
|
- AdviceId: 0,
|
1702
|
|
- ProjectId: 0,
|
1703
|
|
- DetItemFeeSumamt: fmt.Sprintf("%.2f", item.Price),
|
1704
|
|
- Cut: fmt.Sprintf("%.2f", float64(1)),
|
1705
|
|
- FeedetlSn: item.FeedetlSn,
|
1706
|
|
- Price: fmt.Sprintf("%.2f", float64(item.Price)),
|
1707
|
|
- MedListCodg: item.XtHisAddtionConfig.Code,
|
1708
|
|
- Type: 3,
|
|
1758
|
+ for _, item := range item.HisAdditionalCharge {
|
|
1759
|
+ cus := &Custom{
|
|
1760
|
+ ItemId: item.ID,
|
|
1761
|
+ AdviceId: 0,
|
|
1762
|
+ ProjectId: 0,
|
|
1763
|
+ DetItemFeeSumamt: fmt.Sprintf("%.2f", item.Price),
|
|
1764
|
+ Cut: fmt.Sprintf("%.2f", float64(item.Count)),
|
|
1765
|
+ FeedetlSn: item.FeedetlSn,
|
|
1766
|
+ Price: fmt.Sprintf("%.2f", float64(item.Price)),
|
|
1767
|
+ MedListCodg: item.XtHisAddtionConfig.Code,
|
|
1768
|
+ Type: 3,
|
|
1769
|
+ }
|
|
1770
|
+
|
|
1771
|
+ customs = append(customs, cus)
|
1709
|
1772
|
}
|
1710
|
1773
|
|
1711
|
|
- customs = append(customs, cus)
|
1712
|
1774
|
}
|
1713
|
1775
|
|
1714
|
1776
|
for _, item := range customs {
|
|
@@ -1730,7 +1792,6 @@ func (c *HisApiController) GetUploadInfo() {
|
1730
|
1792
|
} else if item.Type == 3 {
|
1731
|
1793
|
advice_id = 0
|
1732
|
1794
|
item_id = item.ItemId
|
1733
|
|
-
|
1734
|
1795
|
project_id = 0
|
1735
|
1796
|
}
|
1736
|
1797
|
|
|
@@ -1758,7 +1819,7 @@ func (c *HisApiController) GetUploadInfo() {
|
1758
|
1819
|
}
|
1759
|
1820
|
service.CreateOrderInfo(info)
|
1760
|
1821
|
}
|
1761
|
|
- err := service.UpDateAddtionNumber(adminUser.CurrentOrgId, idsTwo, chrg_bchno)
|
|
1822
|
+ //err := service.UpDateAddtionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
|
1762
|
1823
|
err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
|
1763
|
1824
|
err = service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, id, chrg_bchno, recordDateTime)
|
1764
|
1825
|
err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
|
|
@@ -1856,3 +1917,19 @@ func (this *HisApiController) AdditionalCharge() {
|
1856
|
1917
|
"additional_charges": additionalCharges,
|
1857
|
1918
|
})
|
1858
|
1919
|
}
|
|
1920
|
+
|
|
1921
|
+func (this *HisApiController) DeleteAddition() {
|
|
1922
|
+ id, _ := this.GetInt64("id")
|
|
1923
|
+ //TODO 需要判断是否已经结算
|
|
1924
|
+ err := service.DelelteAddition(id, this.GetAdminUserInfo().CurrentOrgId)
|
|
1925
|
+ if err == nil {
|
|
1926
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1927
|
+ "msg": "删除成功",
|
|
1928
|
+ })
|
|
1929
|
+ return
|
|
1930
|
+ } else {
|
|
1931
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1932
|
+ return
|
|
1933
|
+ }
|
|
1934
|
+
|
|
1935
|
+}
|